diff --git a/src/commandline_frame.ts b/src/commandline_frame.ts index c19eb3e0..ddf5d13d 100644 --- a/src/commandline_frame.ts +++ b/src/commandline_frame.ts @@ -51,9 +51,7 @@ const logger = new Logger("cmdline") /** @hidden **/ let activeCompletions: Completions.CompletionSource[] = undefined /** @hidden **/ -let completionsDiv = window.document.getElementById( - "completions", -) as HTMLElement +let completionsDiv = window.document.getElementById("completions") /** @hidden **/ let clInput = window.document.getElementById( "tridactyl-input", diff --git a/src/completions.ts b/src/completions.ts index 2d72a4d5..e26cad56 100644 --- a/src/completions.ts +++ b/src/completions.ts @@ -239,8 +239,7 @@ export abstract class CompletionSourceFuse extends CompletionSource { return { index, fuseKeys: elem.fuseKeys } }) this.fuse = new Fuse(searchThis, this.fuseOptions) - return this.fuse.search(query).map(res => { - let result = res as any + return this.fuse.search(query).map(result => { // console.log(result, result.item, query) let index = toNumber(result.item) return { diff --git a/src/content/controller_content.ts b/src/content/controller_content.ts index 353ef017..3c62fab4 100644 --- a/src/content/controller_content.ts +++ b/src/content/controller_content.ts @@ -141,7 +141,7 @@ function* ParserController() { keyEvents.push(keyevent) let response = undefined - response = (parsers[contentState.mode] as any)(keyEvents) + response = parsers[contentState.mode](keyEvents) logger.debug( currentMode, contentState.mode, diff --git a/src/excmds.ts b/src/excmds.ts index f049b9a9..741fc664 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -1349,6 +1349,7 @@ export function snow_mouse_mode() { //#content_helper function findRelLink(pattern: RegExp): HTMLAnchorElement | null { // querySelectorAll returns a "non-live NodeList" which is just a shit array without working reverse() or find() calls, so convert it. + /* tslint:disable:no-useless-cast */ const links = Array.from(document.querySelectorAll("a[href]") as NodeListOf) // Find the last link that matches the test @@ -1364,6 +1365,7 @@ function findRelLink(pattern: RegExp): HTMLAnchorElement | null { // Return the last element in the document matching the supplied selector, // or null if there are no matches. function selectLast(selector: string): HTMLElement | null { + /* tslint:disable:no-useless-cast */ const nodes = document.querySelectorAll(selector) as NodeListOf return nodes.length ? nodes[nodes.length - 1] : null } @@ -1574,7 +1576,7 @@ export function urlmodify(mode: "-t" | "-r" | "-q" | "-Q" | "-g", ...args: strin */ //#content export function geturlsforlinks(reltype = "rel", rel: string) { - let elems = document.querySelectorAll("link[" + reltype + "='" + rel + "']") as NodeListOf + let elems = document.querySelectorAll("link[" + reltype + "='" + rel + "']") if (elems) return Array.prototype.map.call(elems, x => x.href) return [] } diff --git a/src/lib/containers.ts b/src/lib/containers.ts index cd420101..5f55808c 100644 --- a/src/lib/containers.ts +++ b/src/lib/containers.ts @@ -217,7 +217,7 @@ export async function fuzzyMatch(partialName: string): Promise { let fuse = new Fuse(containers, fuseOptions) let res = fuse.search(partialName) - if (res.length >= 1) return res[0] as string + if (res.length >= 1) return res[0] else { throw new Error( "[Container.fuzzyMatch] no container matched that string", diff --git a/src/lib/dom.ts b/src/lib/dom.ts index 62d8cc58..3ff27ab6 100644 --- a/src/lib/dom.ts +++ b/src/lib/dom.ts @@ -416,7 +416,7 @@ export function registerEvListenerAction( // Node prototype functions work on the C++ representation of the // Node, which a faked JS object won't have. // hasChildNodes() is chosen because it should be cheap. - Node.prototype.hasChildNodes.apply(elem as Node) + Node.prototype.hasChildNodes.apply(elem) } catch (e) { // Don't throw a real exception because addEventListener wouldn't and we // don't want to break content code. diff --git a/src/state.ts b/src/state.ts index 5000c6dd..a58a1b6a 100644 --- a/src/state.ts +++ b/src/state.ts @@ -32,7 +32,7 @@ class State { // Don't change these from const or you risk breaking the Proxy below. const defaults = Object.freeze(new State()) -const overlay = {} as any +const overlay = {} as State browser.storage.local .get("state") .then(res => { @@ -57,10 +57,10 @@ const state = (new Proxy(overlay, { set: function(target, property, value) { logger.debug("State changed!", property, value) target[property] = value - browser.storage.local.set({ state: target }) + browser.storage.local.set({ state: target } as any) return true }, -}) as any) as State +})) browser.storage.onChanged.addListener((changes, areaname) => { if (areaname === "local" && "state" in changes) { diff --git a/tslint.json b/tslint.json index 4646c704..0cb7c09b 100644 --- a/tslint.json +++ b/tslint.json @@ -28,7 +28,6 @@ "no-trailing-whitespace": false, "no-unnecessary-initializer": false, "no-unsafe-finally": false, - "no-useless-cast": false, "no-useless-catch": false, "no-useless-catch": false, "no-var-keyword": false,