| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 82e6043 commit f0480d6
24 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,8 @@ rules: | |||
| 46 | 46 | message: Use Number.isNaN() instead of the global isNaN() function. | |
| 47 | 47 | - selector: VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test']) | |
| 48 | 48 | message: Use 'test' as debuglog value in tests. | |
| 49 | + - 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 | + message: Do not use an empty function, omit the parameter altogether. | ||
| 49 | 51 | ||
| 50 | 52 | # Custom rules in tools/eslint-rules | |
| 51 | 53 | node-core/prefer-assert-iferror: error | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ const verifyRequest = (idx) => (res) => { | |||
| 34 | 34 | socket = res.socket; | |
| 35 | 35 | } | |
| 36 | 36 | ||
| 37 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 37 | + res.on('data', common.mustCallAtLeast()); | ||
| 38 | 38 | res.on('end', common.mustCall(() => { | |
| 39 | 39 | if (++responses === 2) { | |
| 40 | 40 | // Clean up to let the event loop stop. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 47 | 47 | // Check that request and response share their socket. | |
| 48 | 48 | assert.strictEqual(r1.socket, socket); | |
| 49 | 49 | ||
| 50 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 50 | + res.on('data', common.mustCallAtLeast()); | ||
| 51 | 51 | res.on('end', common.mustCall(() => { | |
| 52 | 52 | // setImmediate() to give the agent time to register the freed socket. | |
| 53 | 53 | setImmediate(common.mustCall(() => { | |
@@ -70,7 +70,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 70 | 70 | // Empty payload, to hit the “right” code path. | |
| 71 | 71 | r2.end(''); | |
| 72 | 72 | ||
| 73 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 73 | + res.on('data', common.mustCallAtLeast()); | ||
| 74 | 74 | res.on('end', common.mustCall(() => { | |
| 75 | 75 | // Clean up to let the event loop stop. | |
| 76 | 76 | server.close(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,8 +14,7 @@ assert.strictEqual(expected, '/caf\u{e9}\u{1f436}'); | |||
| 14 | 14 | ||
| 15 | 15 | const server = http.createServer(common.mustCall(function(req, res) { | |
| 16 | 16 | assert.strictEqual(req.url, expected); | |
| 17 | - req.on('data', common.mustCall(function() { | ||
| 18 | - })).on('end', common.mustCall(function() { | ||
| 17 | + req.on('data', common.mustCall()).on('end', common.mustCall(function() { | ||
| 19 | 18 | server.close(); | |
| 20 | 19 | res.writeHead(200); | |
| 21 | 20 | res.end('hello world\n'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,7 +50,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 50 | 50 | // Check that request and response share their socket. | |
| 51 | 51 | assert.strictEqual(r1.socket, socket); | |
| 52 | 52 | ||
| 53 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 53 | + res.on('data', common.mustCallAtLeast()); | ||
| 54 | 54 | res.on('end', common.mustCall(() => { | |
| 55 | 55 | // setImmediate() to give the agent time to register the freed socket. | |
| 56 | 56 | setImmediate(common.mustCall(() => { | |
@@ -66,7 +66,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 66 | 66 | // Empty payload, to hit the “right” code path. | |
| 67 | 67 | r2.end(''); | |
| 68 | 68 | ||
| 69 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 69 | + res.on('data', common.mustCallAtLeast()); | ||
| 70 | 70 | res.on('end', common.mustCall(() => { | |
| 71 | 71 | // Clean up to let the event loop stop. | |
| 72 | 72 | server.close(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,7 +40,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 40 | 40 | // Check that request and response share their socket. | |
| 41 | 41 | assert.strictEqual(r1.socket, socket); | |
| 42 | 42 | ||
| 43 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 43 | + res.on('data', common.mustCallAtLeast()); | ||
| 44 | 44 | res.on('end', common.mustCall(() => { | |
| 45 | 45 | // setImmediate() to give the agent time to register the freed socket. | |
| 46 | 46 | setImmediate(common.mustCall(() => { | |
@@ -62,7 +62,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 62 | 62 | // Empty payload, to hit the “right” code path. | |
| 63 | 63 | r2.end(''); | |
| 64 | 64 | ||
| 65 | - res.on('data', common.mustCallAtLeast(() => {})); | ||
| 65 | + res.on('data', common.mustCallAtLeast()); | ||
| 66 | 66 | res.on('end', common.mustCall(() => { | |
| 67 | 67 | // Clean up to let the event loop stop. | |
| 68 | 68 | server.close(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,8 +20,7 @@ if (!process.argv[2]) { | |||
| 20 | 20 | { detached: true, stdio: ['ignore', 'ignore', 'ignore', 'ipc'] }); | |
| 21 | 21 | ||
| 22 | 22 | const messageHandlers = { | |
| 23 | - workerOnline: common.mustCall((msg) => { | ||
| 24 | - }), | ||
| 23 | + workerOnline: common.mustCall(), | ||
| 25 | 24 | mainWindowHandle: common.mustCall((msg) => { | |
| 26 | 25 | assert.match(msg.value, /0\s*/); | |
| 27 | 26 | }), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ if (cluster.isPrimary) { | |||
| 17 | 17 | })); | |
| 18 | 18 | } else { | |
| 19 | 19 | assert(process.env.PORT); | |
| 20 | - process.on('uncaughtException', common.mustCall((e) => {})); | ||
| 20 | + process.on('uncaughtException', common.mustCall()); | ||
| 21 | 21 | server.listen(process.env.PORT); | |
| 22 | 22 | server.on('error', common.mustCall((e) => { | |
| 23 | 23 | cluster.worker.disconnect(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ if (cluster.isWorker) { | |||
| 13 | 13 | const http = require('http'); | |
| 14 | 14 | const server = http.Server(() => { }); | |
| 15 | 15 | ||
| 16 | - server.once('listening', common.mustCall(() => { })); | ||
| 16 | + server.once('listening', common.mustCall()); | ||
| 17 | 17 | server.listen(0, '127.0.0.1'); | |
| 18 | 18 | ||
| 19 | 19 | } else if (cluster.isMaster) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ if (cluster.isWorker) { | |||
| 35 | 35 | const http = require('http'); | |
| 36 | 36 | const server = http.Server(() => { }); | |
| 37 | 37 | ||
| 38 | - server.once('listening', common.mustCall(() => { })); | ||
| 38 | + server.once('listening', common.mustCall()); | ||
| 39 | 39 | server.listen(0, '127.0.0.1'); | |
| 40 | 40 | ||
| 41 | 41 | } else if (cluster.isPrimary) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments