Skip to content

Commit

Permalink
Merge pull request #271 from prettier/deprecated
Browse files Browse the repository at this point in the history
Move rules deprecated in ESLint 8.53.0 to the deprecated section
  • Loading branch information
lydell authored Dec 2, 2023
2 parents 48f804c + 6d0bd92 commit 4110dff
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 138 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

const config = require(".");

const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;

module.exports = {
extends: [
"google",
Expand Down Expand Up @@ -68,6 +70,19 @@ module.exports = {
"object-curly-spacing": "off",
"babel/object-curly-spacing": ["error", "never"],
"@babel/object-curly-spacing": ["error", "never"],

// Workaround: These rules are deprecated, but added by eslint-config-google.
// We have to exclude them when testing the flat config, but also turn them
// off for the linting tests to pass. It’s time to get rid of eslint-config-google
// (their GitHub repo is archived as well).
...(includeDeprecated
? {}
: {
"comma-dangle": "off",
"max-len": "off",
"operator-linebreak": "off",
"quotes": "off",
}),
},
overrides: [
{
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Example ESLint configuration:
}
```

### [lines-around-comment]
### [lines-around-comment] \(deprecated)

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

Expand Down Expand Up @@ -334,7 +334,7 @@ Example ESLint configuration:
}
```

### [max-len]
### [max-len] \(deprecated)

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

Expand All @@ -357,7 +357,7 @@ Example ESLint configuration:
}
```

### [no-confusing-arrow]
### [no-confusing-arrow] \(deprecated)

**This rule requires certain options.**

Expand Down Expand Up @@ -407,7 +407,7 @@ Example ESLint configuration:

(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.)

### [no-mixed-operators]
### [no-mixed-operators] \(deprecated)

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

Expand Down Expand Up @@ -460,7 +460,7 @@ Example ESLint configuration:
}
```

### [no-tabs]
### [no-tabs] \(deprecated)

**This rule requires certain options.**

Expand Down Expand Up @@ -546,7 +546,7 @@ Example configuration:
}
```

### [quotes]
### [quotes] \(deprecated)

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

Expand Down
207 changes: 99 additions & 108 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,24 @@

const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;

const specialRule = 0;

module.exports = {
rules: {
// The following rules can be used in some cases. See the README for more
// information. (These are marked with `0` instead of `"off"` so that a
// script can distinguish them.)
"curly": 0,
"lines-around-comment": 0,
"max-len": 0,
"no-confusing-arrow": 0,
"no-mixed-operators": 0,
"no-tabs": 0,
"no-unexpected-multiline": 0,
"quotes": 0,
"@typescript-eslint/lines-around-comment": 0,
"@typescript-eslint/quotes": 0,
"babel/quotes": 0,
"unicorn/template-indent": 0,
"vue/html-self-closing": 0,
"vue/max-len": 0,
// information. These are marked with `0` instead of `"off"` so that a
// script can distinguish them. Note that there are a few more of these
// in the deprecated section below.
"curly": specialRule,
"no-unexpected-multiline": specialRule,
"@typescript-eslint/lines-around-comment": specialRule,
"@typescript-eslint/quotes": specialRule,
"babel/quotes": specialRule,
"unicorn/template-indent": specialRule,
"vue/html-self-closing": specialRule,
"vue/max-len": specialRule,

// The rest are rules that you never need to enable when using Prettier.
"array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-element-newline": "off",
"arrow-parens": "off",
"arrow-spacing": "off",
"block-spacing": "off",
"brace-style": "off",
"comma-dangle": "off",
"comma-spacing": "off",
"comma-style": "off",
"computed-property-spacing": "off",
"dot-location": "off",
"eol-last": "off",
"func-call-spacing": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"generator-star-spacing": "off",
"implicit-arrow-linebreak": "off",
"indent": "off",
"jsx-quotes": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"linebreak-style": "off",
"max-statements-per-line": "off",
"multiline-ternary": "off",
"newline-per-chained-call": "off",
"new-parens": "off",
"no-extra-parens": "off",
"no-extra-semi": "off",
"no-floating-decimal": "off",
"no-mixed-spaces-and-tabs": "off",
"no-multi-spaces": "off",
"no-multiple-empty-lines": "off",
"no-trailing-spaces": "off",
"no-whitespace-before-property": "off",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var-declaration-per-line": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
"quote-props": "off",
"rest-spread-spacing": "off",
"semi": "off",
"semi-spacing": "off",
"semi-style": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"switch-colon-spacing": "off",
"template-curly-spacing": "off",
"template-tag-spacing": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "off",
"@babel/object-curly-spacing": "off",
"@babel/semi": "off",
"@typescript-eslint/block-spacing": "off",
Expand Down Expand Up @@ -173,51 +112,103 @@ module.exports = {
"vue/template-curly-spacing": "off",

...(includeDeprecated && {
// Removed in version 0.10.0.
// https://eslint.org/docs/latest/rules/space-unary-word-ops
"space-unary-word-ops": "off",

// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/generator-star
// https://github.com/eslint/eslint/issues/1898
"generator-star": "off",
// Deprecated since version 4.0.0.
// https://github.com/eslint/eslint/pull/8286
"indent-legacy": "off",
// Removed in version 2.0.0.
// https://eslint.org/docs/latest/rules/no-arrow-condition
"no-arrow-condition": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/no-comma-dangle
"no-comma-dangle": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/no-reserved-keys
"no-reserved-keys": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/no-space-before-semi
"no-space-before-semi": "off",
// Deprecated since version 3.3.0.
// https://eslint.org/docs/rules/no-spaced-func
"no-spaced-func": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/no-wrap-func
"no-wrap-func": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/space-after-function-name
"space-after-function-name": "off",
// Removed in version 2.0.0.
// https://eslint.org/docs/latest/rules/space-after-keywords
"space-after-keywords": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/space-before-function-parentheses
"space-before-function-parentheses": "off",
// Removed in version 2.0.0.
// https://eslint.org/docs/latest/rules/space-before-keywords
"space-before-keywords": "off",
// Removed in version 1.0.0.
// https://eslint.org/docs/latest/rules/space-in-brackets
"space-in-brackets": "off",

// Removed in version 2.0.0.
// https://eslint.org/docs/latest/rules/space-return-throw-case
// https://github.com/eslint/eslint/issues/5032
"no-arrow-condition": "off",
"space-after-keywords": "off",
"space-before-keywords": "off",
"space-return-throw-case": "off",
// Removed in version 0.10.0.
// https://eslint.org/docs/latest/rules/space-unary-word-ops
"space-unary-word-ops": "off",

// Deprecated since version 3.3.0.
// https://eslint.org/docs/rules/no-spaced-func
"no-spaced-func": "off",

// Deprecated since version 4.0.0.
// https://github.com/eslint/eslint/pull/8286
"indent-legacy": "off",

// Deprecated since version 8.53.0.
// https://eslint.org/blog/2023/10/deprecating-formatting-rules/
"array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-element-newline": "off",
"arrow-parens": "off",
"arrow-spacing": "off",
"block-spacing": "off",
"brace-style": "off",
"comma-dangle": "off",
"comma-spacing": "off",
"comma-style": "off",
"computed-property-spacing": "off",
"dot-location": "off",
"eol-last": "off",
"func-call-spacing": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"generator-star-spacing": "off",
"implicit-arrow-linebreak": "off",
"indent": "off",
"jsx-quotes": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"linebreak-style": "off",
"lines-around-comment": specialRule,
"max-len": specialRule,
"max-statements-per-line": "off",
"multiline-ternary": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-confusing-arrow": specialRule,
"no-extra-parens": "off",
"no-extra-semi": "off",
"no-floating-decimal": "off",
"no-mixed-operators": specialRule,
"no-mixed-spaces-and-tabs": "off",
"no-multi-spaces": "off",
"no-multiple-empty-lines": "off",
"no-tabs": specialRule,
"no-trailing-spaces": "off",
"no-whitespace-before-property": "off",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var-declaration-per-line": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
"quote-props": "off",
"quotes": specialRule,
"rest-spread-spacing": "off",
"semi": "off",
"semi-spacing": "off",
"semi-style": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"switch-colon-spacing": "off",
"template-curly-spacing": "off",
"template-tag-spacing": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "off",

// Deprecated since version 7.0.0.
// https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
"react/jsx-space-before-closing": "off",
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4110dff

Please sign in to comment.