GeezerVison is showing github.com — tools: enable ESLint no-sparse-arrays rule · nodejs/node@8090ce7
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .eslintrc.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -275,6 +275,7 @@ module.exports = { | 275 | 275 | 'no-self-compare': 'error', | 276 | 276 | 'no-setter-return': 'error', | 277 | 277 | 'no-shadow-restricted-names': 'error', | | 278 | + 'no-sparse-arrays': 'error', | 278 | 279 | 'no-tabs': 'error', | 279 | 280 | 'no-template-curly-in-string': 'error', | 280 | 281 | 'no-this-before-super': 'error', | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/modules/esm/get_format.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,7 +45,7 @@ const protocolHandlers = ObjectAssign(ObjectCreate(null), { | 45 | 45 | const { 1: mime } = RegExpPrototypeExec( | 46 | 46 | /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/, | 47 | 47 | parsed.pathname, | 48 | | - ) || [, null]; | | 48 | + ) || [, null]; // eslint-disable-line no-sparse-arrays | 49 | 49 | const format = ({ | 50 | 50 | '__proto__': null, | 51 | 51 | 'text/javascript': 'module', | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -567,8 +567,10 @@ assertNotDeepOrStrict( | 567 | 567 |
| 568 | 568 | // Handle sparse arrays. | 569 | 569 | { | | 570 | + /* eslint-disable no-sparse-arrays */ | 570 | 571 | assertDeepAndStrictEqual([1, , , 3], [1, , , 3]); | 571 | 572 | assertNotDeepOrStrict([1, , , 3], [1, , , 3, , , ]); | | 573 | + /* eslint-enable no-sparse-arrays */ | 572 | 574 | const a = new Array(3); | 573 | 575 | const b = new Array(3); | 574 | 576 | a[2] = true; | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -434,7 +434,7 @@ assert.strictEqual( | 434 | 434 |
| 435 | 435 | // Array with extra properties. | 436 | 436 | { | 437 | | - const arr = [1, 2, 3, , ]; | | 437 | + const arr = [1, 2, 3, , ]; // eslint-disable-line no-sparse-arrays | 438 | 438 | arr.foo = 'bar'; | 439 | 439 | assert.strictEqual(util.inspect(arr), | 440 | 440 | "[ 1, 2, 3, <1 empty item>, foo: 'bar' ]"); | @@ -2142,6 +2142,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); | 2142 | 2142 | [function() {}, '[Function (anonymous)]'], | 2143 | 2143 | [() => {}, '[Function (anonymous)]'], | 2144 | 2144 | [[1, 2], '[ 1, 2 ]'], | | 2145 | + // eslint-disable-next-line no-sparse-arrays | 2145 | 2146 | [[, , 5, , , , ], '[ <2 empty items>, 5, <3 empty items> ]'], | 2146 | 2147 | [{ a: 5 }, '{ a: 5 }'], | 2147 | 2148 | [new Set([1, 2]), 'Set(2) { 1, 2 }'], | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-util-isDeepStrictEqual.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -409,8 +409,10 @@ notUtilIsDeepStrict( | 409 | 409 | } | 410 | 410 |
| 411 | 411 | // Handle sparse arrays | | 412 | +/* eslint-disable no-sparse-arrays */ | 412 | 413 | utilIsDeepStrict([1, , , 3], [1, , , 3]); | 413 | 414 | notUtilIsDeepStrict([1, , , 3], [1, , , 3, , , ]); | | 415 | +/* eslint-enable no-sparse-arrays */ | 414 | 416 |
| 415 | 417 | // Handle different error messages | 416 | 418 | { | |
|