Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-invalid-regexp: Validate flags even for non-literal patterns #16573

Closed
1 task done
trosos opened this issue Nov 23, 2022 · 2 comments · Fixed by #16583
Closed
1 task done

no-invalid-regexp: Validate flags even for non-literal patterns #16573

trosos opened this issue Nov 23, 2022 · 2 comments · Fixed by #16583
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects

Comments

@trosos
Copy link
Contributor

trosos commented Nov 23, 2022

Hi,

The no-invalid-regexp rule skips flag validation for regexps with non-literal pattern.
I believe that flags should be validated no matter what the pattern is.

What rule do you want to change?

no-invalid-regexp

What change to do you want to make?

Generate more warnings

How do you think the change should be implemented?

A new default behavior

Example code

RegExp("." + "", "a");

What does the rule currently do for this code?

The rule skips flag validation and reports no issues.

What will the rule do after it's changed?

The rule should IMO report invalid flag.

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

No response

@trosos trosos added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules labels Nov 23, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Nov 23, 2022
@trosos trosos changed the title Rule Change: (fill in) no-invalid-regexp: Validate flags even for non-literal patterns Nov 23, 2022
@mdjermanovic mdjermanovic added bug ESLint is working incorrectly accepted There is consensus among the team that this change meets the criteria for inclusion labels Nov 23, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Ready to Implement in Triage Nov 23, 2022
@mdjermanovic
Copy link
Member

Hi @trosos, thanks for the issue!

The no-invalid-regexp rule skips flag validation for regexps with non-literal pattern.
I believe that flags should be validated no matter what the pattern is.

Makes sense, PR is welcome! I think we can treat this as a semver-minor bug fix.

@trosos
Copy link
Contributor Author

trosos commented Nov 25, 2022

Thank you, @mdjermanovic, for confirmation.
I am working on a fix right now.

@snitin315 snitin315 moved this from Ready to Implement to Pull Request Opened in Triage Nov 26, 2022
Triage automation moved this from Pull Request Opened to Complete Nov 27, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators May 27, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
Archived in project
Triage
Complete
Development

Successfully merging a pull request may close this issue.

2 participants