From 572d4c5a209ea6d75f3e96c8699d98a36092877a Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 2 Jul 2022 19:58:14 -0600 Subject: [PATCH] Use eslint-plugin-n instead of eslint-plugin-node Since eslint-plugin-node has been dormant for quite a while: https://github.com/mysticatea/eslint-plugin-node/issues/294 https://github.com/mysticatea/eslint-plugin-node/issues/300 eslint-plugin-n is an actively maintained fork which is used by xo: https://github.com/xojs/xo/pull/660 switch to that fork. Signed-off-by: Kevin Locke --- node.js | 6 +++--- package.json | 4 ++-- rules/{node.js => n.js} | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) rename rules/{node.js => n.js} (51%) diff --git a/node.js b/node.js index 362b17b..0ba71bf 100644 --- a/node.js +++ b/node.js @@ -8,7 +8,7 @@ const { "rules": { "no-restricted-properties": noRestrictedProps } } = require("./rules/best-practices.js"); const { "configs": { "recommended": { "parserOptions": { sourceType } } } } = - requirePeer("eslint-plugin-node"); + requirePeer("eslint-plugin-n"); module.exports = { // Based on Airbnb with changes to match Node core and my prefs. @@ -30,7 +30,7 @@ module.exports = { // extend node plugin last because it sets parserOptions based on type // field from nearest ancestor package.json to process.cwd(). - "./rules/node" + "./rules/n" ], "parserOptions": { @@ -39,7 +39,7 @@ module.exports = { "ecmaFeatures": { "generators": true }, - // It would be preferable to use the version set by eslint-plugin-node + // It would be preferable to use the version set by eslint-plugin-n // (determined based on package.json#engines/node). Unfortunately, it // currently sets ecmaVersion: 2019 unconditionally, which lacks support // for widely used language features (e.g. import() and import.meta). diff --git a/package.json b/package.json index d9573ec..6726e4b 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "peerDependencies": { "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-jsdoc": "^39.0.0", - "eslint-plugin-node": "^11.0.0", + "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-unicorn": "^43.0.0" }, @@ -68,7 +68,7 @@ "eslint-find-rules": "^4.0.0", "eslint-plugin-import": "^2.25.3", "eslint-plugin-jsdoc": "^39.0.0", - "eslint-plugin-node": "^11.0.0", + "eslint-plugin-n": "^15.0.0", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-unicorn": "^43.0.0", "peer-version-check": "^0.1.0" diff --git a/rules/node.js b/rules/n.js similarity index 51% rename from rules/node.js rename to rules/n.js index 667c48c..f4c4338 100644 --- a/rules/node.js +++ b/rules/n.js @@ -1,16 +1,16 @@ -// ESLint common configuration rules for Node plugin -// https://github.com/mysticatea/eslint-plugin-node#-rules +// ESLint common configuration rules for N plugin +// https://github.com/weiran-zsd/eslint-plugin-node#-rules "use strict"; module.exports = { "extends": [ - "plugin:node/recommended" + "plugin:n/recommended" ], "rules": { // require file extensions in import declarations // https://nodejs.org/api/esm.html#esm_mandatory_file_extensions - "node/file-extension-in-import": "error" + "n/file-extension-in-import": "error" } };