From 3f5cabc5c5234a81c7f455fbe5afd7cde2a957b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Yves=20G=C3=A9rardy?= Date: Fri, 1 Jun 2018 21:24:02 +0200 Subject: [PATCH] Chore: Normalize the way we use eslint-disable --- docs/lint.js | 10 ++++++---- ospec/ospec.js | 7 +++---- render/render.js | 8 ++------ render/tests/test-attributes.js | 2 -- render/tests/test-updateNodesFuzzer.js | 4 +--- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/docs/lint.js b/docs/lint.js index 2fb39e3b..9fcb93b4 100644 --- a/docs/lint.js +++ b/docs/lint.js @@ -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({ diff --git a/ospec/ospec.js b/ospec/ospec.js index 2706f6ac..fcbc9915 100644 --- a/ospec/ospec.js +++ b/ospec/ospec.js @@ -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 || "" try {return JSON.stringify(value)} catch (e) {return String(value)} diff --git a/render/render.js b/render/render.js index bf8080f3..c8181ad1 100644 --- a/render/render.js +++ b/render/render.js @@ -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 } diff --git a/render/tests/test-attributes.js b/render/tests/test-attributes.js index ed41961e..00b91f1d 100644 --- a/render/tests/test-attributes.js +++ b/render/tests/test-attributes.js @@ -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"}} diff --git a/render/tests/test-updateNodesFuzzer.js b/render/tests/test-updateNodesFuzzer.js index db5cafa7..8580c139 100644 --- a/render/tests/test-updateNodesFuzzer.js +++ b/render/tests/test-updateNodesFuzzer.js @@ -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 {