TSLint: re-enable no-string-literal rule

This commit is contained in:
glacambre 2019-04-03 19:09:49 +02:00
parent 600a324941
commit fd09bd6c1d
No known key found for this signature in database
GPG key ID: B9625DB1767553AC
10 changed files with 21 additions and 22 deletions

View file

@ -100,8 +100,7 @@ export class HistoryCompletionSource extends Completions.CompletionSourceFuse {
}
private async scoreOptions(query: string, n: number) {
const newtab = browser.runtime.getManifest()["chrome_url_overrides"]
.newtab
const newtab = (browser.runtime.getManifest()).chrome_url_overrides.newtab
const newtaburl = browser.extension.getURL(newtab)
if (!query || config.get("historyresults") == 0) {
return (await browserBg.topSites.get())

View file

@ -56,7 +56,7 @@ export const contentState = (new Proxy(
logger.debug("Content state changed!", property, newValue)
const oldValue = target[property]
const mode = target["mode"]
const mode = target.mode
target[property] = newValue
for (let listener of onChangedListeners) {

View file

@ -662,11 +662,11 @@ export async function restart() {
if ((await browser.runtime.getPlatformInfo()).os === "win") {
let reply = await Native.winFirefoxRestart(profiledir, browsercmd)
logger.info("[+] win_firefox_restart 'reply' = " + JSON.stringify(reply))
if (Number(reply["code"]) === 0) {
fillcmdline("#" + reply["content"])
if (Number(reply.code) === 0) {
fillcmdline("#" + reply.content)
qall()
} else {
fillcmdline("#" + reply["error"])
fillcmdline("#" + reply.error)
}
} else {
const firefox = (await Native.ff_cmdline()).join(" ")
@ -1898,7 +1898,7 @@ export async function tabopen(...addressarr: string[]) {
} else if (args[0] === "-c") {
// Ignore the -c flag if incognito as containers are disabled.
let win = await browser.windows.getCurrent()
if (!win["incognito"]) container = await Container.fuzzyMatch(args[1])
if (!win.incognito) container = await Container.fuzzyMatch(args[1])
else logger.error("[tabopen] can't open a container in a private browsing window.")
args.shift()
@ -2279,19 +2279,19 @@ export async function mute(...muteArgs: string[]): Promise<void> {
*/
//#background
export async function winopen(...args: string[]) {
const createData = {}
const createData = {} as any
let firefoxArgs = "--new-window"
let done = false
while (!done) {
switch (args[0]) {
case "-private":
createData["incognito"] = true
createData.incognito = true
args = args.slice(1, args.length)
firefoxArgs = "--private-window"
break
case "-popup":
createData["type"] = "popup"
createData.type = "popup"
args = args.slice(1, args.length)
break
@ -3599,7 +3599,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[
DOM.HINTTAGS_selectors,
elem => {
// /!\ Warning: This is racy! This can easily be fixed by adding an await but do we want this? yank can be pretty slow, especially with yankto=selection
run_exstr("yank " + elem["href"])
run_exstr("yank " + elem.href)
return elem
},
rapid,
@ -3613,7 +3613,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[
DOM.elementsWithText(),
elem => {
// /!\ Warning: This is racy! This can easily be fixed by adding an await but do we want this? yank can be pretty slow, especially with yankto=selection
run_exstr("yank " + elem["textContent"])
run_exstr("yank " + elem.textContent)
return elem
},
rapid,

View file

@ -39,7 +39,7 @@ function getCommandElements() {
async function addSetting(settingName: string) {
let commandElems = getCommandElements()
// We're ignoring composite because it combines multiple excmds
delete commandElems["composite"]
delete (commandElems as any).composite
// Initialize or reset the <p> element that will contain settings in each commandElem
let settingElems = Object.keys(commandElems).reduce(

View file

@ -1087,9 +1087,9 @@ export async function update() {
// root namespace because we were young and bold.
let legacy_nmaps = await browser.storage.sync.get("nmaps")
if (Object.keys(legacy_nmaps).length > 0) {
USERCONFIG["nmaps"] = Object.assign(
legacy_nmaps["nmaps"],
USERCONFIG["nmaps"],
USERCONFIG.nmaps = Object.assign(
legacy_nmaps.nmaps,
USERCONFIG.nmaps,
)
}
} finally {

View file

@ -96,7 +96,7 @@ export async function update(
icon: browser.contextualIdentities.IdentityIcon
},
) {
if (isValidColor(updateObj["color"]) && isValidIcon(updateObj["icon"])) {
if (isValidColor(updateObj.color) && isValidIcon(updateObj.icon)) {
try {
browser.contextualIdentities.update(containerId, updateObj)
} catch (e) {
@ -193,7 +193,7 @@ export async function getId(name: string): Promise<string> {
if (res.length !== 1) {
throw new Error("")
} else {
return res[0]["cookieStoreId"]
return res[0].cookieStoreId
}
} catch (e) {
logger.error(

View file

@ -1,3 +1,4 @@
/* tslint:disable:no-string-literal */
import * as CSS from "css"
// Layout (of bits we care about:

View file

@ -33,7 +33,7 @@ class DefaultMap extends Map {
* it when they fix the bug.
*/
export function clobberCSP(response) {
const headers = response["responseHeaders"]
const headers = response.responseHeaders
const cspHeader = headers.find(
header => header.name.toLowerCase() === "content-security-policy",
)

View file

@ -12,7 +12,7 @@ function getChangelogDiv() {
function updateChangelogStatus() {
const changelogDiv = getChangelogDiv()
const changelogContent = changelogDiv.textContent
if (localStorage["changelogContent"] == changelogContent) {
if (localStorage.changelogContent == changelogContent) {
const changelogButton = document.querySelector('input[id^="spoiler"]')
if (!changelogButton) {
console.error("Couldn't find changelog button!")
@ -24,7 +24,7 @@ function updateChangelogStatus() {
function readChangelog() {
const changelogDiv = getChangelogDiv()
localStorage["changelogContent"] = changelogDiv.textContent
localStorage.changelogContent = changelogDiv.textContent
updateChangelogStatus()
}

View file

@ -24,7 +24,6 @@
"no-extra-semicolon": false,
"no-identical-functions": false,
"no-shadowed-variable": false,
"no-string-literal": false,
"no-string-throw": false,
"no-trailing-whitespace": false,
"no-try-promise": false,