Skip to content

Commit dc14bd8

Browse files
Trottbengl
authored andcommitted
test: remove lint rule for setTimeout() arguments
With the introduction of the promises API for setTimeout(), the requirement that it have two parameters may not be sensible anymore in tests. PR-URL: #41901 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent c41e402 commit dc14bd8

4 files changed

+0
-12
lines changed

test/.eslintrc.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ rules:
3131
message: "Use an object as second argument of `assert.throws()`."
3232
- selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.length<2]"
3333
message: "`assert.throws()` must be invoked with at least two arguments."
34-
- selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]"
35-
message: "`setTimeout()` must be invoked with at least two arguments."
3634
- selector: "CallExpression[callee.name='setInterval'][arguments.length<2]"
3735
message: "`setInterval()` must be invoked with at least two arguments."
3836
- selector: "ThrowStatement > CallExpression[callee.name=/Error$/]"

test/parallel/test-stream-construct-async-error.js

-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const assert = require('assert');
1212
{
1313
class Foo extends Duplex {
1414
async _destroy(err, cb) {
15-
// eslint-disable-next-line no-restricted-syntax
1615
await setTimeout(common.platformTimeout(1));
1716
throw new Error('boom');
1817
}
@@ -31,7 +30,6 @@ const assert = require('assert');
3130
{
3231
class Foo extends Duplex {
3332
async _destroy(err, cb) {
34-
// eslint-disable-next-line no-restricted-syntax
3533
await setTimeout(common.platformTimeout(1));
3634
}
3735
}
@@ -46,7 +44,6 @@ const assert = require('assert');
4644
{
4745
class Foo extends Duplex {
4846
async _construct() {
49-
// eslint-disable-next-line no-restricted-syntax
5047
await setTimeout(common.platformTimeout(1));
5148
}
5249

@@ -64,7 +61,6 @@ const assert = require('assert');
6461
{
6562
class Foo extends Duplex {
6663
async _construct(callback) {
67-
// eslint-disable-next-line no-restricted-syntax
6864
await setTimeout(common.platformTimeout(1));
6965
callback();
7066
}
@@ -88,7 +84,6 @@ const assert = require('assert');
8884
});
8985

9086
async _final() {
91-
// eslint-disable-next-line no-restricted-syntax
9287
await setTimeout(common.platformTimeout(1));
9388
}
9489
}
@@ -105,7 +100,6 @@ const assert = require('assert');
105100
});
106101

107102
async _final(callback) {
108-
// eslint-disable-next-line no-restricted-syntax
109103
await setTimeout(common.platformTimeout(1));
110104
callback();
111105
}
@@ -123,7 +117,6 @@ const assert = require('assert');
123117
});
124118

125119
async _final() {
126-
// eslint-disable-next-line no-restricted-syntax
127120
await setTimeout(common.platformTimeout(1));
128121
throw new Error('boom');
129122
}

test/parallel/test-stream-some-find-every.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ function oneTo5Async() {
5959

6060
{
6161
async function checkDestroyed(stream) {
62-
// eslint-disable-next-line no-restricted-syntax
6362
await setTimeout();
6463
assert.strictEqual(stream.destroyed, true);
6564
}
@@ -109,7 +108,6 @@ function oneTo5Async() {
109108
// Concurrency doesn't affect which value is found.
110109
const found = await Readable.from([1, 2]).find(async (val) => {
111110
if (val === 1) {
112-
// eslint-disable-next-line no-restricted-syntax
113111
await setTimeout(100);
114112
}
115113
return true;

test/parallel/test-stream-writable-final-async.js

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const { setTimeout } = require('timers/promises');
99
{
1010
class Foo extends Duplex {
1111
async _final(callback) {
12-
// eslint-disable-next-line no-restricted-syntax
1312
await setTimeout(common.platformTimeout(1));
1413
callback();
1514
}

0 commit comments

Comments
 (0)