Skip to content

Commit

Permalink
Appease eslint, allow deliberate unused vars (#284)
Browse files Browse the repository at this point in the history
Along with a few small changes to fix eslint complaints add a rule which
allows unused variables in typescript files if the variable in question
is prefixed with "_".
  • Loading branch information
alexjg authored Jan 30, 2024
1 parent 23d8461 commit aadf0f3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = {
"no-use-before-define": OFF,
"@typescript-eslint/no-non-null-assertion": OFF,
"@typescript-eslint/no-explicit-any": OFF,
"@typescript-eslint/no-unused-vars": [ERROR, {"varsIgnorePattern": "^_"}],
},
root: true,
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class WebSocketNetworkAdapter extends NetworkAdapter {
}

export class BrowserWebSocketClientAdapter extends WebSocketNetworkAdapter {
#isReady: boolean = false
#isReady = false
#retryIntervalId?: TimeoutId
#log = debug("automerge-repo:websocket:browser")

Expand Down
2 changes: 2 additions & 0 deletions packages/automerge-repo-react-hooks/src/useDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export const useDocuments = <T>(ids?: DocId[]) => {
handle.doc().then(doc => {
updateDocument(id, doc)
addListener(handle)
}).catch(err => {
console.error(`Error loading document ${id} in useDocuments: `, err)
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/automerge-repo-storage-nodefs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class NodeFSStorageAdapter extends StorageAdapter {
/**
* @param baseDirectory - The path to the directory to store data in. Defaults to "./automerge-repo-data".
*/
constructor(baseDirectory: string = "automerge-repo-data") {
constructor(baseDirectory = "automerge-repo-data") {
super()
this.baseDirectory = baseDirectory
}
Expand Down
2 changes: 1 addition & 1 deletion packages/automerge-repo/src/DocHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class DocHandle<T> //
#log: debug.Debugger

#machine: DocHandleXstateMachine<T>
#timeoutDelay: number = 60_000
#timeoutDelay = 60_000
#remoteHeads: Record<StorageId, A.Heads> = {}

/** The URL of this document
Expand Down

0 comments on commit aadf0f3

Please sign in to comment.