| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 786fbdb commit 13ac0a5
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ rules: | |||
| 47 | 47 | message: Use Number.isNaN() instead of the global isNaN() function. | |
| 48 | 48 | - selector: VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test']) | |
| 49 | 49 | message: Use 'test' as debuglog value in tests. | |
| 50 | - - selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^mustCall/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"])>:first-child[type=/FunctionExpression$/][body.body.length=0] | ||
| 50 | + - selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^must(Not)?Call/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"],[callee.name="mustNotCall"])>:first-child[type=/FunctionExpression$/][body.body.length=0] | ||
| 51 | 51 | message: Do not use an empty function, omit the parameter altogether. | |
| 52 | 52 | ||
| 53 | 53 | # Custom rules in tools/eslint-rules | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,7 +84,7 @@ const execOpts = { encoding: 'utf8', shell: true }; | |||
| 84 | 84 | // Verify that if something different than Abortcontroller.signal | |
| 85 | 85 | // is passed, ERR_INVALID_ARG_TYPE is thrown | |
| 86 | 86 | assert.throws(() => { | |
| 87 | - const callback = common.mustNotCall(() => {}); | ||
| 87 | + const callback = common.mustNotCall(); | ||
| 88 | 88 | ||
| 89 | 89 | execFile(process.execPath, [echoFixture, 0], { signal: 'hello' }, callback); | |
| 90 | 90 | }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,7 +64,7 @@ async function validateWrongSignalParam() { | |||
| 64 | 64 | // is passed, ERR_INVALID_ARG_TYPE is thrown | |
| 65 | 65 | ||
| 66 | 66 | await assert.rejects(async () => { | |
| 67 | - const callback = common.mustNotCall(() => {}); | ||
| 67 | + const callback = common.mustNotCall(); | ||
| 68 | 68 | await readFile(fn, { signal: 'hello' }, callback); | |
| 69 | 69 | }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); | |
| 70 | 70 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,7 +95,7 @@ for (const e of fileInfo) { | |||
| 95 | 95 | // Verify that if something different than Abortcontroller.signal | |
| 96 | 96 | // is passed, ERR_INVALID_ARG_TYPE is thrown | |
| 97 | 97 | assert.throws(() => { | |
| 98 | - const callback = common.mustNotCall(() => {}); | ||
| 98 | + const callback = common.mustNotCall(); | ||
| 99 | 99 | fs.readFile(fileInfo[0].name, { signal: 'hello' }, callback); | |
| 100 | 100 | }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }); | |
| 101 | 101 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ const http2 = require('http2'); | |||
| 11 | 11 | const { NghttpError } = require('internal/http2/util'); | |
| 12 | 12 | ||
| 13 | 13 | // Creating an http1 server here... | |
| 14 | - const server = http.createServer(common.mustNotCall(() => {})) | ||
| 14 | + const server = http.createServer(common.mustNotCall()) | ||
| 15 | 15 | .on('clientError', common.mustCall((error, socket) => { | |
| 16 | 16 | assert.strictEqual(error.code, 'HPE_PAUSED_H2_UPGRADE'); | |
| 17 | 17 | assert.strictEqual(error.bytesParsed, 24); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,7 @@ const server = https.createServer(options, function(req, res) { | |||
| 32 | 32 | path: '/', | |
| 33 | 33 | ca, | |
| 34 | 34 | servername: 'nodejs.org', | |
| 35 | - }, common.mustNotCall(() => {})); | ||
| 35 | + }, common.mustNotCall()); | ||
| 36 | 36 | ||
| 37 | 37 | req.on('error', common.mustCall((err) => { | |
| 38 | 38 | assert.strictEqual( | |
@@ -45,7 +45,7 @@ const server = https.createServer(options, function(req, res) { | |||
| 45 | 45 | path: '/', | |
| 46 | 46 | ca, | |
| 47 | 47 | servername: 'nodejs.org', | |
| 48 | - }, common.mustNotCall(() => {})); | ||
| 48 | + }, common.mustNotCall()); | ||
| 49 | 49 | ||
| 50 | 50 | second.on('error', common.mustCall((err) => { | |
| 51 | 51 | server.close(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1054,8 +1054,7 @@ for (let i = 0; i < 12; i++) { | |||
| 1054 | 1054 | rli.question('foo?', common.mustCall((answer) => { | |
| 1055 | 1055 | assert.strictEqual(answer, 'baz'); | |
| 1056 | 1056 | })); | |
| 1057 | - rli.question('bar?', common.mustNotCall(() => { | ||
| 1058 | - })); | ||
| 1057 | + rli.question('bar?', common.mustNotCall()); | ||
| 1059 | 1058 | rli.write('baz\n'); | |
| 1060 | 1059 | rli.close(); | |
| 1061 | 1060 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,7 +169,7 @@ const { setTimeout } = require('timers/promises'); | |||
| 169 | 169 | { | |
| 170 | 170 | const stream = Readable.from([1, 2, 3, 4, 5]); | |
| 171 | 171 | Object.defineProperty(stream, 'map', { | |
| 172 | - value: common.mustNotCall(() => {}), | ||
| 172 | + value: common.mustNotCall(), | ||
| 173 | 173 | }); | |
| 174 | 174 | // Check that map isn't getting called. | |
| 175 | 175 | stream.filter(() => true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,7 +124,7 @@ function oneTo5() { | |||
| 124 | 124 | { | |
| 125 | 125 | const stream = oneTo5(); | |
| 126 | 126 | Object.defineProperty(stream, 'map', { | |
| 127 | - value: common.mustNotCall(() => {}), | ||
| 127 | + value: common.mustNotCall(), | ||
| 128 | 128 | }); | |
| 129 | 129 | // Check that map isn't getting called. | |
| 130 | 130 | stream.flatMap(() => true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,7 +132,7 @@ const { once } = require('events'); | |||
| 132 | 132 | { | |
| 133 | 133 | const stream = Readable.from([1, 2, 3, 4, 5]); | |
| 134 | 134 | Object.defineProperty(stream, 'map', { | |
| 135 | - value: common.mustNotCall(() => {}), | ||
| 135 | + value: common.mustNotCall(), | ||
| 136 | 136 | }); | |
| 137 | 137 | // Check that map isn't getting called. | |
| 138 | 138 | stream.forEach(() => true); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments