Skip to content

Disable sonarjs/prefer-regexp-exec and @typescript-eslint/prefer-regexp-exec#221

Merged
jpolavar merged 3 commits intomainfrom
disable-prefer-regexp-exec
Apr 7, 2025
Merged

Disable sonarjs/prefer-regexp-exec and @typescript-eslint/prefer-regexp-exec#221
jpolavar merged 3 commits intomainfrom
disable-prefer-regexp-exec

Conversation

@jpolavar
Copy link
Contributor

@jpolavar jpolavar commented Apr 7, 2025

Closes #220

@jpolavar jpolavar added the PATCH label Apr 7, 2025
@jpolavar jpolavar self-assigned this Apr 7, 2025
@jpolavar jpolavar requested a review from carlansley April 7, 2025 18:20
@carlansley carlansley requested a review from Copilot April 7, 2025 18:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • package.json: Language not supported

for (const value in [1, 2, 3]) {
// eslint-disable-next-line no-console
console.log(value);
const test = '/^[a-z]+$/u';
Copy link

Copilot AI Apr 7, 2025

Choose a reason for hiding this comment

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

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');

Copilot uses AI. Check for mistakes.
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
Copy link
Contributor

Choose a reason for hiding this comment

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

update comment to is *only* slightly faster to make it clear why we're disabling

@github-actions
Copy link

github-actions bot commented Apr 7, 2025

Beta Published - Install Command: npm install @checkdigit/eslint-config@11.2.3-PR.221-cb7f

@jpolavar jpolavar requested a review from carlansley April 7, 2025 18:30
@github-actions
Copy link

github-actions bot commented Apr 7, 2025

✅ PR review status - All reviews completed and approved!

@jpolavar jpolavar merged commit 4dea1c8 into main Apr 7, 2025
8 checks passed
@jpolavar jpolavar deleted the disable-prefer-regexp-exec branch April 7, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable sonarjs/prefer-regexp-exec

3 participants