From df03ffeb07bc1581d8e4bb391d40e7341330302f Mon Sep 17 00:00:00 2001 From: ehmicky Date: Fri, 1 Apr 2022 17:52:14 +0200 Subject: [PATCH] fix!: use `eslint-plugin-n` instead of `eslint-plugin-node` (#482) --- .eslintrc.cjs | 56 ++++++++-------- package-lock.json | 163 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- 3 files changed, 189 insertions(+), 32 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d226a384..70245f18 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -12,7 +12,7 @@ module.exports = { 'standard', 'prettier', 'plugin:eslint-comments/recommended', - 'plugin:node/recommended', + 'plugin:n/recommended', 'plugin:import/recommended', 'plugin:promise/recommended', 'plugin:ava/recommended', @@ -171,33 +171,33 @@ module.exports = { }, ], - 'node/no-sync': 2, - 'node/callback-return': 2, - 'node/exports-style': 2, - 'node/global-require': 2, - 'node/no-mixed-requires': 2, + 'n/no-sync': 2, + 'n/callback-return': 2, + 'n/exports-style': 2, + 'n/global-require': 2, + 'n/no-mixed-requires': 2, // Using path.join() is often not needed when using only core Node.js APIs - 'node/no-path-concat': 0, + 'n/no-path-concat': 0, // TODO: remove once bug in eslint-plugin-node is fixed: // https://github.com/mysticatea/eslint-plugin-node/issues/250 - 'node/no-unsupported-features/es-syntax': [ + 'n/no-unsupported-features/es-syntax': [ 2, { ignores: ['modules', 'dynamicImport'], }, ], // Browser globals should not use `require()`. Non-browser globals should - 'node/prefer-global/console': 2, - 'node/prefer-global/buffer': [2, 'never'], - 'node/prefer-global/process': [2, 'never'], - 'node/prefer-global/url-search-params': 2, - 'node/prefer-global/url': 2, - 'node/prefer-global/text-decoder': 2, - 'node/prefer-global/text-encoder': 2, - 'node/prefer-promises/fs': 2, - 'node/prefer-promises/dns': 2, + 'n/prefer-global/console': 2, + 'n/prefer-global/buffer': [2, 'never'], + 'n/prefer-global/process': [2, 'never'], + 'n/prefer-global/url-search-params': 2, + 'n/prefer-global/url': 2, + 'n/prefer-global/text-decoder': 2, + 'n/prefer-global/text-encoder': 2, + 'n/prefer-promises/fs': 2, + 'n/prefer-promises/dns': 2, // This does not work well in a monorepo - 'node/shebang': 0, + 'n/shebang': 0, 'promise/no-callback-in-promise': 2, 'promise/no-nesting': 2, @@ -330,8 +330,8 @@ module.exports = { files: ['**/tests.{cjs,mjs,js}', '**/tests/**/*.{cjs,mjs,js}'], rules: { 'max-lines': 0, - 'node/no-unpublished-require': 0, - 'node/no-missing-require': 0, + 'n/no-unpublished-require': 0, + 'n/no-missing-require': 0, 'unicorn/no-process-exit': 0, 'fp/no-mutating-methods': 0, 'fp/no-mutation': 0, @@ -343,13 +343,13 @@ module.exports = { rules: { 'max-lines': 0, 'no-magic-numbers': 0, - 'node/no-unpublished-require': 0, + 'n/no-unpublished-require': 0, }, }, { files: ['scripts/**/*.{cjs,mjs,js}'], rules: { - 'node/no-unpublished-require': 0, + 'n/no-unpublished-require': 0, }, }, { @@ -368,16 +368,16 @@ module.exports = { strict: 0, 'import/no-unresolved': 0, - 'node/no-missing-require': 0, - 'node/no-missing-import': 0, + 'n/no-missing-require': 0, + 'n/no-missing-import': 0, // code blocks in markdown files have autogenerated file names 'unicorn/filename-case': 0, // Documentation might import dependencies not in package.json - 'node/no-unpublished-require': 0, - 'node/no-extraneous-require': 0, - 'node/no-extraneous-import': 0, + 'n/no-unpublished-require': 0, + 'n/no-extraneous-require': 0, + 'n/no-extraneous-import': 0, 'import/no-extraneous-dependencies': 0, }, }, @@ -401,7 +401,7 @@ module.exports = { browser: true, }, rules: { - 'node/no-unsupported-features/es-syntax': 0, + 'n/no-unsupported-features/es-syntax': 0, 'unicorn/filename-case': 0, 'unicorn/import-index': 0, }, diff --git a/package-lock.json b/package-lock.json index 9a2d0339..88f49f46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "eslint-plugin-html": "^6.1.0", "eslint-plugin-import": "^2.25.1", "eslint-plugin-markdown": "^2.0.0", - "eslint-plugin-node": "^11.1.0", + "eslint-plugin-n": "^15.1.0", "eslint-plugin-promise": "^5.2.0", "eslint-plugin-react": "^7.21.5", "eslint-plugin-unicorn": "^40.0.0", @@ -1673,6 +1673,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/builtins": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-4.1.0.tgz", + "integrity": "sha512-1bPRZQtmKaO6h7qV1YHXNtr6nCK28k0Zo95KM4dXfILcZZwoHJBN1m3lfLv9LPkcOZlrSr+J1bzMaZFO98Yq0w==", + "dependencies": { + "semver": "^7.0.0" + } + }, + "node_modules/builtins/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -2804,6 +2826,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "peer": true, "dependencies": { "eslint-utils": "^2.0.0", "regexpp": "^3.0.0" @@ -2822,6 +2845,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "peer": true, "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -2836,6 +2860,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "peer": true, "engines": { "node": ">=4" } @@ -2947,10 +2972,75 @@ "eslint": ">=6.0.0" } }, + "node_modules/eslint-plugin-n": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.1.0.tgz", + "integrity": "sha512-Tgx4Z58QXv2Ha7Qzp0u4wavnZNZ3AOievZMxrAxi7nvDbzD5B/JqOD80LHYcGHFZc2HD9jDmM/+KWMPov46a4A==", + "dependencies": { + "builtins": "^4.0.0", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.3.0", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-n/node_modules/eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-n/node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-n/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "peer": true, "dependencies": { "eslint-plugin-es": "^3.0.0", "eslint-utils": "^2.0.0", @@ -2970,6 +3060,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "peer": true, "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -2984,6 +3075,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "peer": true, "engines": { "node": ">=4" } @@ -8028,6 +8120,24 @@ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==" }, + "builtins": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-4.1.0.tgz", + "integrity": "sha512-1bPRZQtmKaO6h7qV1YHXNtr6nCK28k0Zo95KM4dXfILcZZwoHJBN1m3lfLv9LPkcOZlrSr+J1bzMaZFO98Yq0w==", + "requires": { + "semver": "^7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -8939,6 +9049,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "peer": true, "requires": { "eslint-utils": "^2.0.0", "regexpp": "^3.0.0" @@ -8948,6 +9059,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "peer": true, "requires": { "eslint-visitor-keys": "^1.1.0" } @@ -8955,7 +9067,8 @@ "eslint-visitor-keys": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "peer": true } } }, @@ -9038,10 +9151,52 @@ "mdast-util-from-markdown": "^0.8.5" } }, + "eslint-plugin-n": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.1.0.tgz", + "integrity": "sha512-Tgx4Z58QXv2Ha7Qzp0u4wavnZNZ3AOievZMxrAxi7nvDbzD5B/JqOD80LHYcGHFZc2HD9jDmM/+KWMPov46a4A==", + "requires": { + "builtins": "^4.0.0", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", + "ignore": "^5.1.1", + "is-core-module": "^2.3.0", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.3.0" + }, + "dependencies": { + "eslint-plugin-es": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + } + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" + } + } + }, "eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "peer": true, "requires": { "eslint-plugin-es": "^3.0.0", "eslint-utils": "^2.0.0", @@ -9055,6 +9210,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "peer": true, "requires": { "eslint-visitor-keys": "^1.1.0" } @@ -9062,7 +9218,8 @@ "eslint-visitor-keys": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "peer": true } } }, diff --git a/package.json b/package.json index 1d909c54..33363a2b 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "eslint-plugin-html": "^6.1.0", "eslint-plugin-import": "^2.25.1", "eslint-plugin-markdown": "^2.0.0", - "eslint-plugin-node": "^11.1.0", + "eslint-plugin-n": "^15.1.0", "eslint-plugin-promise": "^5.2.0", "eslint-plugin-react": "^7.21.5", "eslint-plugin-unicorn": "^40.0.0",