Skip to content

Commit

Permalink
Switch from eslint-plugin-node to eslint-plugin-n
Browse files Browse the repository at this point in the history
The `eslint-plugin-node` project appears to be unmaintained.
  • Loading branch information
rhansen committed Mar 24, 2022
1 parent 6b80f9c commit 3e07dbb
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 48 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Etherpad plugins so that your code stays consistent with the Etherpad codebase.
```
3. If you `require('ep_etherpad-lite/*')` anywhere in your server-side code, add
a peer dependency to your `package.json` so that the `node` ESLint plugin
won't complain about unavailable modules:
a peer dependency to your `package.json` so that the `n` ESLint plugin (for
Node.js) won't complain about unavailable modules:

```json
"peerDependencies": {
Expand Down Expand Up @@ -79,7 +79,8 @@ Etherpad plugins so that your code stays consistent with the Etherpad codebase.
5. *Optional but recommended:* Specify the minimum version of Node.js you
support (ideally this would match [Etherpad's minimum required
version](https://github.com/ether/etherpad-lite#requirements)) so that the
`node` ESLint plugin can warn you when you use incompatible features:
`n` ESLint plugin (for Node.js) can warn you when you use incompatible
features:
```json
"engines": {
Expand Down
10 changes: 5 additions & 5 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

module.exports = {
plugins: [
'node',
'n',
],
extends: [
'./index.js',
'plugin:node/recommended',
'plugin:n/recommended',
],
parserOptions: {
// Set to at least 2020 to enable support for dynamic import(). This only affects how the code
// is parsed -- it does not affect what features rules will allow.
ecmaVersion: 2020,
},
settings: {
node: {
n: {
tryExtensions: ['.js', '.cjs', '.mjs', '.json', '.node'],
},
},
Expand All @@ -28,13 +28,13 @@ module.exports = {
{
files: ['.eslintrc.*'],
rules: {
'node/no-unpublished-require': 'off',
'n/no-unpublished-require': 'off',
},
},
{
files: ['.ts', '.tsx', '.cts', '.mts'].map((p) => [`*${p}`, `.*${p}`]).flat(),
settings: {
node: {
n: {
tryExtensions: ['.js', '.cjs', '.mjs', '.ts', '.cts', '.mts', '.json', '.node'],
},
},
Expand Down
69 changes: 33 additions & 36 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 @@ -37,7 +37,7 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-mocha": "^10.0.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-n": "^15.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0"
Expand Down
2 changes: 1 addition & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const commonNodeOverrides = {
rules: {
'node/no-missing-require': ['error', {
'n/no-missing-require': ['error', {
allowModules: [
// Disable the node/no-missing-require rule for `require('ep_etherpad-lite/foo')`. It would
// be nice to warn plugin devs that their plugin is requiring a core Etherpad module that
Expand Down
2 changes: 1 addition & 1 deletion tests/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
'../tests.js',
],
rules: {
'node/no-unpublished-require': 'off', // It's OK for tests to use devDependencies.
'n/no-unpublished-require': 'off', // It's OK for tests to use devDependencies.
},
};
2 changes: 1 addition & 1 deletion tests/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
'mocha/no-mocha-arrows': 'off',
'mocha/no-synchronous-tests': 'off',
'mocha/prefer-arrow-callback': 'off',
'node/no-unpublished-require': 'off', // It's OK for tests to use devDependencies.
'n/no-unpublished-require': 'off', // It's OK for tests to use devDependencies.
'prefer-arrow-callback': 'error',
'prefer-arrow/prefer-arrow-functions': 'error',
},
Expand Down

0 comments on commit 3e07dbb

Please sign in to comment.