mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
TSLint: re-enable no-useless-cast rule
This commit is contained in:
parent
b70832ef40
commit
1b7c4f2052
8 changed files with 11 additions and 13 deletions
|
@ -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",
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<HTMLAnchorElement>)
|
||||
|
||||
// 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<HTMLElement>
|
||||
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<HTMLLinkElement>
|
||||
let elems = document.querySelectorAll("link[" + reltype + "='" + rel + "']")
|
||||
if (elems) return Array.prototype.map.call(elems, x => x.href)
|
||||
return []
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ export async function fuzzyMatch(partialName: string): Promise<string> {
|
|||
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",
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue