Skip to content

Commit

Permalink
Add support for flat config (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Mar 9, 2024
1 parent eb3c724 commit 5a11e3c
Show file tree
Hide file tree
Showing 84 changed files with 518 additions and 384 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-taxis-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-regexp": minor
---

Add support for flat config
9 changes: 6 additions & 3 deletions .eslint-doc-generatorrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/** @type {import('eslint-doc-generator').GenerateOptions} */
const config = {
configFormat: 'plugin-colon-prefix-name',
ignoreConfig: ['all'],
const config = {
ignoreConfig: ['all', 'flat/all'],
configEmoji: [
["recommended", "🔵"],
["flat/recommended", "🟢"],
],
pathRuleList: ['README.md', 'docs/rules/index.md'],
ruleDocSectionInclude: ['Rule Details', 'Version', 'Implementation'],
ruleDocSectionOptions: false,
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
!/.vscode
!/.github
/tests/fixtures/integrations/eslint-plugin/test.js
/tests/fixtures/integrations/eslint-plugin-legacy-config/test.js
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ module.exports = {
"regexp/unicode-escape": "error",
},
overrides: [
{
files: ["*.mjs"],
parserOptions: {
sourceType: "module",
},
},
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
Expand All @@ -127,6 +133,7 @@ module.exports = {
rules: {
"require-jsdoc": "off",
"no-console": "off",
"n/file-extension-in-import": "off",
},
},
{
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
# run: npm ci
# We use `npm i` because there is an error regarding dependencies when installing eslint v9-alpha.
run: npm i -f
- name: Build
run: npm run build
- name: Test
run: npm test
test-and-coverage:
Expand All @@ -46,6 +48,8 @@ jobs:
- uses: actions/setup-node@v4
- name: Install Packages
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test:nyc
- name: Coveralls GitHub Action
Expand Down
220 changes: 125 additions & 95 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/rules/confusing-quantifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.8.0"
---
# regexp/confusing-quantifier

⚠️ This rule _warns_ in the `plugin:regexp/recommended` config.
⚠️ This rule _warns_ in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/control-character-escape.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/control-character-escape

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
179 changes: 90 additions & 89 deletions docs/rules/index.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/rules/match-any.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/match-any

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/negation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.4.0"
---
# regexp/negation

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-contradiction-with-assertion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v1.2.0"
---
# regexp/no-contradiction-with-assertion

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-control-character.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v1.2.0"
---
# regexp/no-control-character

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-dupe-characters-character-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/no-dupe-characters-character-class

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-dupe-disjunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v0.4.0"
---
# regexp/no-dupe-disjunctions

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-empty-alternative.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v0.8.0"
---
# regexp/no-empty-alternative

⚠️ This rule _warns_ in the `plugin:regexp/recommended` config.
⚠️ This rule _warns_ in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-capturing-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.12.0"
---
# regexp/no-empty-capturing-group

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-character-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v1.2.0"
---
# regexp/no-empty-character-class

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/no-empty-group

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-lookarounds-assertion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/no-empty-lookarounds-assertion

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-string-literal.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v2.0.0-next.11"
---
# regexp/no-empty-string-literal

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-escape-backspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v0.1.0"
---
# regexp/no-escape-backspace

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-extra-lookaround-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v1.11.0"
---
# regexp/no-extra-lookaround-assertions

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-invalid-regexp.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v1.0.0"
---
# regexp/no-invalid-regexp

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-invisible-character.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/no-invisible-character

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-lazy-ends.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v0.8.0"
---
# regexp/no-lazy-ends

⚠️ This rule _warns_ in the `plugin:regexp/recommended` config.
⚠️ This rule _warns_ in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-legacy-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.6.0"
---
# regexp/no-legacy-features

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-misleading-capturing-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v1.12.0"
---
# regexp/no-misleading-capturing-group

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-misleading-unicode-character.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v1.2.0"
---
# regexp/no-misleading-unicode-character

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-missing-g-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v1.10.0"
---
# regexp/no-missing-g-flag

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-non-standard-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/no-non-standard-flag

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-obscure-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/no-obscure-range

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-octal.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/no-octal

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-optional-assertion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/no-optional-assertion

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-potentially-useless-backreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/no-potentially-useless-backreference

⚠️ This rule _warns_ in the `plugin:regexp/recommended` config.
⚠️ This rule _warns_ in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-super-linear-backtracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.13.0"
---
# regexp/no-super-linear-backtracking

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-trivially-nested-assertion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/no-trivially-nested-assertion

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-trivially-nested-quantifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.9.0"
---
# regexp/no-trivially-nested-quantifier

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-unused-capturing-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v0.6.0"
---
# regexp/no-unused-capturing-group

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-useless-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ since: "v0.9.0"
---
# regexp/no-useless-assertions

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-useless-backreference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ since: "v0.1.0"
---
# regexp/no-useless-backreference

💼 This rule is enabled in the `plugin:regexp/recommended` config.
💼 This rule is enabled in the following configs: 🟢 `flat/recommended`, 🔵 `recommended`.

<!-- end auto-generated rule header -->

Expand Down
Loading

0 comments on commit 5a11e3c

Please sign in to comment.