Skip to content

Conversation

Tanujkanti4441
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

no-invalid-regexp rule doesn't report duplicate flags that are allowed by the allowConstructorFlags option.

/*eslint no-invalid-regexp: ["error", { "allowConstructorFlags": ["a"] }]*/

new RegExp('.', 'aa'); // not reported

made the rule to report these flags

Is there anything you'd like reviewers to focus on?

Fixes #18748

@Tanujkanti4441 Tanujkanti4441 requested a review from a team as a code owner August 5, 2024 17:00
@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Aug 5, 2024
Copy link

netlify bot commented Aug 5, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 761c148
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/66d1e622cc1208000840a7e7

@github-actions github-actions bot added the rule Relates to ESLint's core rules label Aug 5, 2024
@amareshsm amareshsm added the accepted There is consensus among the team that this change meets the criteria for inclusion label Aug 5, 2024
aladdin-add
aladdin-add previously approved these changes Aug 6, 2024
Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Would like another review before merging.

@Tanujkanti4441
Copy link
Contributor Author

@aladdin-add, right now it is allowed to pass duplicate strings to allowConstructorFlags which can also lead to allow duplicate flags in regex constructor i think this should also be fixed or is it intentional?

@aladdin-add
Copy link
Member

IMHO, it seems a bug - I didn't see it's covered by the tests. it can be easily fixed by adding uniqueItems: true, however it's a breaking change, so we have to wait until eslint v10. Can you create another issue?

@Tanujkanti4441
Copy link
Contributor Author

IMHO, it seems a bug - I didn't see it's covered by the tests. it can be easily fixed by adding uniqueItems: true, however it's a breaking change, so we have to wait until eslint v10. Can you create another issue?

have created the issue => #18755

@mdjermanovic mdjermanovic changed the title fix: duplicate allowed flags in no-invalid-regexp feat: report duplicate allowed flags in no-invalid-regexp Aug 22, 2024
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Aug 22, 2024
@mdjermanovic
Copy link
Member

