diff --git a/scripts/build.sh b/scripts/build.sh index d70c50dd..51cb6d81 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -39,6 +39,7 @@ fi # .bracketexpr.generated.ts is needed for metadata generation ( printf '/* tslint:disable:no-trailing-whitespace */\n' +printf '/* tslint:disable:no-unnecessary-initializer */\n' "$(npm bin)/nearleyc" src/grammars/bracketexpr.ne ) > src/grammars/.bracketexpr.generated.ts diff --git a/src/background/nearley_utils.ts b/src/background/nearley_utils.ts index 05e600f6..f2ab41c8 100644 --- a/src/background/nearley_utils.ts +++ b/src/background/nearley_utils.ts @@ -13,7 +13,7 @@ export class Parser { } feedUntilError(input) { - let lastResult = undefined + let lastResult let consumedIndex = 0 try { for (let val of input) { diff --git a/src/commandline_frame.ts b/src/commandline_frame.ts index ddf5d13d..ad9a91b3 100644 --- a/src/commandline_frame.ts +++ b/src/commandline_frame.ts @@ -49,7 +49,7 @@ import * as tri_editor from "@src/lib/editor" const logger = new Logger("cmdline") /** @hidden **/ -let activeCompletions: Completions.CompletionSource[] = undefined +let activeCompletions: Completions.CompletionSource[] /** @hidden **/ let completionsDiv = window.document.getElementById("completions") /** @hidden **/ diff --git a/src/content/controller_content.ts b/src/content/controller_content.ts index 3c62fab4..20252244 100644 --- a/src/content/controller_content.ts +++ b/src/content/controller_content.ts @@ -140,8 +140,7 @@ function* ParserController() { // unbounded length. keyEvents.push(keyevent) - let response = undefined - response = parsers[contentState.mode](keyEvents) + let response = parsers[contentState.mode](keyEvents) logger.debug( currentMode, contentState.mode, diff --git a/src/content/hinting.ts b/src/content/hinting.ts index 55ce5ee7..f46282e3 100644 --- a/src/content/hinting.ts +++ b/src/content/hinting.ts @@ -93,7 +93,7 @@ class HintState { } } -let modeState: HintState = undefined +let modeState: HintState /** For each hintable element, add a hint */ export function hintPage( diff --git a/src/content/scrolling.ts b/src/content/scrolling.ts index d8f7413a..a2abdd8d 100644 --- a/src/content/scrolling.ts +++ b/src/content/scrolling.ts @@ -105,7 +105,7 @@ export async function scroll( x: number = 0, y: number = 0, e: Node, - duration: number = undefined, + duration?: number, ) { let smooth = await getSmooth() if (smooth == "false") duration = 0 @@ -145,8 +145,8 @@ let lastY = 0 export async function recursiveScroll( x: number, y: number, - node: Element = undefined, - stopAt: Element = undefined, + node?: Element, + stopAt?: Element, ) { let startingFromCached = false if (!node) { diff --git a/src/excmds.ts b/src/excmds.ts index 999b9a94..2fe38dc2 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -1130,7 +1130,7 @@ export async function url2args() { /** @hidden */ //#content_helper -let sourceElement = undefined +let sourceElement /** @hidden */ //#content_helper function removeSource() { @@ -1516,7 +1516,7 @@ export function urlparent(count = 1) { //#content export function urlmodify(mode: "-t" | "-r" | "-q" | "-Q" | "-g", ...args: string[]) { let oldUrl = new URL(window.location.href) - let newUrl = undefined + let newUrl switch (mode) { case "-t": diff --git a/src/lib/messaging.ts b/src/lib/messaging.ts index e8778bae..a7711002 100644 --- a/src/lib/messaging.ts +++ b/src/lib/messaging.ts @@ -84,7 +84,7 @@ export async function messageTab(tabId, type: TabMessageType, command, args?) { return browserBg.tabs.sendMessage(tabId, message) } -let _ownTabId = undefined +let _ownTabId export async function messageOwnTab(type: TabMessageType, command, args?) { if (_ownTabId === undefined) { _ownTabId = await ownTabId() diff --git a/src/parsers/gobblemode.ts b/src/parsers/gobblemode.ts index 7ca1c35d..0ad82237 100644 --- a/src/parsers/gobblemode.ts +++ b/src/parsers/gobblemode.ts @@ -8,7 +8,7 @@ class GobbleState { public endCommand = "" } -let modeState: GobbleState = undefined +let modeState: GobbleState /** Init gobble mode. After parsing the defined number of input keys, execute `endCmd` with attached parsed input. `Escape` cancels the mode and returns to diff --git a/tslint.json b/tslint.json index 9a0136bf..6d76af88 100644 --- a/tslint.json +++ b/tslint.json @@ -23,7 +23,6 @@ "no-identical-functions": false, "no-shadowed-variable": false, "no-string-throw": false, - "no-unnecessary-initializer": false, "no-unsafe-finally": false, "no-var-keyword": false, "no-variable-usage-before-declaration": false,