diff --git a/.eslintrc.js b/.eslintrc.js index 7bb997d79fad1d..260f53c4672b61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -287,7 +287,7 @@ module.exports = { 'template-curly-spacing': 'error', 'unicode-bom': 'error', 'use-isnan': 'error', - 'valid-typeof': 'error', + 'valid-typeof': ['error', { requireStringLiterals: true }], // Custom rules from eslint-plugin-node-core 'node-core/no-unescaped-regexp-dot': 'error', diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index 5226bf518dac38..8cc9bc13fbb343 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -63,6 +63,7 @@ function validateDecoder(obj) { } function validateArgument(prop, expected, propName, expectedName) { + // eslint-disable-next-line valid-typeof if (typeof prop !== expected) throw new ERR_INVALID_ARG_TYPE(propName, expectedName, prop); } diff --git a/test/parallel/test-assert-calltracker-report.js b/test/parallel/test-assert-calltracker-report.js index 64b068760ca720..87ef0bff17fc0b 100644 --- a/test/parallel/test-assert-calltracker-report.js +++ b/test/parallel/test-assert-calltracker-report.js @@ -11,22 +11,16 @@ function foo() {} const callsfoo = tracker.calls(foo, 1); // Ensures that foo was added to the callChecks array. -if (tracker.report()[0].operator !== 'foo') { - process.exit(1); -} +assert.strictEqual(tracker.report()[0].operator, 'foo'); callsfoo(); // Ensures that foo was removed from the callChecks array after being called the // expected number of times. -if (typeof tracker.report()[0] === 'undefined') { - process.exit(1); -} +assert.strictEqual(typeof tracker.report()[0], 'undefined'); callsfoo(); // Ensures that foo was added back to the callChecks array after being called // more than the expected number of times. -if (tracker.report()[0].operator !== 'foo') { - process.exit(1); -} +assert.strictEqual(tracker.report()[0].operator, 'foo');