Re-enable no-empty-function

This commit is contained in:
Oliver Blanthorn 2020-06-18 22:35:24 +01:00
parent a146306d0b
commit eac06ae39a
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
13 changed files with 24 additions and 27 deletions

View file

@ -100,7 +100,7 @@ module.exports = {
],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-function": "off", //"error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-non-null-assertion": "error",
@ -251,5 +251,12 @@ module.exports = {
],
"use-isnan": "error",
"valid-typeof": "off"
}
},
// // We ultimately didn't need this but I thought I should document it anyway
// "overrides": [{
// "files": ["src/completions/*.ts",],
// "rules": {
// "@typescript-eslint/no-empty-function": "off",
// },
// }],
};

View file

@ -4,29 +4,14 @@
*/
import * as controller from "@src/lib/controller"
export async function inputStartedListener() {
}
export async function inputChangedListener(
currentInput: string,
emitSuggestion: (suggestions: browser.omnibox.SuggestResult[]) => void
) {
}
export async function inputEnteredListener(
input: string, disposition:
browser.omnibox.OnInputEnteredDisposition) {
controller.acceptExCmd(input)
}
export async function inputCancelledListener() {
}
export async function init() {
browser.omnibox.onInputStarted.addListener(inputStartedListener)
browser.omnibox.onInputChanged.addListener(inputChangedListener)
browser.omnibox.onInputEntered.addListener(inputEnteredListener)
browser.omnibox.onInputCancelled.addListener(inputCancelledListener)
browser.omnibox.setDefaultSuggestion({
description: `Execute a Tridactyl exstr (for example, "tabopen -c container www.google.com")`,
})

View file

@ -324,7 +324,10 @@ export abstract class CompletionSourceFuse extends CompletionSource {
}
/* abstract onUpdate(query: string, prefix: string, options: CompletionOptionFuse[]) */
abstract onInput(exstr: string)
// Lots of methods don't need this but some do
// eslint-disable-next-line @typescript-eslint/no-empty-function
async onInput(exstr: string) {}
}
// }}}

View file

@ -144,5 +144,4 @@ export class AproposCompletionSource extends Completions.CompletionSourceFuse {
return this.updateDisplay()
}
onInput() {}
}

View file

@ -144,5 +144,5 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
return this.updateDisplay()
}
onInput() {}
}

View file

@ -81,7 +81,6 @@ export class BmarkCompletionSource extends Completions.CompletionSourceFuse {
return this.updateDisplay()
}
onInput() {}
select(option: Completions.CompletionOption) {
if (this.lastExstr !== undefined && option !== undefined) {

View file

@ -51,7 +51,6 @@ export class ExtensionsCompletionSource extends Completions.CompletionSourceFuse
return this.updateChain()
}
onInput() {}
updateChain() {
this.options.forEach(option => (option.state = "normal"))

View file

@ -144,5 +144,5 @@ export class HelpCompletionSource extends Completions.CompletionSourceFuse {
return this.updateDisplay()
}
onInput() {}
}

View file

@ -99,9 +99,10 @@ export class HistoryCompletionSource extends Completions.CompletionSourceFuse {
return this.updateDisplay()
}
// We don't need this inherited function
// eslint-disable-next-line @typescript-eslint/no-empty-function
updateChain() {}
onInput() {}
private async scoreOptions(query: string, n: number) {
if (!query || config.get("historyresults") === 0) {

View file

@ -98,5 +98,5 @@ export class SettingsCompletionSource extends Completions.CompletionSourceFuse {
return this.updateDisplay()
}
onInput() {}
}

View file

@ -319,8 +319,8 @@ let modeState: HintState
export function hintPage(
hintableElements: Element[],
onSelect: HintSelectedCallback,
resolve = () => {},
reject = () => {},
resolve = () => {}, //eslint-disable-line @typescript-eslint/no-empty-function
reject = () => {}, //eslint-disable-line @typescript-eslint/no-empty-function
rapid = false,
) {
const buildHints: HintBuilder = defaultHintBuilder()

View file

@ -215,6 +215,9 @@ addEventListener(
case "/static/docs/classes/_src_lib_config_.default_config.html":
return onSettingsPageLoad
}
// If we're on a different help page we don't need any side-effects
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {}
})(),
)

View file

@ -56,6 +56,7 @@ export class Logger {
}
// do nothing with the message
// eslint-disable-next-line @typescript-eslint/no-empty-function
return function(...args) {}
}