Skip to content

Commit 4110dff

Browse files
authored
Merge pull request #271 from prettier/deprecated
Move rules deprecated in ESLint 8.53.0 to the deprecated section
2 parents 48f804c + 6d0bd92 commit 4110dff

File tree

7 files changed

+174
-138
lines changed

7 files changed

+174
-138
lines changed

.eslintrc.base.js

+15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
const config = require(".");
99

10+
const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
11+
1012
module.exports = {
1113
extends: [
1214
"google",
@@ -68,6 +70,19 @@ module.exports = {
6870
"object-curly-spacing": "off",
6971
"babel/object-curly-spacing": ["error", "never"],
7072
"@babel/object-curly-spacing": ["error", "never"],
73+
74+
// Workaround: These rules are deprecated, but added by eslint-config-google.
75+
// We have to exclude them when testing the flat config, but also turn them
76+
// off for the linting tests to pass. It’s time to get rid of eslint-config-google
77+
// (their GitHub repo is archived as well).
78+
...(includeDeprecated
79+
? {}
80+
: {
81+
"comma-dangle": "off",
82+
"max-len": "off",
83+
"operator-linebreak": "off",
84+
"quotes": "off",
85+
}),
7186
},
7287
overrides: [
7388
{

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Example ESLint configuration:
275275
}
276276
```
277277

278-
### [lines-around-comment]
278+
### [lines-around-comment] \(deprecated)
279279

280280
(The following applies to [@typescript-eslint/lines-around-comment] as well.)
281281

@@ -334,7 +334,7 @@ Example ESLint configuration:
334334
}
335335
```
336336

337-
### [max-len]
337+
### [max-len] \(deprecated)
338338

339339
(The following applies to [vue/max-len] as well.)
340340

@@ -357,7 +357,7 @@ Example ESLint configuration:
357357
}
358358
```
359359

360-
### [no-confusing-arrow]
360+
### [no-confusing-arrow] \(deprecated)
361361

362362
**This rule requires certain options.**
363363

@@ -407,7 +407,7 @@ Example ESLint configuration:
407407

408408
(Note: The CLI helper tool considers `{allowParens: true}` to be the default, which is the case since ESLint 6.0.0. The tool will produce a warning if you use the default even if you use an older version of ESLint. It doesn’t hurt to explicitly set `{allowParens: false}` even though it is technically redundant. This way you are prepared for a future ESLint upgrade and the CLI tool can be kept simple.)
409409

410-
### [no-mixed-operators]
410+
### [no-mixed-operators] \(deprecated)
411411

412412
**This rule requires special attention when writing code.**
413413

@@ -460,7 +460,7 @@ Example ESLint configuration:
460460
}
461461
```
462462

463-
### [no-tabs]
463+
### [no-tabs] \(deprecated)
464464

465465
**This rule requires certain options.**
466466

@@ -546,7 +546,7 @@ Example configuration:
546546
}
547547
```
548548

549-
### [quotes]
549+
### [quotes] \(deprecated)
550550

551551
(The following applies to [babel/quotes] and [@typescript-eslint/quotes] as well.)
552552

index.js

+99-108
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,24 @@
22

33
const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
44

5+
const specialRule = 0;
6+
57
module.exports = {
68
rules: {
79
// The following rules can be used in some cases. See the README for more
8-
// information. (These are marked with `0` instead of `"off"` so that a
9-
// script can distinguish them.)
10-
"curly": 0,
11-
"lines-around-comment": 0,
12-
"max-len": 0,
13-
"no-confusing-arrow": 0,
14-
"no-mixed-operators": 0,
15-
"no-tabs": 0,
16-
"no-unexpected-multiline": 0,
17-
"quotes": 0,
18-
"@typescript-eslint/lines-around-comment": 0,
19-
"@typescript-eslint/quotes": 0,
20-
"babel/quotes": 0,
21-
"unicorn/template-indent": 0,
22-
"vue/html-self-closing": 0,
23-
"vue/max-len": 0,
10+
// information. These are marked with `0` instead of `"off"` so that a
11+
// script can distinguish them. Note that there are a few more of these
12+
// in the deprecated section below.
13+
"curly": specialRule,
14+
"no-unexpected-multiline": specialRule,
15+
"@typescript-eslint/lines-around-comment": specialRule,
16+
"@typescript-eslint/quotes": specialRule,
17+
"babel/quotes": specialRule,
18+
"unicorn/template-indent": specialRule,
19+
"vue/html-self-closing": specialRule,
20+
"vue/max-len": specialRule,
2421

2522
// The rest are rules that you never need to enable when using Prettier.
26-
"array-bracket-newline": "off",
27-
"array-bracket-spacing": "off",
28-
"array-element-newline": "off",
29-
"arrow-parens": "off",
30-
"arrow-spacing": "off",
31-
"block-spacing": "off",
32-
"brace-style": "off",
33-
"comma-dangle": "off",
34-
"comma-spacing": "off",
35-
"comma-style": "off",
36-
"computed-property-spacing": "off",
37-
"dot-location": "off",
38-
"eol-last": "off",
39-
"func-call-spacing": "off",
40-
"function-call-argument-newline": "off",
41-
"function-paren-newline": "off",
42-
"generator-star-spacing": "off",
43-
"implicit-arrow-linebreak": "off",
44-
"indent": "off",
45-
"jsx-quotes": "off",
46-
"key-spacing": "off",
47-
"keyword-spacing": "off",
48-
"linebreak-style": "off",
49-
"max-statements-per-line": "off",
50-
"multiline-ternary": "off",
51-
"newline-per-chained-call": "off",
52-
"new-parens": "off",
53-
"no-extra-parens": "off",
54-
"no-extra-semi": "off",
55-
"no-floating-decimal": "off",
56-
"no-mixed-spaces-and-tabs": "off",
57-
"no-multi-spaces": "off",
58-
"no-multiple-empty-lines": "off",
59-
"no-trailing-spaces": "off",
60-
"no-whitespace-before-property": "off",
61-
"nonblock-statement-body-position": "off",
62-
"object-curly-newline": "off",
63-
"object-curly-spacing": "off",
64-
"object-property-newline": "off",
65-
"one-var-declaration-per-line": "off",
66-
"operator-linebreak": "off",
67-
"padded-blocks": "off",
68-
"quote-props": "off",
69-
"rest-spread-spacing": "off",
70-
"semi": "off",
71-
"semi-spacing": "off",
72-
"semi-style": "off",
73-
"space-before-blocks": "off",
74-
"space-before-function-paren": "off",
75-
"space-in-parens": "off",
76-
"space-infix-ops": "off",
77-
"space-unary-ops": "off",
78-
"switch-colon-spacing": "off",
79-
"template-curly-spacing": "off",
80-
"template-tag-spacing": "off",
81-
"wrap-iife": "off",
82-
"wrap-regex": "off",
83-
"yield-star-spacing": "off",
8423
"@babel/object-curly-spacing": "off",
8524
"@babel/semi": "off",
8625
"@typescript-eslint/block-spacing": "off",
@@ -173,51 +112,103 @@ module.exports = {
173112
"vue/template-curly-spacing": "off",
174113

175114
...(includeDeprecated && {
115+
// Removed in version 0.10.0.
116+
// https://eslint.org/docs/latest/rules/space-unary-word-ops
117+
"space-unary-word-ops": "off",
118+
176119
// Removed in version 1.0.0.
177-
// https://eslint.org/docs/latest/rules/generator-star
120+
// https://github.com/eslint/eslint/issues/1898
178121
"generator-star": "off",
179-
// Deprecated since version 4.0.0.
180-
// https://github.com/eslint/eslint/pull/8286
181-
"indent-legacy": "off",
182-
// Removed in version 2.0.0.
183-
// https://eslint.org/docs/latest/rules/no-arrow-condition
184-
"no-arrow-condition": "off",
185-
// Removed in version 1.0.0.
186-
// https://eslint.org/docs/latest/rules/no-comma-dangle
187122
"no-comma-dangle": "off",
188-
// Removed in version 1.0.0.
189-
// https://eslint.org/docs/latest/rules/no-reserved-keys
190123
"no-reserved-keys": "off",
191-
// Removed in version 1.0.0.
192-
// https://eslint.org/docs/latest/rules/no-space-before-semi
193124
"no-space-before-semi": "off",
194-
// Deprecated since version 3.3.0.
195-
// https://eslint.org/docs/rules/no-spaced-func
196-
"no-spaced-func": "off",
197-
// Removed in version 1.0.0.
198-
// https://eslint.org/docs/latest/rules/no-wrap-func
199125
"no-wrap-func": "off",
200-
// Removed in version 1.0.0.
201-
// https://eslint.org/docs/latest/rules/space-after-function-name
202126
"space-after-function-name": "off",
203-
// Removed in version 2.0.0.
204-
// https://eslint.org/docs/latest/rules/space-after-keywords
205-
"space-after-keywords": "off",
206-
// Removed in version 1.0.0.
207-
// https://eslint.org/docs/latest/rules/space-before-function-parentheses
208127
"space-before-function-parentheses": "off",
209-
// Removed in version 2.0.0.
210-
// https://eslint.org/docs/latest/rules/space-before-keywords
211-
"space-before-keywords": "off",
212-
// Removed in version 1.0.0.
213-
// https://eslint.org/docs/latest/rules/space-in-brackets
214128
"space-in-brackets": "off",
129+
215130
// Removed in version 2.0.0.
216-
// https://eslint.org/docs/latest/rules/space-return-throw-case
131+
// https://github.com/eslint/eslint/issues/5032
132+
"no-arrow-condition": "off",
133+
"space-after-keywords": "off",
134+
"space-before-keywords": "off",
217135
"space-return-throw-case": "off",
218-
// Removed in version 0.10.0.
219-
// https://eslint.org/docs/latest/rules/space-unary-word-ops
220-
"space-unary-word-ops": "off",
136+
137+
// Deprecated since version 3.3.0.
138+
// https://eslint.org/docs/rules/no-spaced-func
139+
"no-spaced-func": "off",
140+
141+
// Deprecated since version 4.0.0.
142+
// https://github.com/eslint/eslint/pull/8286
143+
"indent-legacy": "off",
144+
145+
// Deprecated since version 8.53.0.
146+
// https://eslint.org/blog/2023/10/deprecating-formatting-rules/
147+
"array-bracket-newline": "off",
148+
"array-bracket-spacing": "off",
149+
"array-element-newline": "off",
150+
"arrow-parens": "off",
151+
"arrow-spacing": "off",
152+
"block-spacing": "off",
153+
"brace-style": "off",
154+
"comma-dangle": "off",
155+
"comma-spacing": "off",
156+
"comma-style": "off",
157+
"computed-property-spacing": "off",
158+
"dot-location": "off",
159+
"eol-last": "off",
160+
"func-call-spacing": "off",
161+
"function-call-argument-newline": "off",
162+
"function-paren-newline": "off",
163+
"generator-star-spacing": "off",
164+
"implicit-arrow-linebreak": "off",
165+
"indent": "off",
166+
"jsx-quotes": "off",
167+
"key-spacing": "off",
168+
"keyword-spacing": "off",
169+
"linebreak-style": "off",
170+
"lines-around-comment": specialRule,
171+
"max-len": specialRule,
172+
"max-statements-per-line": "off",
173+
"multiline-ternary": "off",
174+
"new-parens": "off",
175+
"newline-per-chained-call": "off",
176+
"no-confusing-arrow": specialRule,
177+
"no-extra-parens": "off",
178+
"no-extra-semi": "off",
179+
"no-floating-decimal": "off",
180+
"no-mixed-operators": specialRule,
181+
"no-mixed-spaces-and-tabs": "off",
182+
"no-multi-spaces": "off",
183+
"no-multiple-empty-lines": "off",
184+
"no-tabs": specialRule,
185+
"no-trailing-spaces": "off",
186+
"no-whitespace-before-property": "off",
187+
"nonblock-statement-body-position": "off",
188+
"object-curly-newline": "off",
189+
"object-curly-spacing": "off",
190+
"object-property-newline": "off",
191+
"one-var-declaration-per-line": "off",
192+
"operator-linebreak": "off",
193+
"padded-blocks": "off",
194+
"quote-props": "off",
195+
"quotes": specialRule,
196+
"rest-spread-spacing": "off",
197+
"semi": "off",
198+
"semi-spacing": "off",
199+
"semi-style": "off",
200+
"space-before-blocks": "off",
201+
"space-before-function-paren": "off",
202+
"space-in-parens": "off",
203+
"space-infix-ops": "off",
204+
"space-unary-ops": "off",
205+
"switch-colon-spacing": "off",
206+
"template-curly-spacing": "off",
207+
"template-tag-spacing": "off",
208+
"wrap-iife": "off",
209+
"wrap-regex": "off",
210+
"yield-star-spacing": "off",
211+
221212
// Deprecated since version 7.0.0.
222213
// https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
223214
"react/jsx-space-before-closing": "off",

package-lock.json

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)