TSLint: re-enable no-collapsible-if rule

This rule detects unnecessary nesting of if/else statements and tells
you to remove them.
This commit is contained in:
glacambre 2019-04-03 07:03:03 +02:00
parent cb7c5f2932
commit 15b627c340
No known key found for this signature in database
GPG key ID: B9625DB1767553AC
3 changed files with 11 additions and 14 deletions

View file

@ -74,11 +74,9 @@ export class HistoryCompletionSource extends Completions.CompletionSourceFuse {
options = args.slice(0, 1).join(" ")
query = args.slice(1).join(" ")
}
} else if (prefix == "winopen ") {
if (query.startsWith("-private")) {
options = "-private"
query = query.substring(options.length)
}
} else if (prefix == "winopen " && query.startsWith("-private")) {
options = "-private"
query = query.substring(options.length)
}
options += options ? " " : ""

View file

@ -607,7 +607,9 @@ export async function nativeinstall() {
//#background
export async function source(...fileArr: string[]) {
const file = fileArr.join(" ") || undefined
if (await Native.nativegate("0.1.3")) if (!(await rc.source(file))) logger.error("Could not find RC file")
if (await Native.nativegate("0.1.3") && !(await rc.source(file))) {
logger.error("Could not find RC file")
}
}
/**
@ -1263,11 +1265,9 @@ export async function help(...helpItems: string[]) {
let flag = ""
if (helpItems.length > 0) {
if (Object.keys(flags).includes(helpItems[0])) {
flag = helpItems[0]
helpItems.splice(0, 1)
}
if (helpItems.length > 0 && Object.keys(flags).includes(helpItems[0])) {
flag = helpItems[0]
helpItems.splice(0, 1)
}
const subject = helpItems.join(" ")
@ -1591,8 +1591,8 @@ export function geturlsforlinks(reltype = "rel", rel: string) {
//#background
export async function zoom(level = 0, rel = "false") {
level = level > 3 ? level / 100 : level
if (rel === "false") {
if (level > 3 || level < 0.3) throw new Error(`[zoom] level out of range: ${level}`)
if (rel === "false" && (level > 3 || level < 0.3)) {
throw new Error(`[zoom] level out of range: ${level}`)
}
if (rel === "true") {
level += await browser.tabs.getZoom()

View file

@ -15,7 +15,6 @@
"member-access": false,
"no-array-delete": false,
"no-big-function": false,
"no-collapsible-if": false,
"no-commented-code": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,