From b53872074de2c186f3cc0e61620483334bf136ab Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Sun, 13 Aug 2023 15:24:58 +0200 Subject: [PATCH] Use maintained fork of `eslint-plugin-node` Since it can be hard for users of `eslint-plugin-node` to find out that there's a maintained fork from the official ESLint Community project I'm doing a drive where I'm making PR:s to some projects to raise awareness. See: https://github.com/eslint-community/eslint-plugin-n/issues/100 --- .eslintrc.js | 4 +- bin/build-for-publishing.js | 1 + bin/changelog.js | 2 +- bin/publish-to-s3.mjs | 2 +- bin/run-browserstack-tests.js | 4 +- bin/run-tests.js | 4 +- broccoli/packages.js | 2 +- package.json | 2 +- smoke-tests/ember-test-app/.eslintrc.js | 9 +-- yarn.lock | 91 +++++++++++-------------- 10 files changed, 51 insertions(+), 70 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 95bb7c8af45..db87687cad1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -151,8 +151,8 @@ module.exports = { es6: true, }, - plugins: ['node'], - extends: ['plugin:node/recommended'], + plugins: ['n'], + extends: ['plugin:n/recommended'], rules: { // add your custom rules and overrides for node files here 'no-process-exit': 'off', diff --git a/bin/build-for-publishing.js b/bin/build-for-publishing.js index bc5ca24e70b..7fce27a8966 100755 --- a/bin/build-for-publishing.js +++ b/bin/build-for-publishing.js @@ -93,6 +93,7 @@ Promise.resolve() // eslint-disable-next-line console.log('build-for-publishing failed'); // failure, must manually exit non-zero + // eslint-disable-next-line n/no-process-exit process.exit(1); } ); diff --git a/bin/changelog.js b/bin/changelog.js index 020256e064b..05736dfdc9e 100755 --- a/bin/changelog.js +++ b/bin/changelog.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -/* eslint-disable no-console, node/shebang */ +/* eslint-disable no-console, n/shebang */ 'use strict'; diff --git a/bin/publish-to-s3.mjs b/bin/publish-to-s3.mjs index 468be8737cc..20e3aaf2e88 100755 --- a/bin/publish-to-s3.mjs +++ b/bin/publish-to-s3.mjs @@ -118,5 +118,5 @@ if (!buildInfo.isBuildForTag) { function exitGracefully(err) { console.log(err); // eslint-disable-line no-console - process.exit(1); + process.exit(1); // eslint-disable-line n/no-process-exit } diff --git a/bin/run-browserstack-tests.js b/bin/run-browserstack-tests.js index 60eb5435d60..29a51c37bcd 100755 --- a/bin/run-browserstack-tests.js +++ b/bin/run-browserstack-tests.js @@ -32,7 +32,7 @@ function run(command, args = []) { ]); console.log('success'); - process.exit(0); + process.exit(0); // eslint-disable-line n/no-process-exit } finally { if (process.env.GITHUB_RUN_ID) { await run('ember', ['browserstack:results']); @@ -42,6 +42,6 @@ function run(command, args = []) { } catch (error) { console.log('error'); console.log(error); - process.exit(1); + process.exit(1); // eslint-disable-line n/no-process-exit } })(); diff --git a/bin/run-tests.js b/bin/run-tests.js index c414b603ec0..cbd49c87fc8 100755 --- a/bin/run-tests.js +++ b/bin/run-tests.js @@ -104,12 +104,12 @@ function runAndExit() { runInSequence(testFunctions) .then(function () { console.log(chalk.green('Passed!')); - process.exit(0); + process.exit(0); // eslint-disable-line n/no-process-exit }) .catch(function (err) { console.error(chalk.red(err.toString())); console.error(chalk.red('Failed!')); - process.exit(1); + process.exit(1); // eslint-disable-line n/no-process-exit }); } diff --git a/broccoli/packages.js b/broccoli/packages.js index e6e77d329f0..483f2528a05 100644 --- a/broccoli/packages.js +++ b/broccoli/packages.js @@ -274,7 +274,7 @@ module.exports.glimmerES = function glimmerES(environment) { if (environment === 'development') { let hasGlimmerDebug = true; try { - require.resolve('@glimmer/debug'); // eslint-disable-line node/no-missing-require + require.resolve('@glimmer/debug'); // eslint-disable-line n/no-missing-require } catch (e) { hasGlimmerDebug = false; } diff --git a/package.json b/package.json index 839129150b9..23718cc7be8 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "eslint-plugin-disable-features": "^0.1.3", "eslint-plugin-ember-internal": "^3.0.0", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-node": "^11.1.0", + "eslint-plugin-n": "^16.0.1", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-qunit": "^7.3.4", "execa": "^5.1.1", diff --git a/smoke-tests/ember-test-app/.eslintrc.js b/smoke-tests/ember-test-app/.eslintrc.js index 8a8a4ee83fa..e2004073b03 100644 --- a/smoke-tests/ember-test-app/.eslintrc.js +++ b/smoke-tests/ember-test-app/.eslintrc.js @@ -41,13 +41,8 @@ module.exports = { browser: false, node: true, }, - plugins: ['node'], - extends: ['plugin:node/recommended'], - rules: { - // this can be removed once the following is fixed - // https://github.com/mysticatea/eslint-plugin-node/issues/77 - 'node/no-unpublished-require': 'off', - }, + plugins: ['n'], + extends: ['plugin:n/recommended'], }, { // test files diff --git a/yarn.lock b/yarn.lock index 9efd00be9ad..7fd2d9f6012 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2047,17 +2047,17 @@ semver "^7.3.5" typescript-memoize "^1.0.1" -"@eslint-community/eslint-utils@^4.2.0": +"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": - version "4.5.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.0.tgz#f6f729b02feee2c749f57e334b7a1b5f40a81724" - integrity sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ== +"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.0": + version "4.6.2" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" + integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== "@eslint/eslintrc@^2.0.2": version "2.0.2" @@ -4121,7 +4121,7 @@ buffer@^5.2.1, buffer@^5.5.0: base64-js "^1.0.2" ieee754 "^1.1.4" -builtins@^5.0.0: +builtins@^5.0.0, builtins@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9" integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ== @@ -5717,13 +5717,13 @@ eslint-plugin-ember-internal@^3.0.0: line-column "^1.0.2" requireindex "^1.2.0" -eslint-plugin-es@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-3.0.0.tgz#98cb1bc8ab0aa807977855e11ad9d1c9422d014b" - integrity "sha1-mMsbyKsKqAeXeFXhGtnRyUItAUs= sha512-6/Jb/J/ZvSebydwbBJO1R9E5ky7YeElfK56Veh7e4QGFHCXoIXGH9HhVz+ibJLM3XJ1XjP+T7rKBLUa/Y7eIng==" +eslint-plugin-es-x@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz#5779d742ad31f8fd780b9481331481e142b72311" + integrity sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA== dependencies: - eslint-utils "^2.0.0" - regexpp "^3.0.0" + "@eslint-community/eslint-utils" "^4.1.2" + "@eslint-community/regexpp" "^4.6.0" eslint-plugin-import@^2.27.5: version "2.27.5" @@ -5746,17 +5746,19 @@ eslint-plugin-import@^2.27.5: semver "^6.3.0" tsconfig-paths "^3.14.1" -eslint-plugin-node@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d" - integrity "sha1-yVVEQW7kraJnQKMEdO78VALcZx0= sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==" +eslint-plugin-n@^16.0.1: + version "16.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.0.1.tgz#baa62bb3af52940a53ba15386348ad9b0b425ada" + integrity sha512-CDmHegJN0OF3L5cz5tATH84RPQm9kG+Yx39wIqIwPR2C0uhBGMWfbbOtetR83PQjjidA5aXMu+LEFw1jaSwvTA== dependencies: - eslint-plugin-es "^3.0.0" - eslint-utils "^2.0.0" - ignore "^5.1.1" - minimatch "^3.0.4" - resolve "^1.10.1" - semver "^6.1.0" + "@eslint-community/eslint-utils" "^4.4.0" + builtins "^5.0.1" + eslint-plugin-es-x "^7.1.0" + ignore "^5.2.4" + is-core-module "^2.12.1" + minimatch "^3.1.2" + resolve "^1.22.2" + semver "^7.5.3" eslint-plugin-prettier@^4.2.1: version "4.2.1" @@ -5789,13 +5791,6 @@ eslint-scope@^7.2.0: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" - integrity "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc= sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==" - dependencies: - eslint-visitor-keys "^1.1.0" - eslint-utils@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" @@ -5803,11 +5798,6 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" - integrity "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4= sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" - eslint-visitor-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" @@ -7315,10 +7305,10 @@ ieee754@1.1.13, ieee754@^1.1.4: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" integrity "sha1-7BaFWOlaoYH9h9N/VcMrvLZwi4Q= sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" -ignore@^5.1.1, ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== +ignore@^5.1.1, ignore@^5.2.0, ignore@^5.2.4: + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.2.1" @@ -7540,10 +7530,10 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.11.0, is-core-module@^2.5.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" - integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== +is-core-module@^2.11.0, is-core-module@^2.5.0, is-core-module@^2.12.1: + version "2.13.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db" + integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ== dependencies: has "^1.0.3" @@ -10222,11 +10212,6 @@ regexp.prototype.flags@^1.3.1, regexp.prototype.flags@^1.4.3: define-properties "^1.1.3" functions-have-names "^1.2.2" -regexpp@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - regexpu-core@^5.2.1: version "5.2.2" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.2.2.tgz#3e4e5d12103b64748711c3aad69934d7718e75fc" @@ -10402,7 +10387,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg==" -resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.1, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.22.2, resolve@^1.4.0, resolve@^1.5.0: +resolve@^1.10.0, resolve@^1.11.1, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.22.2, resolve@^1.4.0, resolve@^1.5.0: version "1.22.2" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== @@ -10658,15 +10643,15 @@ schema-utils@^4.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.0.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2: - version "7.5.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" - integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ== +semver@^7.0.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0"