From becfdd39b25d795e56c9a13eb3e77af6b9c86e8a Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 16 Nov 2023 17:07:31 -0500 Subject: [PATCH] docs: Make clear when rules are removed (#17728) * 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 --------- Co-authored-by: Milos Djermanovic --- docs/src/rules/generator-star.md | 4 +++- docs/src/rules/global-strict.md | 4 +++- docs/src/rules/no-arrow-condition.md | 4 +++- docs/src/rules/no-comma-dangle.md | 4 +++- docs/src/rules/no-empty-class.md | 4 +++- docs/src/rules/no-empty-label.md | 4 +++- docs/src/rules/no-extra-strict.md | 4 +++- docs/src/rules/no-reserved-keys.md | 4 +++- docs/src/rules/no-space-before-semi.md | 4 +++- docs/src/rules/no-wrap-func.md | 4 +++- docs/src/rules/space-after-function-name.md | 4 +++- docs/src/rules/space-after-keywords.md | 6 +++--- docs/src/rules/space-before-function-parentheses.md | 4 +++- docs/src/rules/space-before-keywords.md | 4 +++- docs/src/rules/space-in-brackets.md | 4 +++- docs/src/rules/space-return-throw-case.md | 4 +++- docs/src/rules/space-unary-word-ops.md | 6 +++--- docs/src/rules/spaced-line-comment.md | 4 +++- 18 files changed, 54 insertions(+), 22 deletions(-) diff --git a/docs/src/rules/generator-star.md b/docs/src/rules/generator-star.md index c2ddb18f05d..4a79edd1820 100644 --- a/docs/src/rules/generator-star.md +++ b/docs/src/rules/generator-star.md @@ -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. diff --git a/docs/src/rules/global-strict.md b/docs/src/rules/global-strict.md index 80cbf9a0aa0..5f39d6461ac 100644 --- a/docs/src/rules/global-strict.md +++ b/docs/src/rules/global-strict.md @@ -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: diff --git a/docs/src/rules/no-arrow-condition.md b/docs/src/rules/no-arrow-condition.md index 5882b3fb0de..c2a52a030fd 100644 --- a/docs/src/rules/no-arrow-condition.md +++ b/docs/src/rules/no-arrow-condition.md @@ -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. diff --git a/docs/src/rules/no-comma-dangle.md b/docs/src/rules/no-comma-dangle.md index c1815bc5a0f..20c0b6866cd 100644 --- a/docs/src/rules/no-comma-dangle.md +++ b/docs/src/rules/no-comma-dangle.md @@ -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. diff --git a/docs/src/rules/no-empty-class.md b/docs/src/rules/no-empty-class.md index 5a6760f7dac..b34bf5acdfc 100644 --- a/docs/src/rules/no-empty-class.md +++ b/docs/src/rules/no-empty-class.md @@ -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. diff --git a/docs/src/rules/no-empty-label.md b/docs/src/rules/no-empty-label.md index 9fd7da473e3..4bce8ff7dcc 100644 --- a/docs/src/rules/no-empty-label.md +++ b/docs/src/rules/no-empty-label.md @@ -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. diff --git a/docs/src/rules/no-extra-strict.md b/docs/src/rules/no-extra-strict.md index db0b8da4ff3..e98ddcd13e5 100644 --- a/docs/src/rules/no-extra-strict.md +++ b/docs/src/rules/no-extra-strict.md @@ -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. diff --git a/docs/src/rules/no-reserved-keys.md b/docs/src/rules/no-reserved-keys.md index bef6b376e1f..96f240e4cc6 100644 --- a/docs/src/rules/no-reserved-keys.md +++ b/docs/src/rules/no-reserved-keys.md @@ -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: diff --git a/docs/src/rules/no-space-before-semi.md b/docs/src/rules/no-space-before-semi.md index 4c6650f0b2f..430c1688147 100644 --- a/docs/src/rules/no-space-before-semi.md +++ b/docs/src/rules/no-space-before-semi.md @@ -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. diff --git a/docs/src/rules/no-wrap-func.md b/docs/src/rules/no-wrap-func.md index b0b64be8d14..abb078a372e 100644 --- a/docs/src/rules/no-wrap-func.md +++ b/docs/src/rules/no-wrap-func.md @@ -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: diff --git a/docs/src/rules/space-after-function-name.md b/docs/src/rules/space-after-function-name.md index 65809c2c055..6607c3fd856 100644 --- a/docs/src/rules/space-after-function-name.md +++ b/docs/src/rules/space-after-function-name.md @@ -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. diff --git a/docs/src/rules/space-after-keywords.md b/docs/src/rules/space-after-keywords.md index 7f5d63d9986..a554ca40437 100644 --- a/docs/src/rules/space-after-keywords.md +++ b/docs/src/rules/space-after-keywords.md @@ -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. diff --git a/docs/src/rules/space-before-function-parentheses.md b/docs/src/rules/space-before-function-parentheses.md index 0b6b9b60d61..4d3e84fb139 100644 --- a/docs/src/rules/space-before-function-parentheses.md +++ b/docs/src/rules/space-before-function-parentheses.md @@ -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: diff --git a/docs/src/rules/space-before-keywords.md b/docs/src/rules/space-before-keywords.md index 5eaa76db768..b49fe4b8c36 100644 --- a/docs/src/rules/space-before-keywords.md +++ b/docs/src/rules/space-before-keywords.md @@ -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. diff --git a/docs/src/rules/space-in-brackets.md b/docs/src/rules/space-in-brackets.md index d07023dc9ae..05b9ed88103 100644 --- a/docs/src/rules/space-in-brackets.md +++ b/docs/src/rules/space-in-brackets.md @@ -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: diff --git a/docs/src/rules/space-return-throw-case.md b/docs/src/rules/space-return-throw-case.md index 8a9242280ab..3f6865d5a27 100644 --- a/docs/src/rules/space-return-throw-case.md +++ b/docs/src/rules/space-return-throw-case.md @@ -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. diff --git a/docs/src/rules/space-unary-word-ops.md b/docs/src/rules/space-unary-word-ops.md index 4bb12622056..42ce2557133 100644 --- a/docs/src/rules/space-unary-word-ops.md +++ b/docs/src/rules/space-unary-word-ops.md @@ -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 diff --git a/docs/src/rules/spaced-line-comment.md b/docs/src/rules/spaced-line-comment.md index 9ddc648221b..c536642dabd 100644 --- a/docs/src/rules/spaced-line-comment.md +++ b/docs/src/rules/spaced-line-comment.md @@ -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.