Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

Commit 704716e

Browse files
committed
linting pass
1 parent 433ea99 commit 704716e

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

components/Errors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Errors = ({errors}: IErrorsProps) => {
1111
return null
1212
}
1313

14-
// only renders first 3 errors, truncates rest
14+
// Only renders first 3 errors, truncates rest
1515
return (
1616
<Box marginTop={2} flexDirection="column">
1717
<Text bold color="red">Errors:</Text>

components/FileTree.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ const Legend = () => (
3838
// is current filed queued for upload/download
3939
const isFileQueued = (file: ITreeRepresentation) => file.stats.numTransfers === 0 && !file.stats.hasEnded
4040

41-
// format number [0,1] to percent scale with 1 decimal point
41+
// Format number [0,1] to percent scale with 1 decimal point
4242
const fmtPercentage = (number: number) => `${(number * 100).toFixed(1)}%`
4343

44-
4544
interface IFileTreeProps {
4645
registry: ITreeRepresentation[];
4746
full: boolean;
@@ -81,14 +80,14 @@ const TruncatedTreeFile = ({file}: {file: ITreeRepresentation}) => (
8180

8281
// File tree display component
8382
const FileTree = ({registry, full}: IFileTreeProps) => {
84-
// number of lines to display (truncate if screen is small)
83+
// Number of lines to display (truncate if screen is small)
8584
const DISPLAY_NUM = Math.max(useStdoutDimensions()[1] - 15, 1)
8685

8786
const emptyMessage = full
8887
? <Text color="yellow">No files found</Text>
8988
: <Text bold color="green">All files synced</Text>
9089

91-
// only show non-folders and unsynced/syncing files by default
90+
// Only show non-folders and unsynced/syncing files by default
9291
const files = full ? registry : registry.filter(file => (file.status !== STATUS.synced) && !file.isDir).sort((a, b) => b.size - a.size)
9392
return (
9493
<Box flexDirection="column" marginY={1}>

contexts/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface IAppContextProps {
1212
setClosed: () => void;
1313
}
1414

15-
// default AppContext
15+
// Default AppContext
1616
const AppContext = createContext<IAppContextProps>({
1717
numConnected: 0,
1818
closed: false,
@@ -29,7 +29,7 @@ export const AppContextProvider = ({children, hyper}: IAppContextProviderProps)
2929

3030
const [closed, setClosed] = useState(false)
3131

32-
// assign memoized context value
32+
// Assign memoized context value
3333
const contextValue = useMemo(() => ({
3434
hyperObj: hyper.hyperObj,
3535
numConnected: hyper.numConnected,

domain/registry.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export class Registry {
2727
rerender: () => void
2828

2929
errorCallback: (error: string) => void
30-
// refetch upload/download stats
30+
// Refetch upload/download stats
3131
refreshStats: () => void
3232
stats: Map<string, IStreamPumpStats>
3333

34-
// task priority queue
34+
// Task priority queue
3535
q: PQ
3636

3737
private readonly root: TrieNode
@@ -48,11 +48,11 @@ export class Registry {
4848
this.subscribers = new Map()
4949
this.stats = new Map<string, IStreamPumpStats>()
5050

51-
// default to 4 concurrent upload/downloads
51+
// Default to 4 concurrent upload/downloads
5252
this.q = new PQ({concurrency: 4})
5353
}
5454

55-
// fetch overall throughput stats
55+
// Fetch overall throughput stats
5656
getStats() {
5757
return [...this.stats.values()].reduce((total, status) => {
5858
total.totalBytes += status.totalTransferred
@@ -67,7 +67,7 @@ export class Registry {
6767
})
6868
}
6969

70-
// internal debug message
70+
// Internal debug message
7171
_debug(message: string) {
7272
if (this.DEBUG) {
7373
const now = new Date().toISOString()
@@ -152,13 +152,13 @@ export class Registry {
152152
insert(pathSegments: string[], isDir = false, newSize?: number): void {
153153
let cur = this.root
154154
for (const segment of pathSegments) {
155-
// doesnt exist, create intermediate node
155+
// Doesnt exist, create intermediate node
156156
if (!cur.children[segment]) {
157157
cur.children[segment] = new TrieNode(this, segment, true, newSize)
158158
cur.children[segment].parent = cur
159159
}
160160

161-
// mark as unsynced and traverse another layer down
161+
// Mark as unsynced and traverse another layer down
162162
cur.markUnsynced()
163163
cur = cur.children[segment]
164164
}
@@ -202,13 +202,13 @@ export class Registry {
202202
this._debug(`updating ${pathSegments.join('/')}`)
203203
const modNode = this.find(pathSegments)
204204

205-
// only update if node exists
205+
// Only update if node exists
206206
if (modNode) {
207207
if (newSize) {
208208
modNode.sizeBytes = newSize
209209
}
210210

211-
// mark all parents as unsynced now that we've updated
211+
// Mark all parents as unsynced now that we've updated
212212
modNode.traverse().forEach(node => {
213213
node.markUnsynced()
214214
})
@@ -236,7 +236,7 @@ export class Registry {
236236
}
237237
}
238238

239-
// main handler to parse eventdata
239+
// Main handler to parse eventdata
240240
_onChangeCallback(data: EventData) {
241241
this.parseEvt(data)
242242
for (const fn of this.subscribers.values()) {
@@ -286,7 +286,7 @@ export class Registry {
286286
this.errorCallback(`[subscribe]: ${error.message}`)
287287
})
288288

289-
// listen for changes in eventLog
289+
// Listen for changes in eventLog
290290
eventLog.createReadStream({
291291
tail: true,
292292
live: true,
@@ -296,7 +296,7 @@ export class Registry {
296296
return this
297297
}
298298

299-
// remove all callbacks and delete everything
299+
// Remove all callbacks and delete everything
300300
nuke() {
301301
this._debug('nuking current registry')
302302
this.drive = undefined

domain/trie.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TrieNode {
6969
return Object.values(this.children)
7070
}
7171

72-
// traverses parents and ensures each parent is up to date
72+
// Traverses parents and ensures each parent is up to date
7373
_updateParentStates() {
7474
this.traverse().reverse().forEach(node => {
7575
if (node.getChildren().every(child => child.status === STATUS.synced)) {
@@ -103,7 +103,7 @@ export class TrieNode {
103103
const statusPromises: Array<Promise<STATUS>> = this.getChildren()
104104
.map(async child => child._treeOp(opName, op, ctx, folderPreRun))
105105

106-
// wait for all to finish
106+
// Wait for all to finish
107107
return Promise.all(statusPromises)
108108
.then(() => this._updateParentStates())
109109
.catch((error: Error) => {

0 commit comments

Comments
 (0)