Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ESLint, replace custom rule with built-in #8478

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ rules:
no-new-require: 2
no-path-concat: 2
no-restricted-modules: [2, sys, _linklist]
no-restricted-properties: [2, {
object: assert,
property: deepEqual,
message: Please use assert.deepStrictEqual().
}]

# Stylistic Issues
# http://eslint.org/docs/rules/#stylistic-issues
Expand Down Expand Up @@ -98,7 +103,6 @@ rules:
align-multiline-assignment: 2
assert-fail-single-argument: 2
new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError]
no-deepEqual: 2
no-definegetter-definesetter: 2

# Global scoped method and vars
Expand Down
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-prims-and-objs-big-array.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-deepEqual: 0 */
'use strict';
var common = require('../common.js');
var assert = require('assert');
Expand Down Expand Up @@ -35,6 +34,7 @@ function main(conf) {

bench.start();
for (x = 0; x < n; x++) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(primArray, primArrayCompare);
}
bench.end(n);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-prims-and-objs-big-loop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-deepEqual: 0 */
'use strict';
var common = require('../common.js');
var assert = require('assert');
Expand Down Expand Up @@ -27,6 +26,7 @@ function main(conf) {
bench.start();

for (x = 0; x < n; x++) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(new Array([prim]), new Array([prim]));
}

Expand Down
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-typedarrays.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-deepEqual: 0 */
'use strict';
var common = require('../common.js');
var assert = require('assert');
Expand All @@ -17,6 +16,7 @@ function main(conf) {
var actual = new clazz(n * 1e6);
var expected = new clazz(n * 1e6);

// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);

bench.end(n);
Expand Down
2 changes: 2 additions & 0 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,13 @@ assert.notEqual = function notEqual(actual, expected, message) {
// 7. The equivalence assertion tests a deep equality relation.
// assert.deepEqual(actual, expected, message_opt);

/* eslint-disable no-restricted-properties */
assert.deepEqual = function deepEqual(actual, expected, message) {
if (!_deepEqual(actual, expected, false)) {
fail(actual, expected, message, 'deepEqual', assert.deepEqual);
}
};
/* eslint-enable */

assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
if (!_deepEqual(actual, expected, true)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ function setupChannel(target, channel) {
this.emit('unref');
}
}
};
}();

var decoder = new StringDecoder('utf8');
var jsonBuffer = '';
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-assert-typedarray-deepequal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-deepEqual: 0 */
'use strict';

require('../common');
Expand Down Expand Up @@ -46,6 +45,7 @@ const notEqualArrayPairs = [
];

equalArrayPairs.forEach((arrayPair) => {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(arrayPair[0], arrayPair[1]);
});

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-assert.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-deepEqual: 0 */
'use strict';
require('../common');
var assert = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-readable-from-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function run() {
var fn = next[1];
console.log('# %s', name);
fn({
same: assert.deepEqual,
same: assert.deepStrictEqual,
equal: assert.equal,
end: function() {
count--;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-set-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function run() {
var fn = next[1];
console.log('# %s', name);
fn({
same: assert.deepEqual,
same: assert.deepStrictEqual,
equal: assert.equal,
end: function() {
count--;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function run() {
var fn = next[1];
console.log('# %s', name);
fn({
same: assert.deepEqual,
same: assert.deepStrictEqual,
equal: assert.equal,
ok: assert,
end: function() {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function run() {
var fn = next[1];
console.log('# %s', name);
fn({
same: assert.deepEqual,
same: assert.deepStrictEqual,
equal: assert.equal,
end: function() {
count--;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-timer-close.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require('../common');
var assert = require('assert');

var t = new (process.binding('timer_wrap').Timer);
var t = new (process.binding('timer_wrap').Timer)();
var called = 0;
function onclose() {
called++;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; })));
}

{
const x = new function() {};
const x = new function() {}; // eslint-disable-line new-parens
assert.strictEqual(util.inspect(x), '{}');
}

Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ assert.equal(false, util.isRegExp(Object.create(RegExp.prototype)));
// isDate
assert.equal(true, util.isDate(new Date()));
assert.equal(true, util.isDate(new Date(0)));
// eslint-disable-next-line new-parens
assert.equal(true, util.isDate(new (context('Date'))));
assert.equal(false, util.isDate(Date()));
assert.equal(false, util.isDate({}));
Expand All @@ -41,9 +42,11 @@ assert.equal(false, util.isDate(Object.create(Date.prototype)));
assert.equal(true, util.isError(new Error()));
assert.equal(true, util.isError(new TypeError()));
assert.equal(true, util.isError(new SyntaxError()));
/* eslint-disable new-parens */
assert.equal(true, util.isError(new (context('Error'))));
assert.equal(true, util.isError(new (context('TypeError'))));
assert.equal(true, util.isError(new (context('SyntaxError'))));
/* eslint-enable */
assert.equal(false, util.isError({}));
assert.equal(false, util.isError({ name: 'Error', message: '' }));
assert.equal(false, util.isError([]));
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-stream2-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function run() {
var fn = next[1];
console.log('# %s', name);
fn({
same: assert.deepEqual,
same: assert.deepStrictEqual,
ok: assert,
equal: assert.equal,
end: function() {
Expand Down
32 changes: 0 additions & 32 deletions tools/eslint-rules/no-deepEqual.js

This file was deleted.

Loading