mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
TSLint: re-enable no-dead-store rule
No point in storing things that we're not going to use.
This commit is contained in:
parent
7240444d9a
commit
270a1dbf9c
16 changed files with 15 additions and 29 deletions
|
@ -214,7 +214,7 @@ export abstract class CompletionSourceFuse extends CompletionSource {
|
|||
|
||||
select(option: CompletionOption) {
|
||||
if (this.lastExstr !== undefined && option !== undefined) {
|
||||
const [prefix, _] = this.splitOnPrefix(this.lastExstr)
|
||||
const [prefix] = this.splitOnPrefix(this.lastExstr)
|
||||
this.completion = prefix + option.value
|
||||
option.state = "focused"
|
||||
this.lastFocused = option
|
||||
|
|
|
@ -17,13 +17,8 @@ class BmarkCompletionOption extends Completions.CompletionOptionHTML
|
|||
// Push properties we want to fuzmatch on
|
||||
this.fuseKeys.push(bmark.title, bmark.url)
|
||||
|
||||
// Create HTMLElement
|
||||
// need to download favicon
|
||||
const favIconUrl = Completions.DEFAULT_FAVICON
|
||||
// const favIconUrl = tab.favIconUrl ? tab.favIconUrl : DEFAULT_FAVICON
|
||||
this.html = html`<tr class="BmarkCompletionOption option">
|
||||
<td class="prefix">${"".padEnd(2)}</td>
|
||||
<td class="icon"></td>
|
||||
<td class="title">${bmark.title}</td>
|
||||
<td class="content">
|
||||
<a class="url" target="_blank" href=${bmark.url}
|
||||
|
|
|
@ -13,7 +13,6 @@ class FindCompletionOption extends Completions.CompletionOptionHTML
|
|||
(reverse ? "-? " : "") + ("-: " + m.index) + " " + m.rangeData.text
|
||||
this.fuseKeys.push(m.rangeData.text)
|
||||
|
||||
let contextLength = 4
|
||||
// Create HTMLElement
|
||||
this.html = html`<tr class="FindCompletionOption option">
|
||||
<td class="content">${m.precontext}<span class="match">${
|
||||
|
|
|
@ -16,12 +16,8 @@ class HistoryCompletionOption extends Completions.CompletionOptionHTML
|
|||
this.fuseKeys.push(page.title, page.url) // weight by page.visitCount
|
||||
|
||||
// Create HTMLElement
|
||||
// need to download favicon
|
||||
const favIconUrl = Completions.DEFAULT_FAVICON
|
||||
// const favIconUrl = tab.favIconUrl ? tab.favIconUrl : DEFAULT_FAVICON
|
||||
this.html = html`<tr class="HistoryCompletionOption option">
|
||||
<td class="prefix">${"".padEnd(2)}</td>
|
||||
<td class="icon"></td>
|
||||
<td class="title">${page.title}</td>
|
||||
<td class="content">
|
||||
<a class="url" target="_blank" href=${page.url}
|
||||
|
|
|
@ -33,7 +33,7 @@ export class PreferenceCompletionSource extends Completions.CompletionSourceFuse
|
|||
this.state = "hidden"
|
||||
return
|
||||
}
|
||||
let [cmd, pref] = this.splitOnPrefix(exstr)
|
||||
let pref = this.splitOnPrefix(exstr)[1]
|
||||
if (pref === undefined) {
|
||||
this.state = "hidden"
|
||||
return
|
||||
|
|
|
@ -38,7 +38,7 @@ export class RssCompletionSource extends Completions.CompletionSourceFuse {
|
|||
|
||||
private async updateOptions(exstr = "") {
|
||||
this.lastExstr = exstr
|
||||
let [prefix, query] = this.splitOnPrefix(exstr)
|
||||
let [prefix] = this.splitOnPrefix(exstr)
|
||||
|
||||
// Hide self and stop if prefixes don't match
|
||||
if (prefix) {
|
||||
|
|
|
@ -79,7 +79,7 @@ export class SessionsCompletionSource extends Completions.CompletionSourceFuse {
|
|||
|
||||
private async updateOptions(exstr = "") {
|
||||
this.lastExstr = exstr
|
||||
let [prefix, query] = this.splitOnPrefix(exstr)
|
||||
let [prefix] = this.splitOnPrefix(exstr)
|
||||
|
||||
// Hide self and stop if prefixes don't match
|
||||
if (prefix) {
|
||||
|
|
|
@ -73,7 +73,7 @@ export class SettingsCompletionSource extends Completions.CompletionSourceFuse {
|
|||
.filter(x => x.startsWith(query))
|
||||
.sort()
|
||||
.map(setting => {
|
||||
let md = undefined
|
||||
let md
|
||||
let doc = ""
|
||||
let type = ""
|
||||
if ((md = default_config.getMember(setting))) {
|
||||
|
|
|
@ -71,7 +71,7 @@ export class TabAllCompletionSource extends Completions.CompletionSourceFuse {
|
|||
@Perf.measuredAsync
|
||||
private async updateOptions(exstr = "") {
|
||||
this.lastExstr = exstr
|
||||
let [prefix, query] = this.splitOnPrefix(exstr)
|
||||
let [prefix] = this.splitOnPrefix(exstr)
|
||||
|
||||
// Hide self and stop if prefixes don't match
|
||||
if (prefix) {
|
||||
|
|
|
@ -48,7 +48,7 @@ export class WindowCompletionSource extends Completions.CompletionSourceFuse {
|
|||
|
||||
private async updateOptions(exstr = "") {
|
||||
this.lastExstr = exstr
|
||||
let [prefix, query] = this.splitOnPrefix(exstr)
|
||||
let [prefix] = this.splitOnPrefix(exstr)
|
||||
|
||||
// Hide self and stop if prefixes don't match
|
||||
if (prefix) {
|
||||
|
|
|
@ -1081,7 +1081,6 @@ export async function bmarks(opt: string, ...urlarr: string[]) {
|
|||
//#content
|
||||
export async function open_quiet(...urlarr: string[]) {
|
||||
let url = urlarr.join(" ")
|
||||
let p = Promise.resolve()
|
||||
|
||||
if (!ABOUT_WHITELIST.includes(url) && url.match(/^(about|file):.*/)) {
|
||||
return Messaging.message("controller_background", "acceptExCmd", ["nativeopen " + url])
|
||||
|
@ -3031,7 +3030,6 @@ export function searchsetkeyword() {
|
|||
*/
|
||||
function validateSetArgs(key: string, values: string[]) {
|
||||
const target: any[] = key.split(".")
|
||||
const last = target[target.length - 1]
|
||||
|
||||
let value, file, default_config, md
|
||||
if ((file = Metadata.everything.getFile("src/lib/config.ts")) && (default_config = file.getClass("default_config")) && (md = default_config.getMember(target[0]))) {
|
||||
|
@ -3260,7 +3258,6 @@ export async function reset(mode: string, key: string) {
|
|||
*/
|
||||
//#background
|
||||
export async function reseturl(pattern: string, mode: string, key: string) {
|
||||
let args = parse_bind_args(mode, key)
|
||||
let args_obj = parse_bind_args(mode, key)
|
||||
return config.unsetURL(pattern, args_obj.configName, args_obj.key)
|
||||
}
|
||||
|
@ -3538,7 +3535,7 @@ import * as hinting from "@src/content/hinting"
|
|||
links in the main body changes).
|
||||
*/
|
||||
//#content
|
||||
export async function hint(option?: string, selectors?: string, ...rest: string[]) {
|
||||
export async function hint(option?: string, selectors?: string, ...rest: string[]): Promise<any> {
|
||||
if (!option) option = ""
|
||||
|
||||
if (option == "-br") option = "-qb"
|
||||
|
@ -3560,7 +3557,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[
|
|||
option = "-pipe"
|
||||
}
|
||||
|
||||
let selectHints = new Promise(r => r())
|
||||
let selectHints
|
||||
let hintTabOpen = async (href, active = !rapid) => {
|
||||
let containerId = await activeTabContainerId()
|
||||
if (containerId) {
|
||||
|
@ -4067,6 +4064,7 @@ export async function echo(...str: string[]) {
|
|||
//#content
|
||||
export async function js(...str: string[]) {
|
||||
if (str[0].startsWith("-p")) {
|
||||
/* tslint:disable:no-dead-store */
|
||||
let JS_ARG = str[str.length - 1]
|
||||
return eval(str.slice(1, -1).join(" "))
|
||||
} else {
|
||||
|
@ -4080,6 +4078,7 @@ export async function js(...str: string[]) {
|
|||
//#background
|
||||
export async function jsb(...str: string[]) {
|
||||
if (str[0].startsWith("-p")) {
|
||||
/* tslint:disable:no-dead-store */
|
||||
let JS_ARG = str[str.length - 1]
|
||||
return eval(str.slice(1, -1).join(" "))
|
||||
} else {
|
||||
|
|
|
@ -12,7 +12,7 @@ export function expandExstr(
|
|||
prevExpansions: string[] = [],
|
||||
): string {
|
||||
// Split on whitespace
|
||||
const [command, ...args] = exstr.trim().split(/\s+/)
|
||||
const [command] = exstr.trim().split(/\s+/)
|
||||
|
||||
// Base case: alias not found; return original command
|
||||
if (aliases[command] === undefined) {
|
||||
|
|
|
@ -375,7 +375,7 @@ export async function clipboard(
|
|||
// Use delimiter to insert str into clipcmd's stdin
|
||||
// We use sed to remove the newline added by the here document
|
||||
clipcmd = `sed -z 's/.$//' <<'${heredoc}' | ${clipcmd} -i \n${str}\n${heredoc}`
|
||||
let result = await run(clipcmd)
|
||||
await run(clipcmd)
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ export function replaceQueryValue(
|
|||
let qys = getUrlQueries(url)
|
||||
|
||||
let new_qys = qys.map(q => {
|
||||
let [key, oldVal] = q.split("=")
|
||||
let [key] = q.split("=")
|
||||
|
||||
// found a matching query key
|
||||
if (q.split("=")[0] === matchQuery) {
|
||||
|
|
|
@ -393,7 +393,7 @@ const extractRegExp = new RegExp(
|
|||
function extractMetricName(counterName: string): MetricNameInfo {
|
||||
const matchresult = counterName.match(extractRegExp)
|
||||
if (!matchresult) return
|
||||
const [_, ownerName, functionName, uniqueSuffix, startOrEnd] = matchresult
|
||||
const [ownerName, functionName, uniqueSuffix] = matchresult.slice(1)
|
||||
|
||||
return {
|
||||
ownerName,
|
||||
|
@ -408,7 +408,6 @@ class MetricName {
|
|||
public readonly endName: string
|
||||
|
||||
constructor(ownerName: string, functionName: string) {
|
||||
const counterName = ownerName
|
||||
const uniqueSuffix = Math.floor(
|
||||
Math.random() * Math.floor(1e6),
|
||||
).toString()
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
"no-commented-code": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-console": false,
|
||||
"no-construct": false,
|
||||
"no-dead-store": false,
|
||||
"no-duplicate-string": false,
|
||||
"no-empty": false,
|
||||
"no-eval": false,
|
||||
|
|
Loading…
Add table
Reference in a new issue