diff --git a/docs/rules/index.md b/docs/rules/index.md index 73750c7f..44bc8b6a 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -10,6 +10,7 @@ There is a config that enables the rules in this category: [`no-new-in-esnext`] | Rule ID | Description | | |:--------|:------------|:--:| +| [es-x/no-regexp-duplicate-named-capturing-groups](./no-regexp-duplicate-named-capturing-groups.md) | disallow RegExp duplicate named capturing groups. | | | [es-x/no-set-prototype-difference](./no-set-prototype-difference.md) | disallow the `Set.prototype.difference` method. | | | [es-x/no-set-prototype-intersection](./no-set-prototype-intersection.md) | disallow the `Set.prototype.intersection` method. | | | [es-x/no-set-prototype-isdisjointfrom](./no-set-prototype-isdisjointfrom.md) | disallow the `Set.prototype.isDisjointFrom` method. | | diff --git a/docs/rules/no-regexp-duplicate-named-capturing-groups.md b/docs/rules/no-regexp-duplicate-named-capturing-groups.md index 6c6f1854..08f240a2 100644 --- a/docs/rules/no-regexp-duplicate-named-capturing-groups.md +++ b/docs/rules/no-regexp-duplicate-named-capturing-groups.md @@ -1,12 +1,13 @@ --- title: "es-x/no-regexp-duplicate-named-capturing-groups" description: "disallow RegExp duplicate named capturing groups" +since: "v7.8.0" --- # es-x/no-regexp-duplicate-named-capturing-groups > disallow RegExp duplicate named capturing groups -- ❗ ***This rule has not been released yet.*** +- ✅ The following configurations enable this rule: [no-new-in-esnext] This rule reports ES2025 [RegExp duplicate named capture groups](https://github.com/tc39/proposal-duplicate-named-capturing-groups) as errors. @@ -24,7 +25,13 @@ const r2 = /(?a)|(?b)/ +## 🚀 Version + +This rule was introduced in v7.8.0. + ## 📚 References - [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-regexp-duplicate-named-capturing-groups.js) - [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-regexp-duplicate-named-capturing-groups.js) + +[no-new-in-esnext]: ../configs/index.md#no-new-in-esnext diff --git a/lib/configs/flat/no-new-in-esnext.js b/lib/configs/flat/no-new-in-esnext.js index d3ccfd03..7f531e60 100644 --- a/lib/configs/flat/no-new-in-esnext.js +++ b/lib/configs/flat/no-new-in-esnext.js @@ -11,6 +11,7 @@ module.exports = { }, }, rules: { + "es-x/no-regexp-duplicate-named-capturing-groups": "error", "es-x/no-set-prototype-difference": "error", "es-x/no-set-prototype-intersection": "error", "es-x/no-set-prototype-isdisjointfrom": "error", diff --git a/lib/configs/no-new-in-esnext.js b/lib/configs/no-new-in-esnext.js index 7efb19b8..3a685340 100644 --- a/lib/configs/no-new-in-esnext.js +++ b/lib/configs/no-new-in-esnext.js @@ -7,6 +7,7 @@ module.exports = { plugins: ["es-x"], rules: { + "es-x/no-regexp-duplicate-named-capturing-groups": "error", "es-x/no-set-prototype-difference": "error", "es-x/no-set-prototype-intersection": "error", "es-x/no-set-prototype-isdisjointfrom": "error", diff --git a/lib/index.js b/lib/index.js index d2f73dbf..305eef8b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -268,6 +268,7 @@ module.exports = { "no-proxy": require("./rules/no-proxy"), "no-reflect": require("./rules/no-reflect"), "no-regexp-d-flag": require("./rules/no-regexp-d-flag"), + "no-regexp-duplicate-named-capturing-groups": require("./rules/no-regexp-duplicate-named-capturing-groups"), "no-regexp-lookbehind-assertions": require("./rules/no-regexp-lookbehind-assertions"), "no-regexp-named-capture-groups": require("./rules/no-regexp-named-capture-groups"), "no-regexp-prototype-compile": require("./rules/no-regexp-prototype-compile"), diff --git a/package.json b/package.json index 6ef32217..bcaa8e79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-es-x", - "version": "7.7.0", + "version": "7.8.0", "description": "ESLint plugin about ECMAScript syntactic features.", "engines": { "node": "^14.18.0 || >=16.0.0" diff --git a/scripts/fetch-lines.js b/scripts/fetch-lines.js index 6b21a5af..7fd07a6e 100644 --- a/scripts/fetch-lines.js +++ b/scripts/fetch-lines.js @@ -3,6 +3,6 @@ module.exports = { fetchLines } async function* fetchLines(url) { - const response = await fetch(url) // eslint-disable-line n/no-unsupported-features/node-builtins -- non-production code + const response = await fetch(url) yield* (await response.text()).split("\n") }