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 <tniessen@tnie.de> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent c41e402 commit dc14bd8

4 files changed

Lines changed: 0 additions & 12 deletions

File tree

‎test/.eslintrc.yaml‎

Lines changed: 0 additions & 2 deletions
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‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const assert = require('assert');
1212
{
1313
classFooextendsDuplex{
1414
async_destroy(err,cb){
15-
// eslint-disable-next-line no-restricted-syntax
1615
awaitsetTimeout(common.platformTimeout(1));
1716
thrownewError('boom');
1817
}
@@ -31,7 +30,6 @@ const assert = require('assert');
3130
{
3231
classFooextendsDuplex{
3332
async_destroy(err,cb){
34-
// eslint-disable-next-line no-restricted-syntax
3533
awaitsetTimeout(common.platformTimeout(1));
3634
}
3735
}
@@ -46,7 +44,6 @@ const assert = require('assert');
4644
{
4745
classFooextendsDuplex{
4846
async_construct(){
49-
// eslint-disable-next-line no-restricted-syntax
5047
awaitsetTimeout(common.platformTimeout(1));
5148
}
5249

@@ -64,7 +61,6 @@ const assert = require('assert');
6461
{
6562
classFooextendsDuplex{
6663
async_construct(callback){
67-
// eslint-disable-next-line no-restricted-syntax
6864
awaitsetTimeout(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
awaitsetTimeout(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
awaitsetTimeout(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
awaitsetTimeout(common.platformTimeout(1));
128121
thrownewError('boom');
129122
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ function oneTo5Async() {
5959

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const { setTimeout } = require('timers/promises');
99
{
1010
classFooextendsDuplex{
1111
async_final(callback){
12-
// eslint-disable-next-line no-restricted-syntax
1312
awaitsetTimeout(common.platformTimeout(1));
1413
callback();
1514
}

0 commit comments

Comments
 (0)