mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
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: https://github.com/nodejs/node/pull/41901 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
217366e308
commit
de9be2a679
4 files changed
-12
No files matched your search
@@ -31,8 +31,6 @@ rules:
|
||||
message: "Use an object as second argument of `assert.throws()`."
|
||||
- selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.length<2]"
|
||||
message: "`assert.throws()` must be invoked with at least two arguments."
|
||||
- selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]"
|
||||
message: "`setTimeout()` must be invoked with at least two arguments."
|
||||
- selector: "CallExpression[callee.name='setInterval'][arguments.length<2]"
|
||||
message: "`setInterval()` must be invoked with at least two arguments."
|
||||
- selector: "ThrowStatement > CallExpression[callee.name=/Error$/]"
|
||||
|
||||
@@ -12,7 +12,6 @@ const assert = require('assert');
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
async _destroy(err, cb) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
throw new Error('boom');
|
||||
}
|
||||
@@ -31,7 +30,6 @@ const assert = require('assert');
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
async _destroy(err, cb) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
}
|
||||
}
|
||||
@@ -46,7 +44,6 @@ const assert = require('assert');
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
async _construct() {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
}
|
||||
|
||||
@@ -64,7 +61,6 @@ const assert = require('assert');
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
async _construct(callback) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
callback();
|
||||
}
|
||||
@@ -88,7 +84,6 @@ const assert = require('assert');
|
||||
});
|
||||
|
||||
async _final() {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
}
|
||||
}
|
||||
@@ -105,7 +100,6 @@ const assert = require('assert');
|
||||
});
|
||||
|
||||
async _final(callback) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
callback();
|
||||
}
|
||||
@@ -123,7 +117,6 @@ const assert = require('assert');
|
||||
});
|
||||
|
||||
async _final() {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
throw new Error('boom');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ function oneTo5Async() {
|
||||
|
||||
{
|
||||
async function checkDestroyed(stream) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout();
|
||||
assert.strictEqual(stream.destroyed, true);
|
||||
}
|
||||
@@ -109,7 +108,6 @@ function oneTo5Async() {
|
||||
// Concurrency doesn't affect which value is found.
|
||||
const found = await Readable.from([1, 2]).find(async (val) => {
|
||||
if (val === 1) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(100);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -9,7 +9,6 @@ const { setTimeout } = require('timers/promises');
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
async _final(callback) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
callback();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user