Skip to content
This repository was archived by the owner on Feb 9, 2025. It is now read-only.

Commit f0d0521

Browse files
authored
feat: Replace deprecated eslint-plugin-node with eslint-plugin-n (#119)
eslint-plugin-node is deprecated now. BREAKING CHANGE: Since we switched from eslint-plugin-node to eslint-plugin-n, this may introduce new ESLint errors in Node projects.
1 parent 4c5b1fd commit f0d0521

File tree

5 files changed

+282
-29
lines changed

5 files changed

+282
-29
lines changed

README.md

+3-14
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ npm i eslint eslint-config-peerigon eslint-plugin-react eslint-plugin-jsx-a11y e
8888
### TypeScript + Node
8989

9090
```
91-
npm i eslint eslint-config-peerigon eslint-plugin-node --save-dev
91+
npm i eslint eslint-config-peerigon eslint-plugin-n --save-dev
9292
```
9393

9494
```js
@@ -249,10 +249,10 @@ _We recommend using [`peerigon/styles/prefer-arrow`](#peerigonstylesprefer-arrow
249249

250250
### [`peerigon/node`](node.js)
251251

252-
**Important: Requires [`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node).**
252+
**Important: Requires [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n).**
253253

254254
```
255-
npm i eslint-plugin-node --save-dev
255+
npm i eslint-plugin-n --save-dev
256256
```
257257

258258
```js
@@ -266,17 +266,6 @@ npm i eslint-plugin-node --save-dev
266266
}
267267
```
268268

269-
[`eslint-plugin-node`](https://github.com/mysticatea/eslint-plugin-node) uses the ["engines" field](https://docs.npmjs.com/files/package.json#engines) and the ["type" field](https://nodejs.org/api/esm.html#esm_enabling) in your `package.json` to check for compatibility issues. We recommend the following configuration:
270-
271-
```json
272-
{
273-
"type": "module",
274-
"engines": {
275-
"node": ">=14.0.0"
276-
}
277-
}
278-
```
279-
280269
### [`peerigon/react`](react.js)
281270

282271
**Important: Requires [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react), [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y) and [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) as project dependency.**

node.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module.exports = {
55
plugins: ["node"],
6-
extends: ["plugin:node/recommended"],
6+
extends: ["plugin:n/recommended"],
77
env: {
88
node: true,
99
},
@@ -14,25 +14,25 @@ module.exports = {
1414
},
1515
rules: {
1616
/* eslint-enable sort-keys */
17-
"node/callback-return": "warn", // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/callback-return.md
18-
"node/global-require": "off", // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/global-require.md
19-
"node/handle-callback-err": ["warn", "^(err|error)$"], // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/handle-callback-err
20-
"node/no-mixed-requires": [
17+
"n/callback-return": "warn", // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md
18+
"n/global-require": "off", // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
19+
"n/handle-callback-err": ["warn", "^(err|error)$"], // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/handle-callback-err
20+
"n/no-mixed-requires": [
2121
"warn",
2222
{
2323
allowCall: true,
2424
grouping: false,
2525
},
26-
], // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-mixed-requires.md
27-
"node/no-new-require": "warn", // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-new-require.md
28-
"node/no-path-concat": "warn", // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-path-concat.md
26+
], // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md
27+
"n/no-new-require": "warn", // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
28+
"n/no-path-concat": "warn", // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
2929
// process.exit() is often used in situations where it would have been better to either throw an error or
3030
// let the process exit by itself.
3131
// There are situations where process.exit() is the cause of truncated stdout output,
3232
// see https://nodejs.org/api/process.html#process_process_exit_code
3333
// If you want to set the exit code, you can also use process.exitCode.
3434
// Disable this rule if you have to exit the process forcefully and you know what you're doing.
35-
"node/no-process-exit": "warn", // https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-exit.md
35+
"n/no-process-exit": "warn", // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
3636
/* eslint-disable sort-keys */
3737
},
3838
};

0 commit comments

Comments
 (0)