Skip to content

Commit 347d44f

Browse files
authoredApr 27, 2024··
chore: remove eslintrc export from eslint-config-eslint (#18400)
* chore: remove eslintrc export from eslint-config-eslint * updates to make the project lint-free when .eslintrc.js is used * try to fix knip error * ignore knip error * remove eslint plugins from knip ignore
1 parent 8485d76 commit 347d44f

File tree

5 files changed

+468
-478
lines changed

5 files changed

+468
-478
lines changed
 

‎.eslintrc.js

+459-6
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,461 @@ function createInternalFilesPatterns(pattern = null) {
5757

5858
module.exports = {
5959
root: true,
60+
reportUnusedDisableDirectives: true,
6061
plugins: [
6162
"eslint-plugin",
62-
"internal-rules"
63+
"internal-rules",
64+
"unicorn"
6365
],
6466
extends: [
65-
"eslint/eslintrc"
67+
"eslint:recommended",
68+
"plugin:n/recommended",
69+
"plugin:jsdoc/recommended",
70+
"plugin:@eslint-community/eslint-comments/recommended"
6671
],
72+
settings: {
73+
jsdoc: {
74+
mode: "typescript",
75+
tagNamePreference: {
76+
file: "fileoverview",
77+
augments: "extends",
78+
class: "constructor"
79+
},
80+
preferredTypes: {
81+
"*": {
82+
message:
83+
"Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`",
84+
replacement: "any"
85+
},
86+
Any: {
87+
message:
88+
"Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`",
89+
replacement: "any"
90+
},
91+
function: {
92+
message:
93+
"Point to a `@callback` namepath or `Function` if truly arbitrary in form",
94+
replacement: "Function"
95+
},
96+
Promise: {
97+
message:
98+
"Specify the specific Promise type, including, if necessary, the type `any`"
99+
},
100+
".<>": {
101+
message: "Prefer type form without dot",
102+
replacement: "<>"
103+
},
104+
object: {
105+
message:
106+
"Use the specific object type or `Object` if truly arbitrary",
107+
replacement: "Object"
108+
},
109+
array: "Array"
110+
}
111+
}
112+
},
67113
parserOptions: {
68-
ecmaVersion: 2021
114+
ecmaVersion: "latest"
69115
},
70116
rules: {
71-
"internal-rules/multiline-comment-style": "error"
117+
"internal-rules/multiline-comment-style": "error",
118+
"array-bracket-spacing": "error",
119+
"array-callback-return": "error",
120+
"arrow-body-style": ["error", "as-needed"],
121+
"arrow-parens": ["error", "as-needed"],
122+
"arrow-spacing": "error",
123+
indent: [
124+
"error",
125+
4,
126+
{
127+
SwitchCase: 1
128+
}
129+
],
130+
"block-spacing": "error",
131+
"brace-style": ["error", "1tbs"],
132+
camelcase: "error",
133+
"class-methods-use-this": "error",
134+
"comma-dangle": "error",
135+
"comma-spacing": "error",
136+
"comma-style": ["error", "last"],
137+
"computed-property-spacing": "error",
138+
"consistent-return": "error",
139+
curly: ["error", "all"],
140+
"default-case": "error",
141+
"default-case-last": "error",
142+
"default-param-last": "error",
143+
"dot-location": ["error", "property"],
144+
"dot-notation": [
145+
"error",
146+
{
147+
allowKeywords: true
148+
}
149+
],
150+
"eol-last": "error",
151+
eqeqeq: "error",
152+
"@eslint-community/eslint-comments/disable-enable-pair": ["error"],
153+
"@eslint-community/eslint-comments/no-unused-disable": "error",
154+
"@eslint-community/eslint-comments/require-description": "error",
155+
"func-call-spacing": "error",
156+
"func-style": ["error", "declaration"],
157+
"function-call-argument-newline": ["error", "consistent"],
158+
"function-paren-newline": ["error", "consistent"],
159+
"generator-star-spacing": "error",
160+
"grouped-accessor-pairs": "error",
161+
"guard-for-in": "error",
162+
"jsdoc/check-syntax": "error",
163+
"jsdoc/check-values": [
164+
"error",
165+
{
166+
allowedLicenses: true
167+
}
168+
],
169+
"jsdoc/no-bad-blocks": "error",
170+
"jsdoc/no-defaults": "off",
171+
"jsdoc/require-asterisk-prefix": "error",
172+
"jsdoc/require-description": [
173+
"error",
174+
{
175+
checkConstructors: false
176+
}
177+
],
178+
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
179+
"jsdoc/require-returns": [
180+
"error",
181+
{
182+
forceRequireReturn: true,
183+
forceReturnsWithAsync: true
184+
}
185+
],
186+
"jsdoc/require-throws": "error",
187+
"jsdoc/tag-lines": [
188+
"error",
189+
"never",
190+
{
191+
tags: {
192+
example: {
193+
lines: "always"
194+
},
195+
fileoverview: {
196+
lines: "any"
197+
}
198+
},
199+
startLines: 0
200+
}
201+
202+
],
203+
"jsdoc/no-undefined-types": "off",
204+
"jsdoc/require-yields": "off",
205+
"jsdoc/check-access": "error",
206+
"jsdoc/check-alignment": "error",
207+
"jsdoc/check-param-names": "error",
208+
"jsdoc/check-property-names": "error",
209+
"jsdoc/check-tag-names": "error",
210+
"jsdoc/check-types": "error",
211+
"jsdoc/empty-tags": "error",
212+
"jsdoc/implements-on-classes": "error",
213+
"jsdoc/multiline-blocks": "error",
214+
"jsdoc/no-multi-asterisks": ["error", { allowWhitespace: true }],
215+
"jsdoc/require-jsdoc": [
216+
"error",
217+
{
218+
require: {
219+
ClassDeclaration: true
220+
}
221+
}
222+
],
223+
"jsdoc/require-param": "error",
224+
"jsdoc/require-param-description": "error",
225+
"jsdoc/require-param-name": "error",
226+
"jsdoc/require-param-type": "error",
227+
"jsdoc/require-property": "error",
228+
"jsdoc/require-property-description": "error",
229+
"jsdoc/require-property-name": "error",
230+
"jsdoc/require-property-type": "error",
231+
"jsdoc/require-returns-check": "error",
232+
"jsdoc/require-returns-description": "error",
233+
"jsdoc/require-returns-type": "error",
234+
"jsdoc/require-yields-check": "error",
235+
"jsdoc/valid-types": "error",
236+
"key-spacing": [
237+
"error",
238+
{
239+
beforeColon: false,
240+
afterColon: true
241+
}
242+
],
243+
"keyword-spacing": "error",
244+
"lines-around-comment": [
245+
"error",
246+
{
247+
beforeBlockComment: true,
248+
afterBlockComment: false,
249+
beforeLineComment: true,
250+
afterLineComment: false
251+
}
252+
],
253+
"max-len": [
254+
"error",
255+
160,
256+
{
257+
ignoreComments: true,
258+
ignoreUrls: true,
259+
ignoreStrings: true,
260+
ignoreTemplateLiterals: true,
261+
ignoreRegExpLiterals: true
262+
}
263+
],
264+
"max-statements-per-line": "error",
265+
"new-cap": "error",
266+
"new-parens": "error",
267+
"no-alert": "error",
268+
"no-array-constructor": "error",
269+
"no-caller": "error",
270+
"no-confusing-arrow": "error",
271+
"no-console": "error",
272+
"no-constant-binary-expression": "error",
273+
"no-constructor-return": "error",
274+
"no-else-return": [
275+
"error",
276+
{
277+
allowElseIf: false
278+
}
279+
],
280+
"no-eval": "error",
281+
"no-extend-native": "error",
282+
"no-extra-bind": "error",
283+
"no-extra-semi": "error",
284+
"no-floating-decimal": "error",
285+
"no-implied-eval": "error",
286+
"no-inner-declarations": "error",
287+
"no-invalid-this": "error",
288+
"no-iterator": "error",
289+
"no-label-var": "error",
290+
"no-labels": "error",
291+
"no-lone-blocks": "error",
292+
"no-loop-func": "error",
293+
"no-mixed-spaces-and-tabs": ["error", false],
294+
"no-multi-spaces": "error",
295+
"no-multi-str": "error",
296+
"no-multiple-empty-lines": [
297+
"error",
298+
{
299+
max: 2,
300+
maxBOF: 0,
301+
maxEOF: 0
302+
}
303+
],
304+
"no-nested-ternary": "error",
305+
"no-new": "error",
306+
"no-new-func": "error",
307+
"no-new-object": "error",
308+
"no-new-wrappers": "error",
309+
"no-octal-escape": "error",
310+
"no-param-reassign": "error",
311+
"no-proto": "error",
312+
"no-process-exit": "off",
313+
"no-restricted-properties": [
314+
"error",
315+
{
316+
property: "substring",
317+
message: "Use .slice instead of .substring."
318+
},
319+
{
320+
property: "substr",
321+
message: "Use .slice instead of .substr."
322+
},
323+
{
324+
object: "assert",
325+
property: "equal",
326+
message: "Use assert.strictEqual instead of assert.equal."
327+
},
328+
{
329+
object: "assert",
330+
property: "notEqual",
331+
message:
332+
"Use assert.notStrictEqual instead of assert.notEqual."
333+
},
334+
{
335+
object: "assert",
336+
property: "deepEqual",
337+
message:
338+
"Use assert.deepStrictEqual instead of assert.deepEqual."
339+
},
340+
{
341+
object: "assert",
342+
property: "notDeepEqual",
343+
message:
344+
"Use assert.notDeepStrictEqual instead of assert.notDeepEqual."
345+
}
346+
],
347+
"no-return-assign": "error",
348+
"no-script-url": "error",
349+
"no-self-compare": "error",
350+
"no-sequences": "error",
351+
"no-shadow": "error",
352+
"no-tabs": "error",
353+
"no-throw-literal": "error",
354+
"no-trailing-spaces": "error",
355+
"no-undef": [
356+
"error",
357+
{
358+
typeof: true
359+
}
360+
],
361+
"no-undef-init": "error",
362+
"no-undefined": "error",
363+
"no-underscore-dangle": [
364+
"error",
365+
{
366+
allowAfterThis: true
367+
}
368+
],
369+
"no-unmodified-loop-condition": "error",
370+
"no-unneeded-ternary": "error",
371+
"no-unreachable-loop": "error",
372+
"no-unused-expressions": "error",
373+
"no-unused-vars": [
374+
"error",
375+
{
376+
vars: "all",
377+
args: "after-used",
378+
caughtErrors: "all"
379+
}
380+
],
381+
"no-use-before-define": "error",
382+
"no-useless-assignment": "error",
383+
"no-useless-call": "error",
384+
"no-useless-computed-key": "error",
385+
"no-useless-concat": "error",
386+
"no-useless-constructor": "error",
387+
"no-useless-rename": "error",
388+
"no-useless-return": "error",
389+
"no-whitespace-before-property": "error",
390+
"no-var": "error",
391+
"n/callback-return": ["error", ["cb", "callback", "next"]],
392+
"n/handle-callback-err": ["error", "err"],
393+
"n/no-deprecated-api": "error",
394+
"n/no-mixed-requires": "error",
395+
"n/no-new-require": "error",
396+
"n/no-path-concat": "error",
397+
"object-curly-newline": [
398+
"error",
399+
{
400+
consistent: true,
401+
multiline: true
402+
}
403+
],
404+
"object-curly-spacing": ["error", "always"],
405+
"object-property-newline": [
406+
"error",
407+
{
408+
allowAllPropertiesOnSameLine: true
409+
}
410+
],
411+
"object-shorthand": [
412+
"error",
413+
"always",
414+
{
415+
avoidExplicitReturnArrows: true
416+
}
417+
],
418+
"one-var-declaration-per-line": "error",
419+
"operator-assignment": "error",
420+
"operator-linebreak": "error",
421+
"padding-line-between-statements": [
422+
"error",
423+
{
424+
blankLine: "always",
425+
prev: ["const", "let", "var"],
426+
next: "*"
427+
},
428+
{
429+
blankLine: "any",
430+
prev: ["const", "let", "var"],
431+
next: ["const", "let", "var"]
432+
}
433+
],
434+
"prefer-arrow-callback": "error",
435+
"prefer-const": "error",
436+
"prefer-exponentiation-operator": "error",
437+
"prefer-numeric-literals": "error",
438+
"prefer-object-has-own": "error",
439+
"prefer-promise-reject-errors": "error",
440+
"prefer-regex-literals": "error",
441+
"prefer-rest-params": "error",
442+
"prefer-spread": "error",
443+
"prefer-template": "error",
444+
quotes: [
445+
"error",
446+
"double",
447+
{
448+
avoidEscape: true
449+
}
450+
],
451+
"quote-props": ["error", "as-needed"],
452+
radix: "error",
453+
"require-unicode-regexp": "error",
454+
"rest-spread-spacing": "error",
455+
semi: "error",
456+
"semi-spacing": [
457+
"error",
458+
{
459+
before: false,
460+
after: true
461+
}
462+
],
463+
"semi-style": "error",
464+
"space-before-blocks": "error",
465+
"space-before-function-paren": [
466+
"error",
467+
{
468+
anonymous: "never",
469+
named: "never",
470+
asyncArrow: "always"
471+
}
472+
],
473+
"space-in-parens": "error",
474+
"space-infix-ops": "error",
475+
"space-unary-ops": [
476+
"error",
477+
{
478+
words: true,
479+
nonwords: false
480+
}
481+
],
482+
"spaced-comment": [
483+
"error",
484+
"always",
485+
{
486+
exceptions: ["-"]
487+
}
488+
],
489+
strict: ["error", "global"],
490+
"switch-colon-spacing": "error",
491+
"symbol-description": "error",
492+
"template-curly-spacing": ["error", "never"],
493+
"template-tag-spacing": "error",
494+
"unicode-bom": "error",
495+
"unicorn/prefer-array-find": "error",
496+
"unicorn/prefer-array-flat-map": "error",
497+
"unicorn/prefer-array-flat": "error",
498+
"unicorn/prefer-array-index-of": "error",
499+
"unicorn/prefer-array-some": "error",
500+
"unicorn/prefer-at": "error",
501+
"unicorn/prefer-includes": "error",
502+
"unicorn/prefer-set-has": "error",
503+
"unicorn/prefer-string-slice": "error",
504+
"unicorn/prefer-string-starts-ends-with": "error",
505+
"unicorn/prefer-string-trim-start-end": "error",
506+
"wrap-iife": "error",
507+
"yield-star-spacing": "error",
508+
yoda: [
509+
"error",
510+
"never",
511+
{
512+
exceptRange: true
513+
}
514+
]
72515
},
73516
overrides: [
74517
{
@@ -105,7 +548,18 @@ module.exports = {
105548
"plugin:eslint-plugin/tests-recommended"
106549
],
107550
rules: {
108-
"eslint-plugin/test-case-property-ordering": "error",
551+
"eslint-plugin/test-case-property-ordering": [
552+
"error",
553+
[
554+
"name",
555+
"filename",
556+
"code",
557+
"output",
558+
"options",
559+
"languageOptions",
560+
"errors"
561+
]
562+
],
109563
"eslint-plugin/test-case-shorthand-strings": "error"
110564
}
111565
},
@@ -191,7 +645,6 @@ module.exports = {
191645
files: [INTERNAL_FILES.RULE_TESTER_PATTERN],
192646
rules: {
193647
"n/no-restricted-require": ["error", [
194-
...createInternalFilesPatterns(INTERNAL_FILES.RULE_TESTER_PATTERN),
195648
resolveAbsolutePath("lib/cli-engine/index.js")
196649
]]
197650
}

‎knip.jsonc

+4-7
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@
3131
"ignoreDependencies": [
3232
"c8",
3333

34-
// These will be removed in https://github.com/eslint/eslint/pull/18011
35-
"eslint-plugin-eslint-comments",
36-
"eslint-plugin-jsdoc",
37-
"eslint-plugin-n",
38-
"eslint-plugin-unicorn",
39-
4034
// Ignore until Knip has a wdio plugin:
4135
"@wdio/*",
42-
"rollup-plugin-node-polyfills"
36+
"rollup-plugin-node-polyfills",
37+
38+
// FIXME: not sure why is eslint-config-eslint reported as unused
39+
"eslint-config-eslint"
4340
]
4441
},
4542
"docs": {

‎package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"devDependencies": {
105105
"@babel/core": "^7.4.3",
106106
"@babel/preset-env": "^7.4.3",
107+
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
107108
"@types/estree": "^1.0.5",
108109
"@types/node": "^20.11.5",
109110
"@wdio/browser-runner": "^8.14.6",
@@ -120,12 +121,11 @@
120121
"ejs": "^3.0.2",
121122
"eslint": "file:.",
122123
"eslint-config-eslint": "file:packages/eslint-config-eslint",
123-
"eslint-plugin-eslint-comments": "^3.2.0",
124124
"eslint-plugin-eslint-plugin": "^6.0.0",
125125
"eslint-plugin-internal-rules": "file:tools/internal-rules",
126-
"eslint-plugin-jsdoc": "^46.9.0",
127-
"eslint-plugin-n": "^16.6.0",
128-
"eslint-plugin-unicorn": "^49.0.0",
126+
"eslint-plugin-jsdoc": "^48.2.3",
127+
"eslint-plugin-n": "^17.2.0",
128+
"eslint-plugin-unicorn": "^52.0.0",
129129
"eslint-release": "^3.2.2",
130130
"eslump": "^3.0.0",
131131
"esprima": "^4.0.1",

‎packages/eslint-config-eslint/eslintrc.js

-459
This file was deleted.

‎packages/eslint-config-eslint/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"./package.json": "./package.json",
88
".": "./index.js",
99
"./base": "./base.js",
10-
"./cjs": "./cjs.js",
11-
"./eslintrc": "./eslintrc.js"
10+
"./cjs": "./cjs.js"
1211
},
1312
"scripts": {
1413
"test": "node ./index.js && node ./cjs.js",

0 commit comments

Comments
 (0)
Please sign in to comment.