Skip to content

Commit 1233bee

Browse files
authored
chore: switch to eslint-plugin-node's maintained fork (#16150)
* chore: switch to eslint-plugin-n * fixup! fix linting errors
1 parent 97b95c0 commit 1233bee

File tree

9 files changed

+131
-90
lines changed

9 files changed

+131
-90
lines changed

.eslintrc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,23 @@ module.exports = {
122122
files: ["lib/*"],
123123
excludedFiles: ["lib/unsupported-api.js"],
124124
rules: {
125-
"node/no-restricted-require": ["error", [
125+
"n/no-restricted-require": ["error", [
126126
...createInternalFilesPatterns()
127127
]]
128128
}
129129
},
130130
{
131131
files: [INTERNAL_FILES.CLI_ENGINE_PATTERN],
132132
rules: {
133-
"node/no-restricted-require": ["error", [
133+
"n/no-restricted-require": ["error", [
134134
...createInternalFilesPatterns(INTERNAL_FILES.CLI_ENGINE_PATTERN)
135135
]]
136136
}
137137
},
138138
{
139139
files: [INTERNAL_FILES.LINTER_PATTERN],
140140
rules: {
141-
"node/no-restricted-require": ["error", [
141+
"n/no-restricted-require": ["error", [
142142
...createInternalFilesPatterns(INTERNAL_FILES.LINTER_PATTERN),
143143
"fs",
144144
resolveAbsolutePath("lib/cli-engine/index.js"),
@@ -149,7 +149,7 @@ module.exports = {
149149
{
150150
files: [INTERNAL_FILES.RULES_PATTERN],
151151
rules: {
152-
"node/no-restricted-require": ["error", [
152+
"n/no-restricted-require": ["error", [
153153
...createInternalFilesPatterns(INTERNAL_FILES.RULES_PATTERN),
154154
"fs",
155155
resolveAbsolutePath("lib/cli-engine/index.js"),
@@ -162,7 +162,7 @@ module.exports = {
162162
{
163163
files: ["lib/shared/**/*"],
164164
rules: {
165-
"node/no-restricted-require": ["error", [
165+
"n/no-restricted-require": ["error", [
166166
...createInternalFilesPatterns(),
167167
resolveAbsolutePath("lib/cli-engine/index.js"),
168168
resolveAbsolutePath("lib/linter/index.js"),
@@ -174,7 +174,7 @@ module.exports = {
174174
{
175175
files: [INTERNAL_FILES.SOURCE_CODE_PATTERN],
176176
rules: {
177-
"node/no-restricted-require": ["error", [
177+
"n/no-restricted-require": ["error", [
178178
...createInternalFilesPatterns(INTERNAL_FILES.SOURCE_CODE_PATTERN),
179179
"fs",
180180
resolveAbsolutePath("lib/cli-engine/index.js"),
@@ -187,7 +187,7 @@ module.exports = {
187187
{
188188
files: [INTERNAL_FILES.RULE_TESTER_PATTERN],
189189
rules: {
190-
"node/no-restricted-require": ["error", [
190+
"n/no-restricted-require": ["error", [
191191
...createInternalFilesPatterns(INTERNAL_FILES.RULE_TESTER_PATTERN),
192192
resolveAbsolutePath("lib/cli-engine/index.js")
193193
]]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"eslint-plugin-eslint-plugin": "^4.4.0",
106106
"eslint-plugin-internal-rules": "file:tools/internal-rules",
107107
"eslint-plugin-jsdoc": "^38.1.6",
108-
"eslint-plugin-node": "^11.1.0",
108+
"eslint-plugin-n": "^15.2.4",
109109
"eslint-plugin-unicorn": "^42.0.0",
110110
"eslint-release": "^3.2.0",
111111
"eslump": "^3.0.0",

packages/eslint-config-eslint/default.yml

Lines changed: 111 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
reportUnusedDisableDirectives: true
22
extends:
33
- "eslint:recommended"
4-
- "plugin:node/recommended"
4+
- "plugin:n/recommended"
55
- "plugin:jsdoc/recommended"
66
- "plugin:eslint-comments/recommended"
77
plugins:
@@ -14,34 +14,34 @@ settings:
1414
class: "constructor"
1515
preferredTypes:
1616
"*":
17-
message: "Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`"
18-
replacement: "any"
17+
message: "Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`"
18+
replacement: "any"
1919
Any:
20-
message: "Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`"
21-
replacement: "any"
20+
message: "Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`"
21+
replacement: "any"
2222
# Function:
2323
# message: "Point to a `@callback` namepath or `GenericCallback` if truly arbitrary in form"
2424
# replacement: "GenericCallback"
2525
# function:
2626
# message: "Point to a `@callback` namepath or `GenericCallback` if truly arbitrary in form"
2727
# replacement: "GenericCallback"
2828
function:
29-
message: "Point to a `@callback` namepath or `Function` if truly arbitrary in form"
30-
replacement: "Function"
29+
message: "Point to a `@callback` namepath or `Function` if truly arbitrary in form"
30+
replacement: "Function"
3131
Promise:
32-
message: "Specify the specific Promise type, including, if necessary, the type `any`"
32+
message: "Specify the specific Promise type, including, if necessary, the type `any`"
3333
".<>":
34-
message: "Prefer type form without dot"
35-
replacement: "<>"
34+
message: "Prefer type form without dot"
35+
replacement: "<>"
3636
# Object:
3737
# message: "Use the specific object type or `PlainObject` if truly arbitrary"
3838
# replacement: "PlainObject"
3939
# object:
4040
# message: "Use the specific object type or `PlainObject` if truly arbitrary"
4141
# replacement: "PlainObject"
4242
object:
43-
message: "Use the specific object type or `Object` if truly arbitrary"
44-
replacement: "Object"
43+
message: "Use the specific object type or `Object` if truly arbitrary"
44+
replacement: "Object"
4545
# Array:
4646
# message: "Use the specific array type or `GenericArray` if it is truly arbitrary."
4747
# replacement: "GenericArray"
@@ -56,7 +56,7 @@ rules:
5656
arrow-body-style: ["error", "as-needed"]
5757
arrow-parens: ["error", "as-needed"]
5858
arrow-spacing: "error"
59-
indent: ["error", 4, {SwitchCase: 1}]
59+
indent: ["error", 4, { SwitchCase: 1 }]
6060
block-spacing: "error"
6161
brace-style: ["error", "1tbs"]
6262
camelcase: "error"
@@ -101,9 +101,21 @@ rules:
101101
jsdoc/require-description: ["error", { checkConstructors: false }]
102102
# jsdoc/require-file-overview: "error"
103103
jsdoc/require-hyphen-before-param-description: ["error", "never"]
104-
jsdoc/require-returns: ["error", { forceRequireReturn: true, forceReturnsWithAsync: true }]
104+
jsdoc/require-returns:
105+
["error", { forceRequireReturn: true, forceReturnsWithAsync: true }]
105106
jsdoc/require-throws: "error"
106-
jsdoc/tag-lines: ["error", "never", { tags: { example: { lines: "always" }, fileoverview: { lines: "any" } } }]
107+
jsdoc/tag-lines:
108+
[
109+
"error",
110+
"never",
111+
{
112+
tags:
113+
{
114+
example: { lines: "always" },
115+
fileoverview: { lines: "any" },
116+
},
117+
},
118+
]
107119

108120
# jsdoc: disable recommended rules
109121
jsdoc/no-undefined-types: "off"
@@ -120,7 +132,7 @@ rules:
120132
jsdoc/implements-on-classes: "error"
121133
jsdoc/multiline-blocks: "error"
122134
jsdoc/no-multi-asterisks: "error"
123-
jsdoc/require-jsdoc: ["error", { require: {ClassDeclaration: true} }]
135+
jsdoc/require-jsdoc: ["error", { require: { ClassDeclaration: true } }]
124136
jsdoc/require-param: "error"
125137
jsdoc/require-param-description: "error"
126138
jsdoc/require-param-name: "error"
@@ -137,19 +149,28 @@ rules:
137149

138150
key-spacing: ["error", { beforeColon: false, afterColon: true }]
139151
keyword-spacing: "error"
140-
lines-around-comment: ["error", {
141-
beforeBlockComment: true,
142-
afterBlockComment: false,
143-
beforeLineComment: true,
144-
afterLineComment: false
145-
}]
146-
max-len: ["error", 160, {
147-
"ignoreComments": true,
148-
"ignoreUrls": true,
149-
"ignoreStrings": true,
150-
"ignoreTemplateLiterals": true,
151-
"ignoreRegExpLiterals": true
152-
}]
152+
lines-around-comment:
153+
[
154+
"error",
155+
{
156+
beforeBlockComment: true,
157+
afterBlockComment: false,
158+
beforeLineComment: true,
159+
afterLineComment: false,
160+
},
161+
]
162+
max-len:
163+
[
164+
"error",
165+
160,
166+
{
167+
"ignoreComments": true,
168+
"ignoreUrls": true,
169+
"ignoreStrings": true,
170+
"ignoreTemplateLiterals": true,
171+
"ignoreRegExpLiterals": true,
172+
},
173+
]
153174
max-statements-per-line: "error"
154175
new-cap: "error"
155176
new-parens: "error"
@@ -175,7 +196,7 @@ rules:
175196
no-mixed-spaces-and-tabs: ["error", false] # Modified from recommended
176197
no-multi-spaces: "error"
177198
no-multi-str: "error"
178-
no-multiple-empty-lines: ["error", {max: 2, maxBOF: 0, maxEOF: 0}]
199+
no-multiple-empty-lines: ["error", { max: 2, maxBOF: 0, maxEOF: 0 }]
179200
no-nested-ternary: "error"
180201
no-new: "error"
181202
no-new-func: "error"
@@ -185,15 +206,35 @@ rules:
185206
no-param-reassign: "error"
186207
no-proto: "error"
187208
no-process-exit: "off"
188-
no-restricted-properties: [
189-
"error",
190-
{ property: "substring", message: "Use .slice instead of .substring." },
191-
{ property: "substr", message: "Use .slice instead of .substr." },
192-
{ object: "assert", property: "equal", message: "Use assert.strictEqual instead of assert.equal." },
193-
{ object: "assert", property: "notEqual", message: "Use assert.notStrictEqual instead of assert.notEqual." },
194-
{ object: "assert", property: "deepEqual", message: "Use assert.deepStrictEqual instead of assert.deepEqual." },
195-
{ object: "assert", property: "notDeepEqual", message: "Use assert.notDeepStrictEqual instead of assert.notDeepEqual." }
196-
]
209+
no-restricted-properties:
210+
[
211+
"error",
212+
{
213+
property: "substring",
214+
message: "Use .slice instead of .substring.",
215+
},
216+
{ property: "substr", message: "Use .slice instead of .substr." },
217+
{
218+
object: "assert",
219+
property: "equal",
220+
message: "Use assert.strictEqual instead of assert.equal.",
221+
},
222+
{
223+
object: "assert",
224+
property: "notEqual",
225+
message: "Use assert.notStrictEqual instead of assert.notEqual.",
226+
},
227+
{
228+
object: "assert",
229+
property: "deepEqual",
230+
message: "Use assert.deepStrictEqual instead of assert.deepEqual.",
231+
},
232+
{
233+
object: "assert",
234+
property: "notDeepEqual",
235+
message: "Use assert.notDeepStrictEqual instead of assert.notDeepEqual.",
236+
},
237+
]
197238
no-return-assign: "error"
198239
no-script-url: "error"
199240
no-self-compare: "error"
@@ -202,15 +243,18 @@ rules:
202243
no-tabs: "error"
203244
no-throw-literal: "error"
204245
no-trailing-spaces: "error"
205-
no-undef: ["error", {typeof: true}] # Modified from recommended
246+
no-undef: ["error", { typeof: true }] # Modified from recommended
206247
no-undef-init: "error"
207248
no-undefined: "error"
208-
no-underscore-dangle: ["error", {allowAfterThis: true}]
249+
no-underscore-dangle: ["error", { allowAfterThis: true }]
209250
no-unmodified-loop-condition: "error"
210251
no-unneeded-ternary: "error"
211252
no-unreachable-loop: "error"
212253
no-unused-expressions: "error"
213-
no-unused-vars: ["error", {vars: "all", args: "after-used", caughtErrors: "all"}] # Modified from recommended
254+
no-unused-vars: [
255+
"error",
256+
{ vars: "all", args: "after-used", caughtErrors: "all" },
257+
] # Modified from recommended
214258
no-use-before-define: "error"
215259
no-useless-call: "error"
216260
no-useless-computed-key: "error"
@@ -221,12 +265,12 @@ rules:
221265
no-whitespace-before-property: "error"
222266
no-var: "error"
223267

224-
node/callback-return: ["error", ["cb", "callback", "next"]]
225-
node/handle-callback-err: ["error", "err"]
226-
node/no-deprecated-api: "error"
227-
node/no-mixed-requires: "error"
228-
node/no-new-require: "error"
229-
node/no-path-concat: "error"
268+
n/callback-return: ["error", ["cb", "callback", "next"]]
269+
n/handle-callback-err: ["error", "err"]
270+
n/no-deprecated-api: "error"
271+
n/no-mixed-requires: "error"
272+
n/no-new-require: "error"
273+
n/no-path-concat: "error"
230274

231275
object-curly-newline: ["error", { "consistent": true, "multiline": true }]
232276
object-curly-spacing: ["error", "always"]
@@ -235,19 +279,16 @@ rules:
235279
one-var-declaration-per-line: "error"
236280
operator-assignment: "error"
237281
operator-linebreak: "error"
238-
padding-line-between-statements: [
239-
"error",
240-
{
241-
blankLine: "always",
242-
prev: ["const", "let", "var"],
243-
next: "*"
244-
},
245-
{
246-
blankLine: "any",
247-
prev: ["const", "let", "var"],
248-
next: ["const", "let", "var"]
249-
}
250-
]
282+
padding-line-between-statements:
283+
[
284+
"error",
285+
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
286+
{
287+
blankLine: "any",
288+
prev: ["const", "let", "var"],
289+
next: ["const", "let", "var"],
290+
},
291+
]
251292
prefer-arrow-callback: "error"
252293
prefer-const: "error"
253294
prefer-exponentiation-operator: "error"
@@ -257,24 +298,24 @@ rules:
257298
prefer-rest-params: "error"
258299
prefer-spread: "error"
259300
prefer-template: "error"
260-
quotes: ["error", "double", {avoidEscape: true}]
301+
quotes: ["error", "double", { avoidEscape: true }]
261302
quote-props: ["error", "as-needed"]
262303
radix: "error"
263304
require-unicode-regexp: "error"
264305
rest-spread-spacing: "error"
265306
semi: "error"
266-
semi-spacing: ["error", {before: false, after: true}]
307+
semi-spacing: ["error", { before: false, after: true }]
267308
semi-style: "error"
268309
space-before-blocks: "error"
269-
space-before-function-paren: ["error", {
270-
"anonymous": "never",
271-
"named": "never",
272-
"asyncArrow": "always"
273-
}]
310+
space-before-function-paren:
311+
[
312+
"error",
313+
{ "anonymous": "never", "named": "never", "asyncArrow": "always" },
314+
]
274315
space-in-parens: "error"
275316
space-infix-ops: "error"
276-
space-unary-ops: ["error", {words: true, nonwords: false}]
277-
spaced-comment: ["error", "always", { exceptions: ["-"]}]
317+
space-unary-ops: ["error", { words: true, nonwords: false }]
318+
spaced-comment: ["error", "always", { exceptions: ["-"] }]
278319
strict: ["error", "global"]
279320
switch-colon-spacing: "error"
280321
symbol-description: "error"

packages/eslint-config-eslint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"peerDependencies": {
2323
"eslint-plugin-eslint-comments": ">=3.2.0",
2424
"eslint-plugin-jsdoc": ">=38.1.6",
25-
"eslint-plugin-node": ">=11.1.0",
25+
"eslint-plugin-n": ">=15.2.4",
2626
"eslint-plugin-unicorn": ">=42.0.0"
2727
},
2828
"keywords": [

tests/_utils/test-lazy-loading-rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ addHook(
6262
await eslint.lintFiles([pattern]);
6363
})().catch(({ message, stack }) => {
6464
process.send({ message, stack });
65-
process.exit(1);
65+
process.exit(1); // eslint-disable-line n/no-process-exit -- this is a child process
6666
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy