From 40a39f089f389822e279bccf23441116c22d634f Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 10 Dec 2018 14:42:45 -0800 Subject: [PATCH] Apply eqeqeq lint rule --- .eslintrc.json | 3 ++- lib/device.js | 4 ++-- lib/extensions.js | 4 ++-- lib/instance-set.js | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index db75fc5..baba800 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,6 +15,7 @@ "curly": ["error", "multi-or-nest", "consistent"], "consistent-return": ["error", {"treatUndefinedAsUnspecified": true}], "no-buffer-constructor": "error", - "prefer-const": ["error", {"destructuring": "all"}] + "prefer-const": ["error", {"destructuring": "all"}], + "eqeqeq": ["error", "always", {"null": "ignore"}] } } diff --git a/lib/device.js b/lib/device.js index 267bc1a..1f7f562 100644 --- a/lib/device.js +++ b/lib/device.js @@ -157,7 +157,7 @@ function unpack(deviceData, path, revision) { ) { for (let m = 0; m < allMatches.length; ++m) { let k; - for (k = i; k >= 0; --k) if (allMatches[m][k] != up[k]) break; + for (k = i; k >= 0; --k) if (allMatches[m][k] !== up[k]) break; if (k < 0) { filtered.push(allMatches[m]); @@ -226,7 +226,7 @@ function clear(deviceData, path, timestamp, attributes, changeFlags = 0) { deviceData.timestamps.delete(p); deviceData.attributes.delete(p); changeFlags |= 1; - } else if (attributes && p.length == path.length) { + } else if (attributes && p.length === path.length) { const currentAttributes = deviceData.attributes.get(p); if (currentAttributes) { let newAttrs; diff --git a/lib/extensions.js b/lib/extensions.js index 2ebc1a4..39b1cf2 100644 --- a/lib/extensions.js +++ b/lib/extensions.js @@ -96,11 +96,11 @@ function killAll(callback) { for (const n in processes) { ++counter; kill(processes[n], () => { - if (--counter == 0 && callback) callback(); + if (--counter === 0 && callback) callback(); }); delete processes[n]; } - if (--counter == 0 && callback) callback(); + if (--counter === 0 && callback) callback(); } exports.run = run; diff --git a/lib/instance-set.js b/lib/instance-set.js index a17bd0d..f006b37 100644 --- a/lib/instance-set.js +++ b/lib/instance-set.js @@ -49,7 +49,7 @@ class InstanceSet { const keysA = Object.keys(a); const keysB = Object.keys(b); - if (keysA.length != keysB.length) return keysB.length - keysA.length; + if (keysA.length !== keysB.length) return keysB.length - keysA.length; keysA.sort(); keysB.sort(); @@ -86,7 +86,7 @@ class InstanceSet { const keysA = Object.keys(a); const keysB = Object.keys(b); - if (keysA.length != keysB.length) return keysA.length - keysB.length; + if (keysA.length !== keysB.length) return keysA.length - keysB.length; keysA.sort(); keysB.sort();