Chore: Normalize the way we use eslint-disable

This commit is contained in:
Pierre-Yves Gérardy 2018-06-01 21:24:02 +02:00 committed by Pierre-Yves Gérardy
parent 6283aa4a7d
commit 3f5cabc5c5
5 changed files with 12 additions and 19 deletions

View file

@ -101,12 +101,14 @@ function ensureLinkIsValid(file, data) {
}
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.m = require("../index") // eslint-disable-line global-require
global.o = require("../ospec/ospec") // eslint-disable-line global-require
global.stream = require("../stream") // eslint-disable-line global-require
global.m = require("../index")
global.o = require("../ospec/ospec")
global.stream = require("../stream")
global.alert = function() {}
/* eslint-enable global-require */
//routes consumed by request.md
global.window.$defineRoutes({

View file

@ -1,4 +1,3 @@
/* eslint-disable global-require, no-bitwise, no-process-exit */
"use strict"
;(function(m) {
if (typeof module !== "undefined") module["exports"] = m()
@ -92,7 +91,7 @@ else window.o = m()
if (typeof reporter === "function") reporter(results)
else {
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*/)
@ -225,7 +224,7 @@ else window.o = m()
}
function deepEqual(a, b) {
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") {
var aIsArgs = isArguments(a), bIsArgs = isArguments(b)
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)
}
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)
else if (typeof value === "function") return value.name || "<anonymous function>"
try {return JSON.stringify(value)} catch (e) {return String(value)}

View file

@ -556,9 +556,7 @@ module.exports = function($window) {
u = 0
v = result.length - 1
while (u < v) {
/*eslint-disable no-bitwise*/
var c = ((u + v) / 2) | 0
/*eslint-enable no-bitwise*/
var c = ((u + v) / 2) | 0 // eslint-disable-line no-bitwise
if (a[result[c]] < a[i]) {
u = c + 1
}
@ -734,9 +732,7 @@ module.exports = function($window) {
if(attrs.value === null) {
if (vnode.dom.selectedIndex !== -1) vnode.dom.value = null
} else {
/*eslint-disable no-implicit-coercion*/
var normalized = "" + attrs.value
/*eslint-enable no-implicit-coercion*/
var normalized = "" + attrs.value // eslint-disable-line no-implicit-coercion
if (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {
vnode.dom.value = normalized
}

View file

@ -377,9 +377,7 @@ o.spec("attributes", function() {
o("href" in vnode.dom.firstChild.attributes).equals(false)
})
/* eslint-enable no-script-url */
})
o.spec("option.value", function() {
o("can be set as text", function() {
var a = {tag: "option", attrs: {value: "test"}}

View file

@ -61,9 +61,7 @@ function longestIncreasingSubsequence(a) {
v = result.length - 1
while (u < v) {
/*eslint-disable no-bitwise*/
var c = ((u + v) / 2) | 0
/*eslint-enable no-bitwise*/
var c = ((u + v) / 2) | 0 // eslint-disable-line no-bitwise
if (a[result[c]] < a[i]) {
u = c + 1
} else {