| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 74c0464 commit 23fc205
42 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,10 @@ rules: | |||
| 13 | 13 | no-restricted-syntax: | |
| 14 | 14 | # Config copied from .eslintrc.js | |
| 15 | 15 | - error | |
| 16 | + - selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])" | ||
| 17 | + message: "Use strictEqual instead of deepStrictEqual for literals or undefined." | ||
| 18 | + - selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])" | ||
| 19 | + message: "Use notStrictEqual instead of notDeepStrictEqual for literals or undefined." | ||
| 16 | 20 | - selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']" | |
| 17 | 21 | message: "Do not use a literal for the third argument of assert.deepStrictEqual()" | |
| 18 | 22 | - selector: "CallExpression:matches([callee.name='doesNotThrow'], [callee.property.name='doesNotThrow'])" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ function createBase64URL(mime, body) { | |||
| 15 | 15 | const plainESMURL = createURL('text/javascript', body); | |
| 16 | 16 | const ns = await import(plainESMURL); | |
| 17 | 17 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 18 | - assert.deepStrictEqual(ns.default.a, 'aaa'); | ||
| 18 | + assert.strictEqual(ns.default.a, 'aaa'); | ||
| 19 | 19 | const importerOfURL = createURL( | |
| 20 | 20 | 'text/javascript', | |
| 21 | 21 | `export {default as default} from ${JSON.stringify(plainESMURL)}` | |
@@ -35,41 +35,41 @@ function createBase64URL(mime, body) { | |||
| 35 | 35 | const plainESMURL = createURL('text/javascript', body); | |
| 36 | 36 | const ns = await import(plainESMURL); | |
| 37 | 37 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 38 | - assert.deepStrictEqual(ns.default, plainESMURL); | ||
| 38 | + assert.strictEqual(ns.default, plainESMURL); | ||
| 39 | 39 | } | |
| 40 | 40 | { | |
| 41 | 41 | const body = 'export default import.meta.url;'; | |
| 42 | 42 | const plainESMURL = createURL('text/javascript;charset=UTF-8', body); | |
| 43 | 43 | const ns = await import(plainESMURL); | |
| 44 | 44 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 45 | - assert.deepStrictEqual(ns.default, plainESMURL); | ||
| 45 | + assert.strictEqual(ns.default, plainESMURL); | ||
| 46 | 46 | } | |
| 47 | 47 | { | |
| 48 | 48 | const body = 'export default import.meta.url;'; | |
| 49 | 49 | const plainESMURL = createURL('text/javascript;charset="UTF-8"', body); | |
| 50 | 50 | const ns = await import(plainESMURL); | |
| 51 | 51 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 52 | - assert.deepStrictEqual(ns.default, plainESMURL); | ||
| 52 | + assert.strictEqual(ns.default, plainESMURL); | ||
| 53 | 53 | } | |
| 54 | 54 | { | |
| 55 | 55 | const body = 'export default import.meta.url;'; | |
| 56 | 56 | const plainESMURL = createURL('text/javascript;;a=a;b=b;;', body); | |
| 57 | 57 | const ns = await import(plainESMURL); | |
| 58 | 58 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 59 | - assert.deepStrictEqual(ns.default, plainESMURL); | ||
| 59 | + assert.strictEqual(ns.default, plainESMURL); | ||
| 60 | 60 | } | |
| 61 | 61 | { | |
| 62 | 62 | const ns = await import('data:application/json;foo="test,"this"', | |
| 63 | 63 | { assert: { type: 'json' } }); | |
| 64 | 64 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 65 | - assert.deepStrictEqual(ns.default, 'this'); | ||
| 65 | + assert.strictEqual(ns.default, 'this'); | ||
| 66 | 66 | } | |
| 67 | 67 | { | |
| 68 | 68 | const ns = await import(`data:application/json;foo=${ | |
| 69 | 69 | encodeURIComponent('test,') | |
| 70 | 70 | },0`, { assert: { type: 'json' } }); | |
| 71 | 71 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 72 | - assert.deepStrictEqual(ns.default, 0); | ||
| 72 | + assert.strictEqual(ns.default, 0); | ||
| 73 | 73 | } | |
| 74 | 74 | { | |
| 75 | 75 | await assert.rejects(async () => | |
@@ -84,14 +84,14 @@ function createBase64URL(mime, body) { | |||
| 84 | 84 | const plainESMURL = createURL('application/json', body); | |
| 85 | 85 | const ns = await import(plainESMURL, { assert: { type: 'json' } }); | |
| 86 | 86 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 87 | - assert.deepStrictEqual(ns.default.x, 1); | ||
| 87 | + assert.strictEqual(ns.default.x, 1); | ||
| 88 | 88 | } | |
| 89 | 89 | { | |
| 90 | 90 | const body = '{"default": 2}'; | |
| 91 | 91 | const plainESMURL = createURL('application/json', body); | |
| 92 | 92 | const ns = await import(plainESMURL, { assert: { type: 'json' } }); | |
| 93 | 93 | assert.deepStrictEqual(Object.keys(ns), ['default']); | |
| 94 | - assert.deepStrictEqual(ns.default.default, 2); | ||
| 94 | + assert.strictEqual(ns.default.default, 2); | ||
| 95 | 95 | } | |
| 96 | 96 | { | |
| 97 | 97 | const body = 'null'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,10 +118,10 @@ assert.deepStrictEqual(new String(''), test.toObject('')); | |||
| 118 | 118 | assert.deepStrictEqual(new Number(0), test.toObject(0)); | |
| 119 | 119 | assert.deepStrictEqual(new Number(Number.NaN), test.toObject(Number.NaN)); | |
| 120 | 120 | assert.deepStrictEqual(new Object(testSym), test.toObject(testSym)); | |
| 121 | - assert.notDeepStrictEqual(test.toObject(false), false); | ||
| 122 | - assert.notDeepStrictEqual(test.toObject(true), true); | ||
| 123 | - assert.notDeepStrictEqual(test.toObject(''), ''); | ||
| 124 | - assert.notDeepStrictEqual(test.toObject(0), 0); | ||
| 121 | + assert.notStrictEqual(test.toObject(false), false); | ||
| 122 | + assert.notStrictEqual(test.toObject(true), true); | ||
| 123 | + assert.notStrictEqual(test.toObject(''), ''); | ||
| 124 | + assert.notStrictEqual(test.toObject(0), 0); | ||
| 125 | 125 | assert.ok(!Number.isNaN(test.toObject(Number.NaN))); | |
| 126 | 126 | ||
| 127 | 127 | assert.strictEqual(test.toString(''), ''); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -858,11 +858,13 @@ assert.throws( | |||
| 858 | 858 | } | |
| 859 | 859 | ||
| 860 | 860 | assert.throws( | |
| 861 | + // eslint-disable-next-line no-restricted-syntax | ||
| 861 | 862 | () => assert.deepStrictEqual(4, '4'), | |
| 862 | 863 | { message: `${defaultMsgStart}\n4 !== '4'\n` } | |
| 863 | 864 | ); | |
| 864 | 865 | ||
| 865 | 866 | assert.throws( | |
| 867 | + // eslint-disable-next-line no-restricted-syntax | ||
| 866 | 868 | () => assert.deepStrictEqual(true, 1), | |
| 867 | 869 | { message: `${defaultMsgStart}\ntrue !== 1\n` } | |
| 868 | 870 | ); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1243,6 +1243,7 @@ assert.throws( | |||
| 1243 | 1243 | { | |
| 1244 | 1244 | let threw = false; | |
| 1245 | 1245 | try { | |
| 1246 | + // eslint-disable-next-line no-restricted-syntax | ||
| 1246 | 1247 | assert.deepStrictEqual(Array(100).fill(1), 'foobar'); | |
| 1247 | 1248 | } catch (err) { | |
| 1248 | 1249 | threw = true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -422,8 +422,8 @@ assert.strictEqual( | |||
| 422 | 422 | } | |
| 423 | 423 | { | |
| 424 | 424 | const h = crypto.createHmac('sha1', 'key').update('data'); | |
| 425 | - assert.deepStrictEqual(h.digest('latin1'), expected); | ||
| 426 | - assert.deepStrictEqual(h.digest('latin1'), ''); | ||
| 425 | + assert.strictEqual(h.digest('latin1'), expected); | ||
| 426 | + assert.strictEqual(h.digest('latin1'), ''); | ||
| 427 | 427 | } | |
| 428 | 428 | } | |
| 429 | 429 | ||
@@ -440,8 +440,8 @@ assert.strictEqual( | |||
| 440 | 440 | } | |
| 441 | 441 | { | |
| 442 | 442 | const h = crypto.createHmac('sha1', 'key'); | |
| 443 | - assert.deepStrictEqual(h.digest('latin1'), expected); | ||
| 444 | - assert.deepStrictEqual(h.digest('latin1'), ''); | ||
| 443 | + assert.strictEqual(h.digest('latin1'), expected); | ||
| 444 | + assert.strictEqual(h.digest('latin1'), ''); | ||
| 445 | 445 | } | |
| 446 | 446 | } | |
| 447 | 447 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,7 +137,7 @@ dns.lookup('127.0.0.1', { | |||
| 137 | 137 | family: 4, | |
| 138 | 138 | all: false | |
| 139 | 139 | }, common.mustSucceed((result, addressType) => { | |
| 140 | - assert.deepStrictEqual(result, '127.0.0.1'); | ||
| 140 | + assert.strictEqual(result, '127.0.0.1'); | ||
| 141 | 141 | assert.strictEqual(addressType, 4); | |
| 142 | 142 | })); | |
| 143 | 143 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -337,10 +337,10 @@ assert.throws(() => { | |||
| 337 | 337 | ||
| 338 | 338 | { | |
| 339 | 339 | dns.resolveMx('foo.onion', function(err) { | |
| 340 | - assert.deepStrictEqual(err.code, 'ENOTFOUND'); | ||
| 341 | - assert.deepStrictEqual(err.syscall, 'queryMx'); | ||
| 342 | - assert.deepStrictEqual(err.hostname, 'foo.onion'); | ||
| 343 | - assert.deepStrictEqual(err.message, 'queryMx ENOTFOUND foo.onion'); | ||
| 340 | + assert.strictEqual(err.code, 'ENOTFOUND'); | ||
| 341 | + assert.strictEqual(err.syscall, 'queryMx'); | ||
| 342 | + assert.strictEqual(err.hostname, 'foo.onion'); | ||
| 343 | + assert.strictEqual(err.message, 'queryMx ENOTFOUND foo.onion'); | ||
| 344 | 344 | }); | |
| 345 | 345 | } | |
| 346 | 346 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,5 +64,5 @@ assert.strictEqual(cycle(Function), '[Function: Function]'); | |||
| 64 | 64 | } | |
| 65 | 65 | ||
| 66 | 66 | serializeError(new DynamicError()); | |
| 67 | - assert.deepStrictEqual(called, true); | ||
| 67 | + assert.strictEqual(called, true); | ||
| 68 | 68 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ async function validateFilePermission() { | |||
| 19 | 19 | const fileHandle = await open(filePath, 'w+', 0o444); | |
| 20 | 20 | // File created with r--r--r-- 444 | |
| 21 | 21 | const statsBeforeMod = fs.statSync(filePath); | |
| 22 | - assert.deepStrictEqual(statsBeforeMod.mode & 0o444, 0o444); | ||
| 22 | + assert.strictEqual(statsBeforeMod.mode & 0o444, 0o444); | ||
| 23 | 23 | ||
| 24 | 24 | let expectedAccess; | |
| 25 | 25 | const newPermissions = 0o765; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments