Skip to content

Commit

Permalink
Switch to eslint-plugin-n (#71)
Browse files Browse the repository at this point in the history
The original `eslint-plugin-node` does not seem to be maintained
anymore. This switches to the fork
[eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n).
  • Loading branch information
smaye81 authored Nov 20, 2023
1 parent c171ecc commit 3c64443
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 90 deletions.
44 changes: 16 additions & 28 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
root: true,
ignorePatterns: ["packages/*/dist/**"],
plugins: ["@typescript-eslint", "node", "import"],
plugins: ["@typescript-eslint", "n", "import"],
// Rules and settings that do not require a non-default parser
extends: ["eslint:recommended"],
rules: {
Expand Down Expand Up @@ -49,35 +49,23 @@ module.exports = {
{
files: ["**/*.{js,mjs,cjs}"],
parserOptions: {
ecmaVersion: 2020,
ecmaVersion: 13, // ES2022 - https://eslint.org/docs/latest/use/configure/language-options#specifying-environments
},
extends: ["eslint:recommended", "plugin:node/recommended"],
extends: ["eslint:recommended", "plugin:n/recommended"],
rules: {
"node/shebang": "off", // this plugin only determines shebang necessary for files that are in a package.json "bin" field
"node/exports-style": ["error", "module.exports"],
"node/file-extension-in-import": ["error", "always"],
"node/prefer-global/buffer": ["error", "always"],
"node/prefer-global/console": ["error", "always"],
"node/prefer-global/process": ["error", "always"],
"node/prefer-global/url-search-params": ["error", "always"],
"node/prefer-global/url": ["error", "always"],
"node/prefer-promises/dns": "error",
"node/prefer-promises/fs": "error",
"no-process-exit": "off",
"node/no-unsupported-features/es-builtins": [
"error",
{
version: ">=16.0.0",
ignores: [],
},
],
"node/no-unsupported-features/node-builtins": [
"error",
{
version: ">=16.0.0",
ignores: [],
},
],
"n/shebang": "off", // this rule reports _any_ shebang outside of an npm binary as an error
"n/prefer-global/process": "off",
"n/no-process-exit": "off",
"n/exports-style": ["error", "module.exports"],
"n/file-extension-in-import": ["error", "always"],
"n/prefer-global/buffer": ["error", "always"],
"n/prefer-global/console": ["error", "always"],
"n/prefer-global/url-search-params": ["error", "always"],
"n/prefer-global/url": ["error", "always"],
"n/prefer-promises/dns": "error",
"n/prefer-promises/fs": "error",
"n/no-unsupported-features/node-builtins": "error",
"n/no-unsupported-features/es-syntax": "error",
},
},
],
Expand Down
117 changes: 56 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"eslint": "^8.52.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-n": "^16.3.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
Expand Down

0 comments on commit 3c64443

Please sign in to comment.