From c506660f326750a9cbde6a715b357d42d2c46a0a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 11 Jul 2021 15:35:09 -0700 Subject: [PATCH] test: put common lint exceptions into config file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For lint exceptions that are universal or near universal for `test/common`, put the exceptions in a config file rather than disabling the ESLint rules at the top of each file. PR-URL: https://github.com/nodejs/node/pull/39358 Reviewed-By: Michaël Zasso Reviewed-By: Antoine du Hamel Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/common/.eslintrc.yaml | 3 +++ test/common/arraystream.js | 1 - test/common/benchmark.js | 2 -- test/common/countdown.js | 2 -- test/common/cpu-prof.js | 2 -- test/common/dns.js | 1 - test/common/duplexpair.js | 1 - test/common/fixtures.js | 1 - test/common/fixtures.mjs | 1 - test/common/heap.js | 1 - test/common/hijackstdio.js | 1 - test/common/http2.js | 1 - test/common/index.js | 1 - test/common/index.mjs | 2 -- test/common/internet.js | 1 - test/common/measure-memory.js | 1 - test/common/report.js | 1 - test/common/require-as.js | 1 - test/common/tls.js | 1 - test/common/tmpdir.js | 1 - test/common/udppair.js | 1 - test/common/wpt.js | 1 - test/common/wpt/worker.js | 2 -- 23 files changed, 3 insertions(+), 27 deletions(-) create mode 100644 test/common/.eslintrc.yaml diff --git a/test/common/.eslintrc.yaml b/test/common/.eslintrc.yaml new file mode 100644 index 00000000000000..b3981bdd272eca --- /dev/null +++ b/test/common/.eslintrc.yaml @@ -0,0 +1,3 @@ +rules: + node-core/required-modules: off + node-core/require-common-first: off diff --git a/test/common/arraystream.js b/test/common/arraystream.js index 408d57712c73ef..c9dae0512b52cc 100644 --- a/test/common/arraystream.js +++ b/test/common/arraystream.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const { Stream } = require('stream'); diff --git a/test/common/benchmark.js b/test/common/benchmark.js index 56351c92505efa..88c918766fd76c 100644 --- a/test/common/benchmark.js +++ b/test/common/benchmark.js @@ -1,5 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ - 'use strict'; const assert = require('assert'); diff --git a/test/common/countdown.js b/test/common/countdown.js index 31507b61257633..4aa86b42533903 100644 --- a/test/common/countdown.js +++ b/test/common/countdown.js @@ -1,5 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ - 'use strict'; const assert = require('assert'); diff --git a/test/common/cpu-prof.js b/test/common/cpu-prof.js index ae81eefd45c307..e4bba24037dff9 100644 --- a/test/common/cpu-prof.js +++ b/test/common/cpu-prof.js @@ -1,5 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ - 'use strict'; require('./'); diff --git a/test/common/dns.js b/test/common/dns.js index 3574229db44117..70e171695ff20d 100644 --- a/test/common/dns.js +++ b/test/common/dns.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const assert = require('assert'); diff --git a/test/common/duplexpair.js b/test/common/duplexpair.js index 4eb4f326f2d295..1f41ed32f1b9e9 100644 --- a/test/common/duplexpair.js +++ b/test/common/duplexpair.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const { Duplex } = require('stream'); const assert = require('assert'); diff --git a/test/common/fixtures.js b/test/common/fixtures.js index e33ab1d3e1b3e6..e5e1d887df525e 100644 --- a/test/common/fixtures.js +++ b/test/common/fixtures.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const path = require('path'); diff --git a/test/common/fixtures.mjs b/test/common/fixtures.mjs index 3eeef6d6077c4a..06564de6fa3bb9 100644 --- a/test/common/fixtures.mjs +++ b/test/common/fixtures.mjs @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ import fixtures from './fixtures.js'; const { diff --git a/test/common/heap.js b/test/common/heap.js index a6232177ba9fd3..fa74e606f03ee0 100644 --- a/test/common/heap.js +++ b/test/common/heap.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const assert = require('assert'); const util = require('util'); diff --git a/test/common/hijackstdio.js b/test/common/hijackstdio.js index 6995f6665891d3..44e00ed0b11cc2 100644 --- a/test/common/hijackstdio.js +++ b/test/common/hijackstdio.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; // Hijack stdout and stderr diff --git a/test/common/http2.js b/test/common/http2.js index c4d430d1d93f98..baaed492e5a9a3 100644 --- a/test/common/http2.js +++ b/test/common/http2.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; // An HTTP/2 testing tool used to create mock frames for direct testing diff --git a/test/common/index.js b/test/common/index.js index df61b3c3cda1a0..0f0885997ce9a1 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -19,7 +19,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -/* eslint-disable node-core/require-common-first, node-core/required-modules */ /* eslint-disable node-core/crypto-check */ 'use strict'; const process = global.process; // Some tests tamper with the process global. diff --git a/test/common/index.mjs b/test/common/index.mjs index 1824497ff6533f..babc3fbbba0528 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -1,5 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ - import { createRequire } from 'module'; const require = createRequire(import.meta.url); diff --git a/test/common/internet.js b/test/common/internet.js index accea74969e276..227e979d3b8c75 100644 --- a/test/common/internet.js +++ b/test/common/internet.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; // Utilities for internet-related tests diff --git a/test/common/measure-memory.js b/test/common/measure-memory.js index 67c8fb3b9d2d67..a42f6344268d12 100644 --- a/test/common/measure-memory.js +++ b/test/common/measure-memory.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const assert = require('assert'); diff --git a/test/common/report.js b/test/common/report.js index 28c10181474f25..b1d6b058172590 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const assert = require('assert'); const fs = require('fs'); diff --git a/test/common/require-as.js b/test/common/require-as.js index 7aba4fa6d825a2..9425404fa1416d 100644 --- a/test/common/require-as.js +++ b/test/common/require-as.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; if (require.main !== module) { diff --git a/test/common/tls.js b/test/common/tls.js index 27414c79eda040..2c91241c3b20b7 100644 --- a/test/common/tls.js +++ b/test/common/tls.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ /* eslint-disable node-core/crypto-check */ 'use strict'; diff --git a/test/common/tmpdir.js b/test/common/tmpdir.js index d911feb460a2f3..0bafea1582b38d 100644 --- a/test/common/tmpdir.js +++ b/test/common/tmpdir.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const fs = require('fs'); diff --git a/test/common/udppair.js b/test/common/udppair.js index a7e532a99778e9..6213f4becfd6aa 100644 --- a/test/common/udppair.js +++ b/test/common/udppair.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const { internalBinding } = require('internal/test/binding'); const { JSUDPWrap } = internalBinding('js_udp_wrap'); diff --git a/test/common/wpt.js b/test/common/wpt.js index 74508f0c8d2a56..3e2f8151a6c20b 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -1,4 +1,3 @@ -/* eslint-disable node-core/require-common-first, node-core/required-modules */ 'use strict'; const assert = require('assert'); diff --git a/test/common/wpt/worker.js b/test/common/wpt/worker.js index afaee075f7a32e..468e950ac10cb1 100644 --- a/test/common/wpt/worker.js +++ b/test/common/wpt/worker.js @@ -1,5 +1,3 @@ -/* eslint-disable node-core/required-modules,node-core/require-common-first */ - 'use strict'; const { runInThisContext } = require('vm');