Skip to content

Commit

Permalink
docs: Make clear when rules are removed (#17728)
Browse files Browse the repository at this point in the history
* docs: Make clear when rules are removed

* space-after-keywords and space-unary-word-ops

* Update docs/src/rules/space-unary-word-ops.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

---------

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
nzakas and mdjermanovic committed Nov 16, 2023
1 parent e8cf9f6 commit becfdd3
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 22 deletions.
4 changes: 3 additions & 1 deletion docs/src/rules/generator-star.md
Expand Up @@ -6,7 +6,9 @@ further_reading:

Enforces consistent spacing around the asterisk in generator functions.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [generator-star-spacing](generator-star-spacing) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [generator-star-spacing](generator-star-spacing) rule.
:::

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
4 changes: 3 additions & 1 deletion docs/src/rules/global-strict.md
Expand Up @@ -5,7 +5,9 @@ title: global-strict

Requires or disallows strict mode directives in the global scope.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [strict](strict) rule. The `"global"` option in the new rule is most similar to the removed rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [strict](strict) rule. The `"global"` option in the new rule is most similar to the removed rule.
:::

Strict mode is enabled by using the following pragma in your code:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-arrow-condition.md
Expand Up @@ -9,7 +9,9 @@ related_rules:

Disallows arrow functions where test conditions are expected.

(removed) This rule was **removed** in ESLint v2.0 and **replaced** by a combination of the [no-confusing-arrow](no-confusing-arrow) and [no-constant-condition](no-constant-condition) rules.
::: important
This rule was removed in ESLint v2.0.0 and replaced by a combination of the [no-confusing-arrow](no-confusing-arrow) and [no-constant-condition](no-constant-condition) rules.
:::

Arrow functions (`=>`) are similar in syntax to some comparison operators (`>`, `<`, `<=`, and `>=`). This rule warns against using the arrow function syntax in places where a condition is expected. Even if the arguments of the arrow function are wrapped with parens, this rule still warns about it.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-comma-dangle.md
Expand Up @@ -5,7 +5,9 @@ title: no-comma-dangle

Disallows trailing commas in object and array literals.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [comma-dangle](comma-dangle) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [comma-dangle](comma-dangle) rule.
:::

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
4 changes: 3 additions & 1 deletion docs/src/rules/no-empty-class.md
Expand Up @@ -5,7 +5,9 @@ title: no-empty-class

Disallows empty character classes in regular expressions.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [no-empty-character-class](no-empty-character-class) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [no-empty-character-class](no-empty-character-class) rule.
:::

Empty character classes in regular expressions do not match anything and can result in code that may not work as intended.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-empty-label.md
Expand Up @@ -9,7 +9,9 @@ related_rules:

Disallows labels for anything other than loops and switches.

(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [no-labels](no-labels) rule.
::: important
This rule was removed in ESLint v2.0.0 and replaced by the [no-labels](no-labels) rule.
:::

Labeled statements are only used in conjunction with labeled break and continue statements. ECMAScript has no goto statement.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-extra-strict.md
Expand Up @@ -7,7 +7,9 @@ further_reading:

Disallows strict mode directives when already in strict mode.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [strict](strict) rule. The `"global"` or `"function"` options in the new rule are similar to the removed rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [strict](strict) rule. The `"global"` or `"function"` options in the new rule are similar to the removed rule.
:::

The `"use strict";` directive applies to the scope in which it appears and all inner scopes contained within that scope. Therefore, using the `"use strict";` directive in one of these inner scopes is unnecessary.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-reserved-keys.md
Expand Up @@ -7,7 +7,9 @@ further_reading:

Disallows unquoted reserved words as property names in object literals.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [quote-props](quote-props) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [quote-props](quote-props) rule.
:::

ECMAScript 3 described as series of keywords and reserved words, such as `if` and `public`, that are used or intended to be used for a core language feature. The specification also indicated that these keywords and reserved words could not be used as object property names without being enclosed in strings. An error occurs in an ECMAScript 3 environment when you use a keyword or reserved word in an object literal. For example:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-space-before-semi.md
Expand Up @@ -8,7 +8,9 @@ related_rules:

Disallows spaces before semicolons.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [semi-spacing](semi-spacing) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [semi-spacing](semi-spacing) rule.
:::

JavaScript allows for placing unnecessary spaces between an expression and the closing semicolon.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/no-wrap-func.md
Expand Up @@ -5,7 +5,9 @@ title: no-wrap-func

Disallows unnecessary parentheses around function expressions.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [no-extra-parens](no-extra-parens) rule. The `"functions"` option in the new rule is equivalent to the removed rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [no-extra-parens](no-extra-parens) rule. The `"functions"` option in the new rule is equivalent to the removed rule.
:::

Although it's possible to wrap functions in parentheses, this can be confusing when the code also contains immediately-invoked function expressions (IIFEs) since parentheses are often used to make this distinction. For example:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/space-after-function-name.md
Expand Up @@ -5,7 +5,9 @@ title: space-after-function-name

Enforces consistent spacing after name in function definitions.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [space-before-function-paren](space-before-function-paren) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [space-before-function-paren](space-before-function-paren) rule.
:::

Whitespace between a function name and its parameter list is optional.

Expand Down
6 changes: 3 additions & 3 deletions docs/src/rules/space-after-keywords.md
Expand Up @@ -5,9 +5,9 @@ title: space-after-keywords

Enforces consistent spacing after keywords.

(removed) This rule was **removed** in ESLint v2.0 and replaced by the [keyword-spacing](keyword-spacing) rule.

(fixable) The `--fix` option on the [command line](../use/command-line-interface#--fix) automatically fixed problems reported by this rule.
:::important
This rule was removed in ESLint v2.0.0 and replaced by the [keyword-spacing](keyword-spacing) rule.
:::

Some style guides will require or disallow spaces following the certain keywords.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/space-before-function-parentheses.md
Expand Up @@ -8,7 +8,9 @@ related_rules:

Enforces consistent spacing before opening parenthesis in function definitions.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [space-before-function-paren](space-before-function-paren) rule. The name of the rule changed from "parentheses" to "paren" for consistency with the names of other rules.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [space-before-function-paren](space-before-function-paren) rule. The name of the rule changed from "parentheses" to "paren" for consistency with the names of other rules.
:::

When formatting a function, whitespace is allowed between the function name or `function` keyword and the opening paren. Named functions also require a space between the `function` keyword and the function name, but anonymous functions require no whitespace. For example:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/space-before-keywords.md
Expand Up @@ -11,7 +11,9 @@ related_rules:

Enforces consistent spacing before keywords.

(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing) rule.
::: important
This rule was removed in ESLint v2.0.0 and replaced by the [keyword-spacing](keyword-spacing) rule.
:::

(fixable) The `--fix` option on the [command line](../use/command-line-interface#--fix) automatically fixed problems reported by this rule.

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/space-in-brackets.md
Expand Up @@ -10,7 +10,9 @@ related_rules:

Enforces consistent spacing inside braces of object literals and brackets of array literals.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [object-curly-spacing](object-curly-spacing) and [array-bracket-spacing](array-bracket-spacing) rules.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [object-curly-spacing](object-curly-spacing) and [array-bracket-spacing](array-bracket-spacing) rules.
:::

While formatting preferences are very personal, a number of style guides require or disallow spaces between brackets:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/space-return-throw-case.md
Expand Up @@ -5,7 +5,9 @@ title: space-return-throw-case

Requires spaces after `return`, `throw`, and `case` keywords.

(removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing) rule.
::: important
This rule was removed in ESLint v2.0.0 and replaced by the [keyword-spacing](keyword-spacing) rule.
:::

(fixable) The `--fix` option on the [command line](../use/command-line-interface#--fix) automatically fixed problems reported by this rule.

Expand Down
6 changes: 3 additions & 3 deletions docs/src/rules/space-unary-word-ops.md
Expand Up @@ -5,9 +5,9 @@ title: space-unary-word-ops

Requires spaces after unary word operators.

(removed) This rule was **removed** in ESLint v0.10.0 and **replaced** by the [space-unary-ops](space-unary-ops) rule.

Require spaces following unary word operators.
:::important
This rule was removed in ESLint v0.10.0 and replaced by the [space-unary-ops](space-unary-ops) rule.
:::

## Rule Details

Expand Down
4 changes: 3 additions & 1 deletion docs/src/rules/spaced-line-comment.md
Expand Up @@ -7,7 +7,9 @@ related_rules:

Enforces consistent spacing after `//` in line comments.

(removed) This rule was **removed** in ESLint v1.0 and **replaced** by the [spaced-comment](spaced-comment) rule.
::: important
This rule was removed in ESLint v1.0.0 and replaced by the [spaced-comment](spaced-comment) rule.
:::

Some style guides require or disallow a whitespace immediately after the initial `//` of a line comment.
Whitespace after the `//` makes it easier to read text in comments.
Expand Down

0 comments on commit becfdd3

Please sign in to comment.