I changed the tag to feat because this produces more lint errors.

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fasttime fasttime merged commit c69b406 into eslint:main Aug 31, 2024
19 checks passed
@Tanujkanti4441 Tanujkanti4441 deleted the fix-flag branch August 31, 2024 09:58
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Sep 10, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | devDependencies | minor | [`9.8.0` -> `9.10.0`](https://renovatebot.com/diffs/npm/eslint/9.8.0/9.10.0) |
| [@types/eslint](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/eslint)) | devDependencies | patch | [`9.6.0` -> `9.6.1`](https://renovatebot.com/diffs/npm/@types%2feslint/9.6.0/9.6.1) |

---

### Release Notes

<details>
<summary>eslint/eslint (eslint)</summary>

### [`v9.10.0`](https://github.com/eslint/eslint/releases/tag/v9.10.0)

[Compare Source](eslint/eslint@v9.9.1...v9.10.0)

#### Features

-   [`301b90d`](eslint/eslint@301b90d) feat: Add types ([#&#8203;18854](eslint/eslint#18854)) (Nicholas C. Zakas)
-   [`bcf0df5`](eslint/eslint@bcf0df5) feat: limit namespace import identifier in id-length rule ([#&#8203;18849](eslint/eslint#18849)) (ChaedongIm)
-   [`45c18e1`](eslint/eslint@45c18e1) feat: add `requireFlag` option to `require-unicode-regexp` rule ([#&#8203;18836](eslint/eslint#18836)) (Brett Zamir)
-   [`183b459`](eslint/eslint@183b459) feat: add error message for duplicate flags in `no-invalid-regexp` ([#&#8203;18837](eslint/eslint#18837)) (Tanuj Kanti)
-   [`c69b406`](eslint/eslint@c69b406) feat: report duplicate allowed flags in `no-invalid-regexp` ([#&#8203;18754](eslint/eslint#18754)) (Tanuj Kanti)

#### Documentation

-   [`bee0e7a`](eslint/eslint@bee0e7a) docs: update README ([#&#8203;18865](eslint/eslint#18865)) (Milos Djermanovic)
-   [`5d80b59`](eslint/eslint@5d80b59) docs: specify that `ruleId` can be `null` in custom formatter docs ([#&#8203;18857](eslint/eslint#18857)) (Milos Djermanovic)
-   [`156b1c3`](eslint/eslint@156b1c3) docs: Update README (GitHub Actions Bot)
-   [`f6fdef9`](eslint/eslint@f6fdef9) docs: Update README (GitHub Actions Bot)
-   [`a20c870`](eslint/eslint@a20c870) docs: Update README (GitHub Actions Bot)
-   [`90e699b`](eslint/eslint@90e699b) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`24c3ff7`](eslint/eslint@24c3ff7) chore: upgrade to [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;9](https://github.com/9).10.0 ([#&#8203;18866](eslint/eslint#18866)) (Francesco Trotta)
-   [`1ebdde1`](eslint/eslint@1ebdde1) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`e8fc5bd`](eslint/eslint@e8fc5bd) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.5.0 ([#&#8203;18848](eslint/eslint#18848)) (renovate\[bot])
-   [`343f992`](eslint/eslint@343f992) refactor: don't use `node.value` when removing unused directives ([#&#8203;18835](eslint/eslint#18835)) (Milos Djermanovic)
-   [`3db18b0`](eslint/eslint@3db18b0) refactor: Extract FileContext into class ([#&#8203;18831](eslint/eslint#18831)) (Nicholas C. Zakas)
-   [`931d650`](eslint/eslint@931d650) refactor: Use [@&#8203;eslint/plugin-kit](https://github.com/eslint/plugin-kit) ([#&#8203;18822](eslint/eslint#18822)) (Nicholas C. Zakas)
-   [`ed5cf0c`](eslint/eslint@ed5cf0c) chore: update dependency [@&#8203;eslint/json](https://github.com/eslint/json) to ^0.4.0 ([#&#8203;18829](eslint/eslint#18829)) (Milos Djermanovic)
-   [`d1f0831`](eslint/eslint@d1f0831) chore: added missing ids ([#&#8203;18817](eslint/eslint#18817)) (Strek)
-   [`ec92813`](eslint/eslint@ec92813) refactor: Config class ([#&#8203;18763](eslint/eslint#18763)) (Nicholas C. Zakas)

### [`v9.9.1`](https://github.com/eslint/eslint/releases/tag/v9.9.1)

[Compare Source](eslint/eslint@v9.9.0...v9.9.1)

#### Bug Fixes

-   [`9bde90c`](eslint/eslint@9bde90c) fix: add logic to handle `fixTypes` in `lintText()` ([#&#8203;18736](eslint/eslint#18736)) (Amaresh  S M)

#### Documentation

-   [`4840930`](eslint/eslint@4840930) docs: Update README with version support and clean up content ([#&#8203;18804](eslint/eslint#18804)) (Nicholas C. Zakas)
-   [`f61f40d`](eslint/eslint@f61f40d) docs: Update globals examples ([#&#8203;18805](eslint/eslint#18805)) (Nicholas C. Zakas)
-   [`241fcea`](eslint/eslint@241fcea) docs: Use and define languages ([#&#8203;18795](eslint/eslint#18795)) (Nicholas C. Zakas)
-   [`5dbdd63`](eslint/eslint@5dbdd63) docs: eslint-plugin-markdown -> [@&#8203;eslint/markdown](https://github.com/eslint/markdown) ([#&#8203;18797](eslint/eslint#18797)) (Nicholas C. Zakas)
-   [`c6c8ddd`](eslint/eslint@c6c8ddd) docs: update links to eslint-visitor-keys repo ([#&#8203;18796](eslint/eslint#18796)) (Francesco Trotta)
-   [`f981d05`](eslint/eslint@f981d05) docs: Update README (GitHub Actions Bot)
-   [`b516974`](eslint/eslint@b516974) docs: update links to `eslint/js` repo ([#&#8203;18781](eslint/eslint#18781)) (Francesco Trotta)
-   [`fb7a3f5`](eslint/eslint@fb7a3f5) docs: update note for package managers ([#&#8203;18779](eslint/eslint#18779)) (Jay)

#### Chores

-   [`b0c34d0`](eslint/eslint@b0c34d0) chore: upgrade to [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;9](https://github.com/9).9.1 ([#&#8203;18809](eslint/eslint#18809)) (Francesco Trotta)
-   [`cd5a0da`](eslint/eslint@cd5a0da) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`e112642`](eslint/eslint@e112642) refactor: Extract parsing logic from Linter ([#&#8203;18790](eslint/eslint#18790)) (Nicholas C. Zakas)
-   [`0f68a85`](eslint/eslint@0f68a85) chore: use eslint-plugin-yml on yaml files only ([#&#8203;18801](eslint/eslint#18801)) (Milos Djermanovic)
-   [`f8d1b3c`](eslint/eslint@f8d1b3c) chore: update dependencies for browser tests ([#&#8203;18794](eslint/eslint#18794)) (Christian Bromann)
-   [`aed2624`](eslint/eslint@aed2624) chore: update dependency [@&#8203;eslint/config-array](https://github.com/eslint/config-array) to ^0.18.0 ([#&#8203;18788](eslint/eslint#18788)) (renovate\[bot])
-   [`5c29128`](eslint/eslint@5c29128) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.4.0 ([#&#8203;18789](eslint/eslint#18789)) (renovate\[bot])
-   [`5d66fb2`](eslint/eslint@5d66fb2) chore: migrate linting workflow to use trunk check meta-linter ([#&#8203;18643](eslint/eslint#18643)) (Chris Clearwater)
-   [`bf96855`](eslint/eslint@bf96855) chore: add ids to github issue templates ([#&#8203;18775](eslint/eslint#18775)) (Strek)

### [`v9.9.0`](https://github.com/eslint/eslint/releases/tag/v9.9.0)

[Compare Source](eslint/eslint@v9.8.0...v9.9.0)

#### Features

-   [`41d0206`](eslint/eslint@41d0206) feat: Add support for TS config files ([#&#8203;18134](eslint/eslint#18134)) (Arya Emami)
-   [`3a4eaf9`](eslint/eslint@3a4eaf9) feat: add suggestion to `require-await` to remove `async` keyword ([#&#8203;18716](eslint/eslint#18716)) (Dave)

#### Documentation

-   [`9fe068c`](eslint/eslint@9fe068c) docs: how to author plugins with configs that extend other configs ([#&#8203;18753](eslint/eslint#18753)) (Alec Gibson)
-   [`48117b2`](eslint/eslint@48117b2) docs: add version support page in the side navbar ([#&#8203;18738](eslint/eslint#18738)) (Amaresh  S M)
-   [`fec2951`](eslint/eslint@fec2951) docs: add version support page to the dropdown ([#&#8203;18730](eslint/eslint#18730)) (Amaresh  S M)
-   [`38a0661`](eslint/eslint@38a0661) docs: Fix typo ([#&#8203;18735](eslint/eslint#18735)) (Zaina Al Habash)
-   [`3c32a9e`](eslint/eslint@3c32a9e) docs: Update yarn command for creating ESLint config ([#&#8203;18739](eslint/eslint#18739)) (Temitope Ogunleye)
-   [`f9ac978`](eslint/eslint@f9ac978) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`461b2c3`](eslint/eslint@461b2c3) chore: upgrade to `@eslint/js@9.9.0` ([#&#8203;18765](eslint/eslint#18765)) (Francesco Trotta)
-   [`59dba1b`](eslint/eslint@59dba1b) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`fea8563`](eslint/eslint@fea8563) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.3.0 ([#&#8203;18724](eslint/eslint#18724)) (renovate\[bot])
-   [`aac191e`](eslint/eslint@aac191e) chore: update dependency [@&#8203;eslint/json](https://github.com/eslint/json) to ^0.3.0 ([#&#8203;18760](eslint/eslint#18760)) (renovate\[bot])
-   [`b97fa05`](eslint/eslint@b97fa05) chore: update wdio dependencies for more stable tests ([#&#8203;18759](eslint/eslint#18759)) (Christian Bromann)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/215
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Sep 10, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@eslint/js](https://eslint.org) ([source](https://github.com/eslint/eslint/tree/HEAD/packages/js)) | devDependencies | minor | [`9.9.1` -> `9.10.0`](https://renovatebot.com/diffs/npm/@eslint%2fjs/9.9.1/9.10.0) |

---

### Release Notes

<details>
<summary>eslint/eslint (@&#8203;eslint/js)</summary>

### [`v9.10.0`](https://github.com/eslint/eslint/releases/tag/v9.10.0)

[Compare Source](eslint/eslint@v9.9.1...v9.10.0)

#### Features

-   [`301b90d`](eslint/eslint@301b90d) feat: Add types ([#&#8203;18854](eslint/eslint#18854)) (Nicholas C. Zakas)
-   [`bcf0df5`](eslint/eslint@bcf0df5) feat: limit namespace import identifier in id-length rule ([#&#8203;18849](eslint/eslint#18849)) (ChaedongIm)
-   [`45c18e1`](eslint/eslint@45c18e1) feat: add `requireFlag` option to `require-unicode-regexp` rule ([#&#8203;18836](eslint/eslint#18836)) (Brett Zamir)
-   [`183b459`](eslint/eslint@183b459) feat: add error message for duplicate flags in `no-invalid-regexp` ([#&#8203;18837](eslint/eslint#18837)) (Tanuj Kanti)
-   [`c69b406`](eslint/eslint@c69b406) feat: report duplicate allowed flags in `no-invalid-regexp` ([#&#8203;18754](eslint/eslint#18754)) (Tanuj Kanti)

#### Documentation

-   [`bee0e7a`](eslint/eslint@bee0e7a) docs: update README ([#&#8203;18865](eslint/eslint#18865)) (Milos Djermanovic)
-   [`5d80b59`](eslint/eslint@5d80b59) docs: specify that `ruleId` can be `null` in custom formatter docs ([#&#8203;18857](eslint/eslint#18857)) (Milos Djermanovic)
-   [`156b1c3`](eslint/eslint@156b1c3) docs: Update README (GitHub Actions Bot)
-   [`f6fdef9`](eslint/eslint@f6fdef9) docs: Update README (GitHub Actions Bot)
-   [`a20c870`](eslint/eslint@a20c870) docs: Update README (GitHub Actions Bot)
-   [`90e699b`](eslint/eslint@90e699b) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`24c3ff7`](eslint/eslint@24c3ff7) chore: upgrade to [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;9](https://github.com/9).10.0 ([#&#8203;18866](eslint/eslint#18866)) (Francesco Trotta)
-   [`1ebdde1`](eslint/eslint@1ebdde1) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`e8fc5bd`](eslint/eslint@e8fc5bd) chore: update dependency [@&#8203;eslint/core](https://github.com/eslint/core) to ^0.5.0 ([#&#8203;18848](eslint/eslint#18848)) (renovate\[bot])
-   [`343f992`](eslint/eslint@343f992) refactor: don't use `node.value` when removing unused directives ([#&#8203;18835](eslint/eslint#18835)) (Milos Djermanovic)
-   [`3db18b0`](eslint/eslint@3db18b0) refactor: Extract FileContext into class ([#&#8203;18831](eslint/eslint#18831)) (Nicholas C. Zakas)
-   [`931d650`](eslint/eslint@931d650) refactor: Use [@&#8203;eslint/plugin-kit](https://github.com/eslint/plugin-kit) ([#&#8203;18822](eslint/eslint#18822)) (Nicholas C. Zakas)
-   [`ed5cf0c`](eslint/eslint@ed5cf0c) chore: update dependency [@&#8203;eslint/json](https://github.com/eslint/json) to ^0.4.0 ([#&#8203;18829](eslint/eslint#18829)) (Milos Djermanovic)
-   [`d1f0831`](eslint/eslint@d1f0831) chore: added missing ids ([#&#8203;18817](eslint/eslint#18817)) (Strek)
-   [`ec92813`](eslint/eslint@ec92813) refactor: Config class ([#&#8203;18763](eslint/eslint#18763)) (Nicholas C. Zakas)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/226
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Bug: no-invalid-regexp not reporting repeted flag allowed by allowConstructorFlags
5 participants