Disable sonarjs/prefer-regexp-exec and @typescript-eslint/prefer-regexp-exec#221
Merged
Disable sonarjs/prefer-regexp-exec and @typescript-eslint/prefer-regexp-exec#221
Conversation
| for (const value in [1, 2, 3]) { | ||
| // eslint-disable-next-line no-console | ||
| console.log(value); | ||
| const test = '/^[a-z]+$/u'; |
There was a problem hiding this comment.
Defining the regex as a string may lead to unexpected behavior since String.match() expects a RegExp object. Consider using a regex literal (e.g., /^[a-z]+$/u) or creating a RegExp object using new RegExp('^[a-z]+$', 'u').
Suggested change
| const test = '/^[a-z]+$/u'; | |
| const test = new RegExp('^[a-z]+$', 'u'); |
carlansley
requested changes
Apr 7, 2025
index.mjs
Outdated
| // typeof any === "evil". | ||
| '@typescript-eslint/no-explicit-any': 'error', | ||
|
|
||
| '@typescript-eslint/prefer-regexp-exec': 'off', // RegExp.exec() is slightly faster than String.match() so will leave this off and not worth updating our code |
Contributor
There was a problem hiding this comment.
update comment to is *only* slightly faster to make it clear why we're disabling
|
Beta Published - Install Command: |
carlansley
approved these changes
Apr 7, 2025
|
✅ PR review status - All reviews completed and approved! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #220