diff --git a/README.md b/README.md index dec121c5d..39cab4de2 100644 --- a/README.md +++ b/README.md @@ -83,45 +83,45 @@ The rules with the following star :star: are included in the `plugin:regexp/reco | Rule ID | Description | | |:--------|:------------|:---| -| [regexp/confusing-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/confusing-quantifier.html) | disallow confusing quantifiers | | +| [regexp/confusing-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/confusing-quantifier.html) | disallow confusing quantifiers | :star: | | [regexp/letter-case](https://ota-meshi.github.io/eslint-plugin-regexp/rules/letter-case.html) | enforce into your favorite case | :wrench: | | [regexp/match-any](https://ota-meshi.github.io/eslint-plugin-regexp/rules/match-any.html) | enforce match any character style | :star::wrench: | -| [regexp/negation](https://ota-meshi.github.io/eslint-plugin-regexp/rules/negation.html) | enforce use of escapes on negation | :wrench: | +| [regexp/negation](https://ota-meshi.github.io/eslint-plugin-regexp/rules/negation.html) | enforce use of escapes on negation | :star::wrench: | | [regexp/no-assertion-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-assertion-capturing-group.html) | disallow capturing group that captures assertions. | :star: | | [regexp/no-dupe-characters-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-dupe-characters-character-class.html) | disallow duplicate characters in the RegExp character class | :star: | -| [regexp/no-dupe-disjunctions](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-dupe-disjunctions.html) | disallow duplicate disjunctions | | -| [regexp/no-empty-alternative](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-alternative.html) | disallow alternatives without elements | | +| [regexp/no-dupe-disjunctions](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-dupe-disjunctions.html) | disallow duplicate disjunctions | :star: | +| [regexp/no-empty-alternative](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-alternative.html) | disallow alternatives without elements | :star: | | [regexp/no-empty-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-group.html) | disallow empty group | :star: | | [regexp/no-empty-lookarounds-assertion](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-empty-lookarounds-assertion.html) | disallow empty lookahead assertion or empty lookbehind assertion | :star: | | [regexp/no-escape-backspace](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-escape-backspace.html) | disallow escape backspace (`[\b]`) | :star: | | [regexp/no-invisible-character](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-invisible-character.html) | disallow invisible raw character | :star::wrench: | -| [regexp/no-lazy-ends](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-lazy-ends.html) | disallow lazy quantifiers at the end of an expression | | -| [regexp/no-legacy-features](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-legacy-features.html) | disallow legacy RegExp features | | +| [regexp/no-lazy-ends](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-lazy-ends.html) | disallow lazy quantifiers at the end of an expression | :star: | +| [regexp/no-legacy-features](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-legacy-features.html) | disallow legacy RegExp features | :star: | | [regexp/no-octal](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-octal.html) | disallow octal escape sequence | :star: | -| [regexp/no-unused-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-unused-capturing-group.html) | disallow unused capturing group | | +| [regexp/no-unused-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-unused-capturing-group.html) | disallow unused capturing group | :star: | | [regexp/no-useless-backreference](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-backreference.html) | disallow useless backreferences in regular expressions | | -| [regexp/no-useless-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-character-class.html) | disallow character class with one character | :wrench: | -| [regexp/no-useless-dollar-replacements](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-dollar-replacements.html) | disallow useless `$` replacements in replacement string | | -| [regexp/no-useless-escape](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-escape.html) | disallow unnecessary escape characters in RegExp | | +| [regexp/no-useless-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-character-class.html) | disallow character class with one character | :star::wrench: | +| [regexp/no-useless-dollar-replacements](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-dollar-replacements.html) | disallow useless `$` replacements in replacement string | :star: | +| [regexp/no-useless-escape](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-escape.html) | disallow unnecessary escape characters in RegExp | :star: | | [regexp/no-useless-exactly-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-exactly-quantifier.html) | disallow unnecessary exactly quantifier | :star: | -| [regexp/no-useless-non-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-non-capturing-group.html) | disallow unnecessary Non-capturing group | :wrench: | +| [regexp/no-useless-non-capturing-group](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-non-capturing-group.html) | disallow unnecessary Non-capturing group | :star::wrench: | | [regexp/no-useless-non-greedy](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-non-greedy.html) | disallow unnecessary quantifier non-greedy (`?`) | :wrench: | -| [regexp/no-useless-range](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-range.html) | disallow unnecessary range of characters by using a hyphen | :wrench: | +| [regexp/no-useless-range](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-range.html) | disallow unnecessary range of characters by using a hyphen | :star::wrench: | | [regexp/no-useless-two-nums-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-two-nums-quantifier.html) | disallow unnecessary `{n,m}` quantifier | :star::wrench: | -| [regexp/optimal-lookaround-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/optimal-lookaround-quantifier.html) | disallow the alternatives of lookarounds that end with a non-constant quantifier | | +| [regexp/optimal-lookaround-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/optimal-lookaround-quantifier.html) | disallow the alternatives of lookarounds that end with a non-constant quantifier | :star: | | [regexp/order-in-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/order-in-character-class.html) | enforces elements order in character class | :wrench: | -| [regexp/prefer-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-character-class.html) | enforce using character class | :wrench: | +| [regexp/prefer-character-class](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-character-class.html) | enforce using character class | :star::wrench: | | [regexp/prefer-d](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-d.html) | enforce using `\d` | :star::wrench: | | [regexp/prefer-escape-replacement-dollar-char](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-escape-replacement-dollar-char.html) | enforces escape of replacement `$` character (`$$`). | | | [regexp/prefer-plus-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-plus-quantifier.html) | enforce using `+` quantifier | :star::wrench: | | [regexp/prefer-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-quantifier.html) | enforce using quantifier | :wrench: | | [regexp/prefer-question-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-question-quantifier.html) | enforce using `?` quantifier | :star::wrench: | -| [regexp/prefer-range](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-range.html) | enforce using character class range | :wrench: | +| [regexp/prefer-range](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-range.html) | enforce using character class range | :star::wrench: | | [regexp/prefer-regexp-exec](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-regexp-exec.html) | enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided | | | [regexp/prefer-regexp-test](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-regexp-test.html) | enforce that `RegExp#test` is used instead of `String#match` and `RegExp#exec` | :wrench: | | [regexp/prefer-star-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-star-quantifier.html) | enforce using `*` quantifier | :star::wrench: | | [regexp/prefer-t](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-t.html) | enforce using `\t` | :star::wrench: | -| [regexp/prefer-unicode-codepoint-escapes](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-unicode-codepoint-escapes.html) | enforce use of unicode codepoint escapes | :wrench: | +| [regexp/prefer-unicode-codepoint-escapes](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-unicode-codepoint-escapes.html) | enforce use of unicode codepoint escapes | :star::wrench: | | [regexp/prefer-w](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-w.html) | enforce using `\w` | :star::wrench: | diff --git a/docs/rules/README.md b/docs/rules/README.md index a8037c69e..06e720501 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -11,43 +11,43 @@ The rules with the following star :star: are included in the `plugin:regexp/reco | Rule ID | Description | | |:--------|:------------|:---| -| [regexp/confusing-quantifier](./confusing-quantifier.md) | disallow confusing quantifiers | | +| [regexp/confusing-quantifier](./confusing-quantifier.md) | disallow confusing quantifiers | :star: | | [regexp/letter-case](./letter-case.md) | enforce into your favorite case | :wrench: | | [regexp/match-any](./match-any.md) | enforce match any character style | :star::wrench: | -| [regexp/negation](./negation.md) | enforce use of escapes on negation | :wrench: | +| [regexp/negation](./negation.md) | enforce use of escapes on negation | :star::wrench: | | [regexp/no-assertion-capturing-group](./no-assertion-capturing-group.md) | disallow capturing group that captures assertions. | :star: | | [regexp/no-dupe-characters-character-class](./no-dupe-characters-character-class.md) | disallow duplicate characters in the RegExp character class | :star: | -| [regexp/no-dupe-disjunctions](./no-dupe-disjunctions.md) | disallow duplicate disjunctions | | -| [regexp/no-empty-alternative](./no-empty-alternative.md) | disallow alternatives without elements | | +| [regexp/no-dupe-disjunctions](./no-dupe-disjunctions.md) | disallow duplicate disjunctions | :star: | +| [regexp/no-empty-alternative](./no-empty-alternative.md) | disallow alternatives without elements | :star: | | [regexp/no-empty-group](./no-empty-group.md) | disallow empty group | :star: | | [regexp/no-empty-lookarounds-assertion](./no-empty-lookarounds-assertion.md) | disallow empty lookahead assertion or empty lookbehind assertion | :star: | | [regexp/no-escape-backspace](./no-escape-backspace.md) | disallow escape backspace (`[\b]`) | :star: | | [regexp/no-invisible-character](./no-invisible-character.md) | disallow invisible raw character | :star::wrench: | -| [regexp/no-lazy-ends](./no-lazy-ends.md) | disallow lazy quantifiers at the end of an expression | | -| [regexp/no-legacy-features](./no-legacy-features.md) | disallow legacy RegExp features | | +| [regexp/no-lazy-ends](./no-lazy-ends.md) | disallow lazy quantifiers at the end of an expression | :star: | +| [regexp/no-legacy-features](./no-legacy-features.md) | disallow legacy RegExp features | :star: | | [regexp/no-octal](./no-octal.md) | disallow octal escape sequence | :star: | -| [regexp/no-unused-capturing-group](./no-unused-capturing-group.md) | disallow unused capturing group | | +| [regexp/no-unused-capturing-group](./no-unused-capturing-group.md) | disallow unused capturing group | :star: | | [regexp/no-useless-backreference](./no-useless-backreference.md) | disallow useless backreferences in regular expressions | | -| [regexp/no-useless-character-class](./no-useless-character-class.md) | disallow character class with one character | :wrench: | -| [regexp/no-useless-dollar-replacements](./no-useless-dollar-replacements.md) | disallow useless `$` replacements in replacement string | | -| [regexp/no-useless-escape](./no-useless-escape.md) | disallow unnecessary escape characters in RegExp | | +| [regexp/no-useless-character-class](./no-useless-character-class.md) | disallow character class with one character | :star::wrench: | +| [regexp/no-useless-dollar-replacements](./no-useless-dollar-replacements.md) | disallow useless `$` replacements in replacement string | :star: | +| [regexp/no-useless-escape](./no-useless-escape.md) | disallow unnecessary escape characters in RegExp | :star: | | [regexp/no-useless-exactly-quantifier](./no-useless-exactly-quantifier.md) | disallow unnecessary exactly quantifier | :star: | -| [regexp/no-useless-non-capturing-group](./no-useless-non-capturing-group.md) | disallow unnecessary Non-capturing group | :wrench: | +| [regexp/no-useless-non-capturing-group](./no-useless-non-capturing-group.md) | disallow unnecessary Non-capturing group | :star::wrench: | | [regexp/no-useless-non-greedy](./no-useless-non-greedy.md) | disallow unnecessary quantifier non-greedy (`?`) | :wrench: | -| [regexp/no-useless-range](./no-useless-range.md) | disallow unnecessary range of characters by using a hyphen | :wrench: | +| [regexp/no-useless-range](./no-useless-range.md) | disallow unnecessary range of characters by using a hyphen | :star::wrench: | | [regexp/no-useless-two-nums-quantifier](./no-useless-two-nums-quantifier.md) | disallow unnecessary `{n,m}` quantifier | :star::wrench: | -| [regexp/optimal-lookaround-quantifier](./optimal-lookaround-quantifier.md) | disallow the alternatives of lookarounds that end with a non-constant quantifier | | +| [regexp/optimal-lookaround-quantifier](./optimal-lookaround-quantifier.md) | disallow the alternatives of lookarounds that end with a non-constant quantifier | :star: | | [regexp/order-in-character-class](./order-in-character-class.md) | enforces elements order in character class | :wrench: | -| [regexp/prefer-character-class](./prefer-character-class.md) | enforce using character class | :wrench: | +| [regexp/prefer-character-class](./prefer-character-class.md) | enforce using character class | :star::wrench: | | [regexp/prefer-d](./prefer-d.md) | enforce using `\d` | :star::wrench: | | [regexp/prefer-escape-replacement-dollar-char](./prefer-escape-replacement-dollar-char.md) | enforces escape of replacement `$` character (`$$`). | | | [regexp/prefer-plus-quantifier](./prefer-plus-quantifier.md) | enforce using `+` quantifier | :star::wrench: | | [regexp/prefer-quantifier](./prefer-quantifier.md) | enforce using quantifier | :wrench: | | [regexp/prefer-question-quantifier](./prefer-question-quantifier.md) | enforce using `?` quantifier | :star::wrench: | -| [regexp/prefer-range](./prefer-range.md) | enforce using character class range | :wrench: | +| [regexp/prefer-range](./prefer-range.md) | enforce using character class range | :star::wrench: | | [regexp/prefer-regexp-exec](./prefer-regexp-exec.md) | enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided | | | [regexp/prefer-regexp-test](./prefer-regexp-test.md) | enforce that `RegExp#test` is used instead of `String#match` and `RegExp#exec` | :wrench: | | [regexp/prefer-star-quantifier](./prefer-star-quantifier.md) | enforce using `*` quantifier | :star::wrench: | | [regexp/prefer-t](./prefer-t.md) | enforce using `\t` | :star::wrench: | -| [regexp/prefer-unicode-codepoint-escapes](./prefer-unicode-codepoint-escapes.md) | enforce use of unicode codepoint escapes | :wrench: | +| [regexp/prefer-unicode-codepoint-escapes](./prefer-unicode-codepoint-escapes.md) | enforce use of unicode codepoint escapes | :star::wrench: | | [regexp/prefer-w](./prefer-w.md) | enforce using `\w` | :star::wrench: | diff --git a/docs/rules/confusing-quantifier.md b/docs/rules/confusing-quantifier.md index a908363e8..ef7c9e3e4 100644 --- a/docs/rules/confusing-quantifier.md +++ b/docs/rules/confusing-quantifier.md @@ -9,6 +9,8 @@ since: "v0.8.0" > disallow confusing quantifiers +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details Confusing quantifiers are ones which imply one thing but don't deliver on that. diff --git a/docs/rules/letter-case.md b/docs/rules/letter-case.md index f62165b29..a2ac41c3f 100644 --- a/docs/rules/letter-case.md +++ b/docs/rules/letter-case.md @@ -42,8 +42,8 @@ var foo = /\ca/ "regexp/letter-case": ["error", { "caseInsensitive": "lowercase", // or "uppercase" or "ignore" "unicodeEscape": "lowercase", // or "uppercase" or "ignore" - "hexadecimalEscape": "ignore", // or "lowercase" or "uppercase" - "controlEscape": "ignore", // or "lowercase" or "uppercase" + "hexadecimalEscape": "lowercase", // or "uppercase" or "ignore" + "controlEscape": "uppercase", // or "lowercase" or "ignore" }] } ``` @@ -55,10 +55,8 @@ var foo = /\ca/ - Properties - `caseInsensitive` ... Specifies the letter case when the `i` flag is present. Default is `"lowercase"`. - `unicodeEscape` ... Specifies the letter case when the unicode escapes. Default is `"lowercase"`. - - `hexadecimalEscape` ... Specifies the letter case when the hexadecimal escapes. Default is `"ignore"`. - (The default value will change to `"lowercase"` in the next major version.) - - `controlEscape` ... Specifies the letter case when the control escapes (e.g. `\cX`). Default is `"ignore"`. - (The default value will change to `"uppercase"` in the next major version.) + - `hexadecimalEscape` ... Specifies the letter case when the hexadecimal escapes. Default is `"ignolowercasere"`. + - `controlEscape` ... Specifies the letter case when the control escapes (e.g. `\cX`). Default is `"uppercase"`. ## :rocket: Version diff --git a/docs/rules/negation.md b/docs/rules/negation.md index d29fa6f03..aba8bef31 100644 --- a/docs/rules/negation.md +++ b/docs/rules/negation.md @@ -9,6 +9,7 @@ since: "v0.4.0" > enforce use of escapes on negation +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/docs/rules/no-dupe-disjunctions.md b/docs/rules/no-dupe-disjunctions.md index 9c17f2dd3..f10d0b324 100644 --- a/docs/rules/no-dupe-disjunctions.md +++ b/docs/rules/no-dupe-disjunctions.md @@ -9,6 +9,8 @@ since: "v0.4.0" > disallow duplicate disjunctions +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details This rule disallows duplicate disjunctions. diff --git a/docs/rules/no-empty-alternative.md b/docs/rules/no-empty-alternative.md index 74514f1f0..94ed9b8ed 100644 --- a/docs/rules/no-empty-alternative.md +++ b/docs/rules/no-empty-alternative.md @@ -9,6 +9,8 @@ since: "v0.8.0" > disallow alternatives without elements +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details While (re-)writing long regular expressions, it can happen that one forgets to diff --git a/docs/rules/no-lazy-ends.md b/docs/rules/no-lazy-ends.md index 6276ec600..88acbac11 100644 --- a/docs/rules/no-lazy-ends.md +++ b/docs/rules/no-lazy-ends.md @@ -9,6 +9,8 @@ since: "v0.8.0" > disallow lazy quantifiers at the end of an expression +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details If a lazily quantified element is the last element matched by an expression diff --git a/docs/rules/no-legacy-features.md b/docs/rules/no-legacy-features.md index 389f9be81..8ead657c2 100644 --- a/docs/rules/no-legacy-features.md +++ b/docs/rules/no-legacy-features.md @@ -9,6 +9,8 @@ since: "v0.6.0" > disallow legacy RegExp features +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details This rule disallow legacy RegExp features. diff --git a/docs/rules/no-unused-capturing-group.md b/docs/rules/no-unused-capturing-group.md index fa0dc3bfd..b960e8fd5 100644 --- a/docs/rules/no-unused-capturing-group.md +++ b/docs/rules/no-unused-capturing-group.md @@ -9,6 +9,8 @@ since: "v0.6.0" > disallow unused capturing group +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details This rule aims to optimize regular expressions by replacing unused capturing groups with non-capturing groups. diff --git a/docs/rules/no-useless-character-class.md b/docs/rules/no-useless-character-class.md index 732ca222c..1db511c29 100644 --- a/docs/rules/no-useless-character-class.md +++ b/docs/rules/no-useless-character-class.md @@ -9,6 +9,7 @@ since: "v0.3.0" > disallow character class with one character +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/docs/rules/no-useless-dollar-replacements.md b/docs/rules/no-useless-dollar-replacements.md index c009e3485..0198956ff 100644 --- a/docs/rules/no-useless-dollar-replacements.md +++ b/docs/rules/no-useless-dollar-replacements.md @@ -9,6 +9,8 @@ since: "v0.6.0" > disallow useless `$` replacements in replacement string +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details This rule aims to detect and disallow useless `$` replacements in regular expression replacements. diff --git a/docs/rules/no-useless-escape.md b/docs/rules/no-useless-escape.md index b391ac4ee..a8849d3a0 100644 --- a/docs/rules/no-useless-escape.md +++ b/docs/rules/no-useless-escape.md @@ -9,6 +9,8 @@ since: "v0.4.0" > disallow unnecessary escape characters in RegExp +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details This rule reports unnecessary escape characters in RegExp. diff --git a/docs/rules/no-useless-non-capturing-group.md b/docs/rules/no-useless-non-capturing-group.md index 9495574e2..2fb10a2d6 100644 --- a/docs/rules/no-useless-non-capturing-group.md +++ b/docs/rules/no-useless-non-capturing-group.md @@ -9,6 +9,7 @@ since: "v0.4.0" > disallow unnecessary Non-capturing group +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/docs/rules/no-useless-range.md b/docs/rules/no-useless-range.md index c4e12781d..f57b9a703 100644 --- a/docs/rules/no-useless-range.md +++ b/docs/rules/no-useless-range.md @@ -9,6 +9,7 @@ since: "v0.3.0" > disallow unnecessary range of characters by using a hyphen +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/docs/rules/optimal-lookaround-quantifier.md b/docs/rules/optimal-lookaround-quantifier.md index 95c0acf21..424c73396 100644 --- a/docs/rules/optimal-lookaround-quantifier.md +++ b/docs/rules/optimal-lookaround-quantifier.md @@ -9,6 +9,8 @@ since: "v0.8.0" > disallow the alternatives of lookarounds that end with a non-constant quantifier +- :gear: This rule is included in `"plugin:regexp/recommended"`. + ## :book: Rule Details Non-constant quantifiers are quantifiers that describe a range (e.g. `?`, `*`, diff --git a/docs/rules/prefer-character-class.md b/docs/rules/prefer-character-class.md index 4f189b1d3..f88b1a92a 100644 --- a/docs/rules/prefer-character-class.md +++ b/docs/rules/prefer-character-class.md @@ -9,6 +9,7 @@ since: "v0.4.0" > enforce using character class +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/docs/rules/prefer-range.md b/docs/rules/prefer-range.md index f1344097a..bbacdc469 100644 --- a/docs/rules/prefer-range.md +++ b/docs/rules/prefer-range.md @@ -9,6 +9,7 @@ since: "v0.4.0" > enforce using character class range +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/docs/rules/prefer-unicode-codepoint-escapes.md b/docs/rules/prefer-unicode-codepoint-escapes.md index e096a79ce..7fa297e65 100644 --- a/docs/rules/prefer-unicode-codepoint-escapes.md +++ b/docs/rules/prefer-unicode-codepoint-escapes.md @@ -9,6 +9,7 @@ since: "v0.3.0" > enforce use of unicode codepoint escapes +- :gear: This rule is included in `"plugin:regexp/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details diff --git a/lib/configs/recommended.ts b/lib/configs/recommended.ts index d0dd64442..3580ee04e 100644 --- a/lib/configs/recommended.ts +++ b/lib/configs/recommended.ts @@ -5,6 +5,7 @@ export = { rules: { // ESLint core rules "no-control-regex": "error", + "no-empty-character-class": "error", "no-invalid-regexp": "error", "no-misleading-character-class": "error", "no-regex-spaces": "error", @@ -15,21 +16,37 @@ export = { : "regexp/no-useless-backreference"]: "error", // eslint-plugin-regexp rules + "regexp/confusing-quantifier": "warn", "regexp/match-any": "error", + "regexp/negation": "error", "regexp/no-assertion-capturing-group": "error", "regexp/no-dupe-characters-character-class": "error", + "regexp/no-dupe-disjunctions": "error", + "regexp/no-empty-alternative": "warn", "regexp/no-empty-group": "error", "regexp/no-empty-lookarounds-assertion": "error", "regexp/no-escape-backspace": "error", "regexp/no-invisible-character": "error", + "regexp/no-lazy-ends": "warn", + "regexp/no-legacy-features": "error", "regexp/no-octal": "error", + "regexp/no-unused-capturing-group": "error", + "regexp/no-useless-character-class": "error", + "regexp/no-useless-dollar-replacements": "error", + "regexp/no-useless-escape": "error", "regexp/no-useless-exactly-quantifier": "error", + "regexp/no-useless-non-capturing-group": "error", + "regexp/no-useless-range": "error", "regexp/no-useless-two-nums-quantifier": "error", + "regexp/optimal-lookaround-quantifier": "warn", + "regexp/prefer-character-class": "error", "regexp/prefer-d": "error", "regexp/prefer-plus-quantifier": "error", "regexp/prefer-question-quantifier": "error", + "regexp/prefer-range": "error", "regexp/prefer-star-quantifier": "error", "regexp/prefer-t": "error", + "regexp/prefer-unicode-codepoint-escapes": "error", "regexp/prefer-w": "error", }, } diff --git a/lib/rules/confusing-quantifier.ts b/lib/rules/confusing-quantifier.ts index e6efe7f64..ec48b953e 100644 --- a/lib/rules/confusing-quantifier.ts +++ b/lib/rules/confusing-quantifier.ts @@ -13,9 +13,7 @@ export default createRule("confusing-quantifier", { meta: { docs: { description: "disallow confusing quantifiers", - // TODO Switch to recommended in the major version. - // recommended: true, - recommended: false, + recommended: true, default: "warn", }, schema: [], diff --git a/lib/rules/letter-case.ts b/lib/rules/letter-case.ts index 506261c44..bf32527cf 100644 --- a/lib/rules/letter-case.ts +++ b/lib/rules/letter-case.ts @@ -17,11 +17,8 @@ type Case = typeof CASE_SCHEMA[number] const DEFAULTS = { caseInsensitive: "lowercase" as const, unicodeEscape: "lowercase" as const, - // TODO In the major version - // hexadecimalEscape: "lowercase" as const, - // controlEscape: "uppercase" as const, - hexadecimalEscape: "ignore" as const, - controlEscape: "ignore" as const, + hexadecimalEscape: "lowercase" as const, + controlEscape: "uppercase" as const, } /** Parse option */ diff --git a/lib/rules/negation.ts b/lib/rules/negation.ts index d11cddd7a..610b17e45 100644 --- a/lib/rules/negation.ts +++ b/lib/rules/negation.ts @@ -15,9 +15,7 @@ export default createRule("negation", { meta: { docs: { description: "enforce use of escapes on negation", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, fixable: "code", schema: [], diff --git a/lib/rules/no-dupe-disjunctions.ts b/lib/rules/no-dupe-disjunctions.ts index c99745efe..2190167e5 100644 --- a/lib/rules/no-dupe-disjunctions.ts +++ b/lib/rules/no-dupe-disjunctions.ts @@ -14,9 +14,7 @@ export default createRule("no-dupe-disjunctions", { meta: { docs: { description: "disallow duplicate disjunctions", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, schema: [ { diff --git a/lib/rules/no-empty-alternative.ts b/lib/rules/no-empty-alternative.ts index a27e6c252..91e70e115 100644 --- a/lib/rules/no-empty-alternative.ts +++ b/lib/rules/no-empty-alternative.ts @@ -7,9 +7,7 @@ export default createRule("no-empty-alternative", { meta: { docs: { description: "disallow alternatives without elements", - // TODO Switch to recommended in the major version. - // recommended: true, - recommended: false, + recommended: true, default: "warn", }, schema: [], diff --git a/lib/rules/no-lazy-ends.ts b/lib/rules/no-lazy-ends.ts index 1a6fd34a9..c0b7bd511 100644 --- a/lib/rules/no-lazy-ends.ts +++ b/lib/rules/no-lazy-ends.ts @@ -46,9 +46,7 @@ export default createRule("no-lazy-ends", { docs: { description: "disallow lazy quantifiers at the end of an expression", - // TODO Switch to recommended in the major version. - // recommended: true, - recommended: false, + recommended: true, default: "warn", }, schema: [], diff --git a/lib/rules/no-legacy-features.ts b/lib/rules/no-legacy-features.ts index b696edcda..67968e3b1 100644 --- a/lib/rules/no-legacy-features.ts +++ b/lib/rules/no-legacy-features.ts @@ -53,9 +53,7 @@ export default createRule("no-legacy-features", { meta: { docs: { description: "disallow legacy RegExp features", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, schema: [ { diff --git a/lib/rules/no-unused-capturing-group.ts b/lib/rules/no-unused-capturing-group.ts index 64e40936e..2bf4a263b 100644 --- a/lib/rules/no-unused-capturing-group.ts +++ b/lib/rules/no-unused-capturing-group.ts @@ -298,7 +298,7 @@ export default createRule("no-unused-capturing-group", { meta: { docs: { description: "disallow unused capturing group", - recommended: false, + recommended: true, }, schema: [], messages: { diff --git a/lib/rules/no-useless-character-class.ts b/lib/rules/no-useless-character-class.ts index adff4adf3..43db149ef 100644 --- a/lib/rules/no-useless-character-class.ts +++ b/lib/rules/no-useless-character-class.ts @@ -12,9 +12,7 @@ export default createRule("no-useless-character-class", { meta: { docs: { description: "disallow character class with one character", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, fixable: "code", schema: [ diff --git a/lib/rules/no-useless-dollar-replacements.ts b/lib/rules/no-useless-dollar-replacements.ts index 13a556cee..3b4e39fe1 100644 --- a/lib/rules/no-useless-dollar-replacements.ts +++ b/lib/rules/no-useless-dollar-replacements.ts @@ -24,7 +24,7 @@ export default createRule("no-useless-dollar-replacements", { docs: { description: "disallow useless `$` replacements in replacement string", - recommended: false, + recommended: true, }, schema: [], messages: { diff --git a/lib/rules/no-useless-escape.ts b/lib/rules/no-useless-escape.ts index e3de01373..1dd7293f3 100644 --- a/lib/rules/no-useless-escape.ts +++ b/lib/rules/no-useless-escape.ts @@ -51,9 +51,7 @@ export default createRule("no-useless-escape", { meta: { docs: { description: "disallow unnecessary escape characters in RegExp", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, schema: [], messages: { diff --git a/lib/rules/no-useless-non-capturing-group.ts b/lib/rules/no-useless-non-capturing-group.ts index cc44c119b..2d798d526 100644 --- a/lib/rules/no-useless-non-capturing-group.ts +++ b/lib/rules/no-useless-non-capturing-group.ts @@ -12,9 +12,7 @@ export default createRule("no-useless-non-capturing-group", { meta: { docs: { description: "disallow unnecessary Non-capturing group", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, fixable: "code", schema: [], diff --git a/lib/rules/no-useless-range.ts b/lib/rules/no-useless-range.ts index ff42b084d..1a18c7a6f 100644 --- a/lib/rules/no-useless-range.ts +++ b/lib/rules/no-useless-range.ts @@ -12,8 +12,7 @@ export default createRule("no-useless-range", { docs: { description: "disallow unnecessary range of characters by using a hyphen", - // TODO In the major version, it will be changed to "recommended". - recommended: false, + recommended: true, }, fixable: "code", schema: [], diff --git a/lib/rules/optimal-lookaround-quantifier.ts b/lib/rules/optimal-lookaround-quantifier.ts index ad8a5c901..ab4d4e3a8 100644 --- a/lib/rules/optimal-lookaround-quantifier.ts +++ b/lib/rules/optimal-lookaround-quantifier.ts @@ -46,9 +46,7 @@ export default createRule("optimal-lookaround-quantifier", { docs: { description: "disallow the alternatives of lookarounds that end with a non-constant quantifier", - // TODO Switch to recommended in the major version. - // recommended: true, - recommended: false, + recommended: true, default: "warn", }, schema: [], diff --git a/lib/rules/prefer-character-class.ts b/lib/rules/prefer-character-class.ts index 799900d8b..90583e91b 100644 --- a/lib/rules/prefer-character-class.ts +++ b/lib/rules/prefer-character-class.ts @@ -21,9 +21,7 @@ export default createRule("prefer-character-class", { meta: { docs: { description: "enforce using character class", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, fixable: "code", schema: [], diff --git a/lib/rules/prefer-range.ts b/lib/rules/prefer-range.ts index bd5e0cc94..b7801b401 100644 --- a/lib/rules/prefer-range.ts +++ b/lib/rules/prefer-range.ts @@ -48,9 +48,7 @@ export default createRule("prefer-range", { meta: { docs: { description: "enforce using character class range", - // TODO In the major version - // recommended: true, - recommended: false, + recommended: true, }, fixable: "code", schema: [ diff --git a/lib/rules/prefer-unicode-codepoint-escapes.ts b/lib/rules/prefer-unicode-codepoint-escapes.ts index a18c4306f..64138b56e 100644 --- a/lib/rules/prefer-unicode-codepoint-escapes.ts +++ b/lib/rules/prefer-unicode-codepoint-escapes.ts @@ -11,8 +11,7 @@ export default createRule("prefer-unicode-codepoint-escapes", { meta: { docs: { description: "enforce use of unicode codepoint escapes", - // TODO In the major version, it will be changed to "recommended". - recommended: false, + recommended: true, }, fixable: "code", schema: [], diff --git a/tests/lib/rules/letter-case.ts b/tests/lib/rules/letter-case.ts index d79d36ab9..1d658f04d 100644 --- a/tests/lib/rules/letter-case.ts +++ b/tests/lib/rules/letter-case.ts @@ -217,12 +217,11 @@ tester.run("letter-case", rule as any, { options: [{ unicodeEscape: "uppercase" }], errors: [String.raw`'\u{a}' is not in uppercase`], }, - // TODO In the major version - // { - // code: String.raw`/\x0A/`, - // output: String.raw`/\x0a/`, - // errors: [String.raw`'\x0A' is not in lowercase`], - // }, + { + code: String.raw`/\x0A/`, + output: String.raw`/\x0a/`, + errors: [String.raw`'\x0A' is not in lowercase`], + }, { code: String.raw`/\x0A/`, output: String.raw`/\x0a/`, @@ -235,12 +234,11 @@ tester.run("letter-case", rule as any, { options: [{ hexadecimalEscape: "uppercase" }], errors: [String.raw`'\x0a' is not in uppercase`], }, - // TODO In the major version - // { - // code: String.raw`/\ca/u`, - // output: String.raw`/\cA/u`, - // errors: [String.raw`'\ca' is not in uppercase`], - // }, + { + code: String.raw`/\ca/u`, + output: String.raw`/\cA/u`, + errors: [String.raw`'\ca' is not in uppercase`], + }, { code: String.raw`/\cA/u`, output: String.raw`/\ca/u`, diff --git a/tools/update-rulesets.ts b/tools/update-rulesets.ts index a586d2c3f..4cebeff90 100644 --- a/tools/update-rulesets.ts +++ b/tools/update-rulesets.ts @@ -8,8 +8,7 @@ const isWin = os.platform().startsWith("win") const coreRules = [ // Possible Errors "no-control-regex", - // TODO In the major version - // "no-empty-character-class", + "no-empty-character-class", "no-invalid-regexp", "no-misleading-character-class", "no-regex-spaces",