From 11e76fcba4d8c5b2677678024b17536f2f791579 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 10 Feb 2022 22:02:28 -0800 Subject: [PATCH] test: remove lint rule for setTimeout() arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Mestery Reviewed-By: Luigi Pinca --- test/.eslintrc.yaml | 2 -- test/parallel/test-stream-construct-async-error.js | 7 ------- test/parallel/test-stream-writable-final-async.js | 1 - 3 files changed, 10 deletions(-) diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 67a2b9667bb583..2a8ca894c7d688 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -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$/]" diff --git a/test/parallel/test-stream-construct-async-error.js b/test/parallel/test-stream-construct-async-error.js index ea2d8740e29c94..3fe81b4ebe2d6b 100644 --- a/test/parallel/test-stream-construct-async-error.js +++ b/test/parallel/test-stream-construct-async-error.js @@ -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'); } diff --git a/test/parallel/test-stream-writable-final-async.js b/test/parallel/test-stream-writable-final-async.js index 5571b794fd4fbd..c17b843322222e 100644 --- a/test/parallel/test-stream-writable-final-async.js +++ b/test/parallel/test-stream-writable-final-async.js @@ -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(); }