Chore: Normalize the way we use eslint-disable
This commit is contained in:
parent
6283aa4a7d
commit
3f5cabc5c5
5 changed files with 12 additions and 19 deletions
10
docs/lint.js
10
docs/lint.js
|
|
@ -101,12 +101,14 @@ function ensureLinkIsValid(file, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initMocks() {
|
function initMocks() {
|
||||||
global.window = require("../test-utils/browserMock")() // eslint-disable-line global-require
|
/* eslint-disable global-require */
|
||||||
|
global.window = require("../test-utils/browserMock")()
|
||||||
global.document = window.document
|
global.document = window.document
|
||||||
global.m = require("../index") // eslint-disable-line global-require
|
global.m = require("../index")
|
||||||
global.o = require("../ospec/ospec") // eslint-disable-line global-require
|
global.o = require("../ospec/ospec")
|
||||||
global.stream = require("../stream") // eslint-disable-line global-require
|
global.stream = require("../stream")
|
||||||
global.alert = function() {}
|
global.alert = function() {}
|
||||||
|
/* eslint-enable global-require */
|
||||||
|
|
||||||
//routes consumed by request.md
|
//routes consumed by request.md
|
||||||
global.window.$defineRoutes({
|
global.window.$defineRoutes({
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable global-require, no-bitwise, no-process-exit */
|
|
||||||
"use strict"
|
"use strict"
|
||||||
;(function(m) {
|
;(function(m) {
|
||||||
if (typeof module !== "undefined") module["exports"] = m()
|
if (typeof module !== "undefined") module["exports"] = m()
|
||||||
|
|
@ -92,7 +91,7 @@ else window.o = m()
|
||||||
if (typeof reporter === "function") reporter(results)
|
if (typeof reporter === "function") reporter(results)
|
||||||
else {
|
else {
|
||||||
var errCount = o.report(results)
|
var errCount = o.report(results)
|
||||||
if (hasProcess && errCount !== 0) process.exit(1)
|
if (hasProcess && errCount !== 0) process.exit(1) // eslint-disable-line no-process-exit
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, null), 200 /*default timeout delay*/)
|
}, null), 200 /*default timeout delay*/)
|
||||||
|
|
@ -225,7 +224,7 @@ else window.o = m()
|
||||||
}
|
}
|
||||||
function deepEqual(a, b) {
|
function deepEqual(a, b) {
|
||||||
if (a === b) return true
|
if (a === b) return true
|
||||||
if (a === null ^ b === null || a === undefined ^ b === undefined) return false
|
if (a === null ^ b === null || a === undefined ^ b === undefined) return false // eslint-disable-line no-bitwise
|
||||||
if (typeof a === "object" && typeof b === "object") {
|
if (typeof a === "object" && typeof b === "object") {
|
||||||
var aIsArgs = isArguments(a), bIsArgs = isArguments(b)
|
var aIsArgs = isArguments(a), bIsArgs = isArguments(b)
|
||||||
if (a.constructor === Object && b.constructor === Object && !aIsArgs && !bIsArgs) {
|
if (a.constructor === Object && b.constructor === Object && !aIsArgs && !bIsArgs) {
|
||||||
|
|
@ -287,7 +286,7 @@ else window.o = m()
|
||||||
results[assertion.i].error = error != null ? error : ensureStackTrace(new Error)
|
results[assertion.i].error = error != null ? error : ensureStackTrace(new Error)
|
||||||
}
|
}
|
||||||
function serialize(value) {
|
function serialize(value) {
|
||||||
if (hasProcess) return require("util").inspect(value)
|
if (hasProcess) return require("util").inspect(value) // eslint-disable-line global-require
|
||||||
if (value === null || (typeof value === "object" && !(value instanceof Array)) || typeof value === "number") return String(value)
|
if (value === null || (typeof value === "object" && !(value instanceof Array)) || typeof value === "number") return String(value)
|
||||||
else if (typeof value === "function") return value.name || "<anonymous function>"
|
else if (typeof value === "function") return value.name || "<anonymous function>"
|
||||||
try {return JSON.stringify(value)} catch (e) {return String(value)}
|
try {return JSON.stringify(value)} catch (e) {return String(value)}
|
||||||
|
|
|
||||||
|
|
@ -556,9 +556,7 @@ module.exports = function($window) {
|
||||||
u = 0
|
u = 0
|
||||||
v = result.length - 1
|
v = result.length - 1
|
||||||
while (u < v) {
|
while (u < v) {
|
||||||
/*eslint-disable no-bitwise*/
|
var c = ((u + v) / 2) | 0 // eslint-disable-line no-bitwise
|
||||||
var c = ((u + v) / 2) | 0
|
|
||||||
/*eslint-enable no-bitwise*/
|
|
||||||
if (a[result[c]] < a[i]) {
|
if (a[result[c]] < a[i]) {
|
||||||
u = c + 1
|
u = c + 1
|
||||||
}
|
}
|
||||||
|
|
@ -734,9 +732,7 @@ module.exports = function($window) {
|
||||||
if(attrs.value === null) {
|
if(attrs.value === null) {
|
||||||
if (vnode.dom.selectedIndex !== -1) vnode.dom.value = null
|
if (vnode.dom.selectedIndex !== -1) vnode.dom.value = null
|
||||||
} else {
|
} else {
|
||||||
/*eslint-disable no-implicit-coercion*/
|
var normalized = "" + attrs.value // eslint-disable-line no-implicit-coercion
|
||||||
var normalized = "" + attrs.value
|
|
||||||
/*eslint-enable no-implicit-coercion*/
|
|
||||||
if (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {
|
if (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {
|
||||||
vnode.dom.value = normalized
|
vnode.dom.value = normalized
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,9 +377,7 @@ o.spec("attributes", function() {
|
||||||
o("href" in vnode.dom.firstChild.attributes).equals(false)
|
o("href" in vnode.dom.firstChild.attributes).equals(false)
|
||||||
})
|
})
|
||||||
/* eslint-enable no-script-url */
|
/* eslint-enable no-script-url */
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
o.spec("option.value", function() {
|
o.spec("option.value", function() {
|
||||||
o("can be set as text", function() {
|
o("can be set as text", function() {
|
||||||
var a = {tag: "option", attrs: {value: "test"}}
|
var a = {tag: "option", attrs: {value: "test"}}
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,7 @@ function longestIncreasingSubsequence(a) {
|
||||||
v = result.length - 1
|
v = result.length - 1
|
||||||
|
|
||||||
while (u < v) {
|
while (u < v) {
|
||||||
/*eslint-disable no-bitwise*/
|
var c = ((u + v) / 2) | 0 // eslint-disable-line no-bitwise
|
||||||
var c = ((u + v) / 2) | 0
|
|
||||||
/*eslint-enable no-bitwise*/
|
|
||||||
if (a[result[c]] < a[i]) {
|
if (a[result[c]] < a[i]) {
|
||||||
u = c + 1
|
u = c + 1
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue