-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
What rule do you want to change?
prefer-regex-literals
Does this change cause the rule to produce more or fewer warnings?
It will produce more warnings.
How will the change be implemented? (New option, new default behavior, etc.)?
I think this makes sense as default behavior.
Please provide some example code that this change will affect:
const foo = new RegExp(/foo/);
What does the rule currently do for this code?
It is not recognized as a problem.
What will the rule do after it's changed?
The rule should report this as problem and suggest the following autofix:
-const foo = new RegExp(/foo/);
+const foo = /foo/;
Are you willing to submit a pull request to implement this change?
Yes
kaicataldo, g-plane and nzakas
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules