mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Re-enable arrow-body-style
This commit is contained in:
parent
db8f0e21ad
commit
a6ca46d147
11 changed files with 37 additions and 89 deletions
|
@ -155,7 +155,7 @@ module.exports = {
|
|||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "off", //"error",
|
||||
"@typescript-eslint/unified-signatures": "off", //"error",
|
||||
"arrow-body-style": "off", //"error",
|
||||
"arrow-body-style": "error",
|
||||
"arrow-parens": [
|
||||
"off",
|
||||
"always"
|
||||
|
|
|
@ -239,9 +239,7 @@ export abstract class CompletionSourceFuse extends CompletionSource {
|
|||
|
||||
/** Rtn sorted array of {option, score} */
|
||||
scoredOptions(query: string, options = this.options): ScoredOption[] {
|
||||
const searchThis = this.options.map((elem, index) => {
|
||||
return { index, fuseKeys: elem.fuseKeys }
|
||||
})
|
||||
const searchThis = this.options.map((elem, index) => ({ index, fuseKeys: elem.fuseKeys }))
|
||||
this.fuse = new Fuse(searchThis, this.fuseOptions)
|
||||
return this.fuse.search(query).map(result => {
|
||||
// console.log(result, result.item, query)
|
||||
|
|
|
@ -64,14 +64,12 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
|
|||
this.options = Object.keys(patterns)
|
||||
.filter(pattern => pattern.startsWith(urlPattern))
|
||||
.sort()
|
||||
.map(pattern => {
|
||||
return new BindingsCompletionOption(
|
||||
.map(pattern => new BindingsCompletionOption(
|
||||
pattern, {
|
||||
name: pattern,
|
||||
value: "",
|
||||
mode: "URL Pattern",
|
||||
})
|
||||
})
|
||||
}))
|
||||
|
||||
return this.updateChain()
|
||||
}
|
||||
|
@ -84,14 +82,12 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
|
|||
const modeStr = margs.length > 1 ? margs[1] : ""
|
||||
this.options = Binding.modes
|
||||
.filter(k => k.startsWith(modeStr))
|
||||
.map(name => {
|
||||
return new BindingsCompletionOption(
|
||||
.map(name => new BindingsCompletionOption(
|
||||
options + "--mode=" + name, {
|
||||
name,
|
||||
value: "",
|
||||
mode: "Mode Name",
|
||||
})
|
||||
})
|
||||
}))
|
||||
return this.updateChain()
|
||||
}
|
||||
}
|
||||
|
@ -124,14 +120,12 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
|
|||
this.options = Object.keys(bindings)
|
||||
.filter(x => x.toLowerCase().startsWith(query) )
|
||||
.sort()
|
||||
.map(keystr => {
|
||||
return new BindingsCompletionOption(
|
||||
.map(keystr => new BindingsCompletionOption(
|
||||
options + keystr + " " + bindings[keystr], {
|
||||
name: keystr,
|
||||
value: JSON.stringify(bindings[keystr]),
|
||||
mode: `${configName} (${modeName})`,
|
||||
})
|
||||
})
|
||||
}))
|
||||
|
||||
return this.updateChain()
|
||||
}
|
||||
|
|
|
@ -428,25 +428,19 @@ export function hintPage(
|
|||
|
||||
const firstTarget = modeState.hints[0].target
|
||||
|
||||
const firstTargetIsSelectable = (): boolean => {
|
||||
return (
|
||||
const firstTargetIsSelectable = (): boolean => (
|
||||
firstTarget instanceof HTMLAnchorElement &&
|
||||
firstTarget.href !== "" &&
|
||||
!firstTarget.href.startsWith("javascript:")
|
||||
)
|
||||
}
|
||||
|
||||
const allTargetsAreEqual = (): boolean => {
|
||||
return (
|
||||
const allTargetsAreEqual = (): boolean => (
|
||||
undefined ===
|
||||
modeState.hints.find(h => {
|
||||
return (
|
||||
modeState.hints.find(h => (
|
||||
!(h.target instanceof HTMLAnchorElement) ||
|
||||
h.target.href !== (firstTarget as HTMLAnchorElement).href
|
||||
)
|
||||
})
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
modeState.hints.length == 1 ||
|
||||
|
@ -551,9 +545,7 @@ function* hintnames_uniform(
|
|||
// And return first n permutations
|
||||
yield* map(
|
||||
islice(permutationsWithReplacement(hintchars, taglen), n),
|
||||
perm => {
|
||||
return perm.join("")
|
||||
},
|
||||
perm => perm.join(""),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2620,13 +2620,9 @@ export async function qall() {
|
|||
//#background
|
||||
export async function containerclose(name: string) {
|
||||
const containerId = await Container.getId(name)
|
||||
return browser.tabs.query({ cookieStoreId: containerId }).then(tabs => {
|
||||
return browser.tabs.remove(
|
||||
tabs.map(tab => {
|
||||
return tab.id
|
||||
}),
|
||||
)
|
||||
})
|
||||
return browser.tabs.query({ cookieStoreId: containerId }).then(tabs => browser.tabs.remove(
|
||||
tabs.map(tab => tab.id),
|
||||
))
|
||||
}
|
||||
/** Creates a new container. Note that container names must be unique and that the checks are case-insensitive.
|
||||
|
||||
|
@ -2761,12 +2757,8 @@ async function getnexttabs(tabid: number, n?: number) {
|
|||
const tabs: browser.tabs.Tab[] = await browser.tabs.query({
|
||||
currentWindow: true,
|
||||
})
|
||||
const indexFilter = ((tab: browser.tabs.Tab) => {
|
||||
return curIndex <= tab.index && (n ? tab.index < curIndex + Number(n) : true)
|
||||
}).bind(n)
|
||||
return tabs.filter(indexFilter).map((tab: browser.tabs.Tab) => {
|
||||
return tab.id
|
||||
})
|
||||
const indexFilter = ((tab: browser.tabs.Tab) => curIndex <= tab.index && (n ? tab.index < curIndex + Number(n) : true)).bind(n)
|
||||
return tabs.filter(indexFilter).map((tab: browser.tabs.Tab) => tab.id)
|
||||
}
|
||||
|
||||
// Moderately slow; should load in results as they arrive, perhaps
|
||||
|
|
|
@ -180,9 +180,7 @@ export class AutoContain implements IAutoContain {
|
|||
}, 2000)
|
||||
}
|
||||
|
||||
getCancelledRequest = (tabId: number): ICancelledRequest => {
|
||||
return this.cancelledRequests[tabId]
|
||||
}
|
||||
getCancelledRequest = (tabId: number): ICancelledRequest => this.cancelledRequests[tabId]
|
||||
|
||||
// Clear the cancelled requests.
|
||||
clearCancelledRequests = (tabId: number): void => {
|
||||
|
@ -311,7 +309,5 @@ export class AutoContain implements IAutoContain {
|
|||
// Parses autocontain directives and returns valid cookieStoreIds or errors.
|
||||
getAuconForDetails = async (
|
||||
details: browser.webRequest.IDetails,
|
||||
): Promise<string> => {
|
||||
return this.getAuconForUrl(details.url)
|
||||
}
|
||||
): Promise<string> => this.getAuconForUrl(details.url)
|
||||
}
|
||||
|
|
|
@ -93,16 +93,12 @@ export function getCommandlineFns(cmdline_state) {
|
|||
/**
|
||||
* Selects the next history line.
|
||||
*/
|
||||
"next_history": () => {
|
||||
return cmdline_state.history(1)
|
||||
},
|
||||
"next_history": () => cmdline_state.history(1),
|
||||
|
||||
/**
|
||||
* Selects the prev history line.
|
||||
*/
|
||||
"prev_history": () => {
|
||||
return cmdline_state.history(-1)
|
||||
},
|
||||
"prev_history": () => cmdline_state.history(-1),
|
||||
/**
|
||||
* Execute the content of the command line and hide it.
|
||||
**/
|
||||
|
|
|
@ -122,9 +122,7 @@ export async function exists(cname: string): Promise<boolean> {
|
|||
let exists = false
|
||||
try {
|
||||
const containers = await getAll()
|
||||
const res = containers.filter(c => {
|
||||
return c.name.toLowerCase() === cname.toLowerCase()
|
||||
})
|
||||
const res = containers.filter(c => c.name.toLowerCase() === cname.toLowerCase())
|
||||
if (res.length > 0) {
|
||||
exists = true
|
||||
}
|
||||
|
|
|
@ -122,9 +122,7 @@ export function mouseEvent(
|
|||
export function elementsWithText() {
|
||||
return getElemsBySelector("*", [
|
||||
isVisible,
|
||||
hint => {
|
||||
return hint.textContent !== ""
|
||||
},
|
||||
hint => hint.textContent !== "",
|
||||
])
|
||||
}
|
||||
|
||||
|
|
|
@ -164,36 +164,30 @@ export const transpose_words = wrap_input(
|
|||
* Behaves like readline's [upcase_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the word the caret is in uppercase.
|
||||
**/
|
||||
export const upcase_word = wrap_input(
|
||||
needs_text((text, selectionStart, selectionEnd) => {
|
||||
return applyWord(text, selectionStart, selectionEnd, word =>
|
||||
needs_text((text, selectionStart, selectionEnd) => applyWord(text, selectionStart, selectionEnd, word =>
|
||||
word.toUpperCase(),
|
||||
)
|
||||
}),
|
||||
)),
|
||||
)
|
||||
|
||||
/**
|
||||
* Behaves like readline's [downcase_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the word the caret is in lowercase.
|
||||
**/
|
||||
export const downcase_word = wrap_input(
|
||||
needs_text((text, selectionStart, selectionEnd) => {
|
||||
return applyWord(text, selectionStart, selectionEnd, word =>
|
||||
needs_text((text, selectionStart, selectionEnd) => applyWord(text, selectionStart, selectionEnd, word =>
|
||||
word.toLowerCase(),
|
||||
)
|
||||
}),
|
||||
)),
|
||||
)
|
||||
|
||||
/**
|
||||
* Behaves like readline's [capitalize_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the initial character of the word the caret is in uppercase.
|
||||
**/
|
||||
export const capitalize_word = wrap_input(
|
||||
needs_text((text, selectionStart, selectionEnd) => {
|
||||
return applyWord(
|
||||
needs_text((text, selectionStart, selectionEnd) => applyWord(
|
||||
text,
|
||||
selectionStart,
|
||||
selectionEnd,
|
||||
word => word[0].toUpperCase() + word.substring(1),
|
||||
)
|
||||
}),
|
||||
)),
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -339,17 +333,13 @@ export const end_of_line = wrap_input(
|
|||
/**
|
||||
* Behaves like readline's [forward_char](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC12). Moves the caret one character to the right.
|
||||
**/
|
||||
export const forward_char = wrap_input((text, selectionStart, selectionEnd) => {
|
||||
return [null, selectionStart + 1, null]
|
||||
})
|
||||
export const forward_char = wrap_input((text, selectionStart, selectionEnd) => [null, selectionStart + 1, null])
|
||||
|
||||
/**
|
||||
* Behaves like readline's [backward_char](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC12). Moves the caret one character to the left.
|
||||
**/
|
||||
export const backward_char = wrap_input(
|
||||
(text, selectionStart, selectionEnd) => {
|
||||
return [null, selectionStart - 1, null]
|
||||
},
|
||||
(text, selectionStart, selectionEnd) => [null, selectionStart - 1, null],
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -383,21 +373,17 @@ export const backward_word = wrap_input(
|
|||
* Insert text in the current input.
|
||||
**/
|
||||
export const insert_text = wrap_input(
|
||||
(text, selectionStart, selectionEnd, arg) => {
|
||||
return [
|
||||
(text, selectionStart, selectionEnd, arg) => [
|
||||
text.slice(0, selectionStart) + arg + text.slice(selectionEnd),
|
||||
selectionStart + arg.length,
|
||||
null,
|
||||
]
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
export const rot13 = wrap_input(
|
||||
(text, selectionStart, selectionEnd) => {
|
||||
return [
|
||||
(text, selectionStart, selectionEnd) => [
|
||||
rot13_helper(text.slice(0, selectionStart) + text.slice(selectionEnd)),
|
||||
selectionStart,
|
||||
null,
|
||||
]
|
||||
},
|
||||
],
|
||||
)
|
||||
|
|
|
@ -254,9 +254,7 @@ export function deleteQuery(url: URL, matchQuery: string): URL {
|
|||
|
||||
const qys = getUrlQueries(url)
|
||||
|
||||
const new_qys = qys.filter(q => {
|
||||
return q.split("=")[0] !== matchQuery
|
||||
})
|
||||
const new_qys = qys.filter(q => q.split("=")[0] !== matchQuery)
|
||||
|
||||
setUrlQueries(newUrl, new_qys)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue