Skip to content

Commit

Permalink
feat: Deprecate formatting rules (#17696)
Browse files Browse the repository at this point in the history
* feat: Deprecate formatting rules

Fixes #17522

* Add deprecation notice to rule files

* Fix tests

* Update eslint:all test

* Add deprecation notice to docs

* Clarify error message for rule check

* Update eslint:all test
  • Loading branch information
nzakas authored Nov 3, 2023
1 parent 485ec7d commit 528e1c0
Show file tree
Hide file tree
Showing 141 changed files with 428 additions and 160 deletions.
2 changes: 1 addition & 1 deletion Makefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ target.checkRuleFiles = function() {

// check deprecated
if (ruleDef.meta.deprecated && !hasDeprecatedInfo()) {
console.error(`Missing deprecated information in ${basename} rule code or README.md. Please write @deprecated tag in code or 「This rule was deprecated in ESLint ...」 in README.md.`);
console.error(`Missing deprecated information in ${basename} rule code or README.md. Please write @deprecated tag in code and「This rule was deprecated in ESLint ...」 in README.md.`);
errors++;
}

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/array-bracket-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ related_rules:
- array-bracket-spacing
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

A number of style guides require or disallow line breaks inside of array brackets.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/array-bracket-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ related_rules:
- computed-property-spacing
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

A number of style guides require or disallow spaces between array brackets and other tokens. This rule
applies to both array literals and destructuring assignments (ECMAScript 6).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/array-element-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ related_rules:
- brace-style
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

A number of style guides require or disallow line breaks between array elements.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/arrow-parens.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ further_reading:
- https://github.com/airbnb/javascript#arrows--one-arg-parens
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Arrow functions can omit parentheses when they have exactly one parameter. In all other cases the parameter(s) must
be wrapped in parentheses. This rule enforces the consistent use of parentheses in arrow functions.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/arrow-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: arrow-spacing
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

This rule normalize style of spacing before/after an arrow function's arrow(`=>`).

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/block-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ related_rules:
- brace-style
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/brace-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ further_reading:
- https://en.wikipedia.org/wiki/Indent_style
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Brace style is closely related to [indent style](https://en.wikipedia.org/wiki/Indent_style) in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/comma-dangle.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: comma-dangle
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/comma-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ further_reading:
- https://dojotoolkit.org/reference-guide/1.9/developer/styleguide.html
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Spacing around commas improves readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/comma-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ further_reading:
- https://gist.github.com/isaacs/357981
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

The Comma Style rule enforces styles for comma-separated lists. There are two comma styles primarily used in JavaScript:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/computed-property-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ related_rules:
- space-in-parens
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

While formatting preferences are very personal, a number of style guides require
or disallow spaces between computed properties in the following situations:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/dot-location.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ related_rules:
- dot-notation
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

JavaScript allows you to place newlines before or after a dot in a member expression.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/eol-last.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: eol-last
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Trailing newlines in non-empty files are a common UNIX idiom. Benefits of
trailing newlines include the ability to concatenate or append to files as well
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/func-call-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ related_rules:
- no-spaced-func
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

When calling a function, developers may insert optional whitespace between the function's name and the parentheses that invoke it. The following pairs of function calls are equivalent:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/function-call-argument-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ related_rules:
- array-element-newline
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

A number of style guides require or disallow line breaks between arguments of a function call.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/function-paren-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: function-paren-newline
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Many style guides require or disallow newlines inside of function parentheses.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/generator-star-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ further_reading:
- https://leanpub.com/understandinges6/read/#leanpub-auto-generators
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Generators are a new type of function in ECMAScript 6 that can return multiple values over time.
These special functions are indicated by placing an `*` after the `function` keyword.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/implicit-arrow-linebreak.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ related_rules:
- brace-style
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

An arrow function body can contain an implicit return as an expression instead of a block body. It can be useful to enforce a consistent location for the implicitly returned expression.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/indent.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: indent
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

There are several common guidelines which require specific indentation of nested blocks and statements, like:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/jsx-quotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ related_rules:
- quotes
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

JSX attribute values can contain string literals, which are delimited with single or double quotes.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/key-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: key-spacing
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment of adjacent properties in an object literal.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/keyword-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: keyword-spacing
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Keywords are syntax elements of JavaScript, such as `try` and `if`.
These keywords have special meaning to the language and so often appear in a different color in code editors.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/linebreak-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: linebreak-style
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

When developing with a lot of people all having different editors, VCS applications and operating systems it may occur that
different line endings are written by either of the mentioned (might especially happen when using the windows and mac versions of SourceTree together).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/lines-around-comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ related_rules:
- spaced-comment
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Many style guides require empty lines before or after comments. The primary goal
of these rules is to make the comments easier to read and improve readability of the code.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/lines-between-class-members.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ related_rules:
- padding-line-between-statements
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

This rule improves readability by enforcing lines between class members. It will not check empty lines before the first member and after the last member, since that is already taken care of by padded-blocks.

Expand Down
1 change: 1 addition & 0 deletions docs/src/rules/max-len.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ related_rules:
- max-statements
---

This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Very long lines of code in any language can be difficult to read. In order to aid in readability and maintainability many coders have developed a convention to limit lines of code to X number of characters (traditionally 80 characters).

Expand Down
1 change: 1 addition & 0 deletions docs/src/rules/max-statements-per-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ related_rules:
- max-statements
---

This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

A line of code containing too many statements can be difficult to read. Code is generally read from the top down, especially when scanning, so limiting the number of statements allowed on a single line can be very beneficial for readability and maintainability.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/multiline-ternary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ related_rules:
- operator-linebreak
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

JavaScript allows operands of ternary expressions to be separated by newlines, which can improve the readability of your program.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/new-parens.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: new-parens
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

JavaScript allows the omission of parentheses when invoking a function via the `new` keyword and the constructor has no arguments. However, some coders believe that omitting the parentheses is inconsistent with the rest of the language and thus makes code less clear.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/newline-per-chained-call.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: newline-per-chained-call
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-confusing-arrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ related_rules:
- arrow-parens
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Arrow functions (`=>`) are similar in syntax to some comparison operators (`>`, `<`, `<=`, and `>=`). This rule warns against using the arrow function syntax in places where it could be confused with a comparison operator.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-extra-parens.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ further_reading:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

This rule restricts the use of parentheses to only where they are necessary.

Expand Down
4 changes: 1 addition & 3 deletions docs/src/rules/no-extra-semi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ related_rules:
- semi-spacing
---




This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-floating-decimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: no-floating-decimal
rule_type: suggestion
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Float values in JavaScript contain a decimal point, and there is no requirement that the decimal point be preceded or followed by a number. For example, the following are all valid JavaScript numbers:

Expand Down
1 change: 1 addition & 0 deletions docs/src/rules/no-mixed-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ related_rules:
- no-extra-parens
---

This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Enclosing complex expressions by parentheses clarifies the developer's intention, which makes the code more readable.
This rule warns when different operators are used consecutively without parentheses in an expression.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-mixed-spaces-and-tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ further_reading:
- https://www.emacswiki.org/emacs/SmartTabs
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-multi-spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ related_rules:
- space-return-throw-case
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Multiple spaces in a row that are not used for indentation are typically mistakes. For example:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-multiple-empty-lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: no-multiple-empty-lines
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.

Expand Down
1 change: 1 addition & 0 deletions docs/src/rules/no-tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: no-tabs
rule_type: layout
---

This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Some style guides don't allow the use of tab characters at all, including within comments.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-trailing-spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: no-trailing-spaces
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before check-in.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-whitespace-before-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: no-whitespace-before-property
rule_type: layout
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

JavaScript allows whitespace between objects and their properties. However, inconsistent spacing can make code harder to read and can lead to errors.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/nonblock-statement-body-position.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ further_reading:
- https://jscs-dev.github.io/rule/requireNewlineBeforeSingleStatementsInIf
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

When writing `if`, `else`, `while`, `do-while`, and `for` statements, the body can be a single statement instead of a block. It can be useful to enforce a consistent location for these single statements.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/object-curly-newline.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ related_rules:
- object-property-newline
---


This rule was **deprecated** in ESLint v8.53.0. Please use the corresponding rule in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js).

A number of style guides require or disallow line breaks inside of object braces and other tokens.

Expand Down
Loading

0 comments on commit 528e1c0

Please sign in to comment.