Skip to content

fix(eslint-plugin): [prefer-regexp-exec] fix heuristic to check whether regex may contain global flag #8764

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

Merged
merged 2 commits into from
May 16, 2024

Conversation

kirkwaiblinger
Copy link
Member

@kirkwaiblinger kirkwaiblinger commented Mar 24, 2024

PR Checklist

Overview

Changes the heuristic to say "if we don't know what it is, it could have the global flag". Note that it could also be tricked into falsely flagging on factory functions that return a regexp, since the heuristic inspects the second argument without checking what function it's inspecting. That has been made more strict.

See examples in the playground

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @kirkwaiblinger!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Mar 24, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 6a5913c
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6600b95350c8320008cd3895
😎 Deploy Preview https://deploy-preview-8764--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

nx-cloud bot commented Mar 24, 2024

@kirkwaiblinger kirkwaiblinger marked this pull request as ready for review March 24, 2024 21:38
Copy link

codecov bot commented Mar 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.33%. Comparing base (4132374) to head (6a5913c).
Report is 90 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8764      +/-   ##
==========================================
- Coverage   87.38%   87.33%   -0.06%     
==========================================
  Files         254      254              
  Lines       12489    12467      -22     
  Branches     3919     3912       -7     
==========================================
- Hits        10914    10888      -26     
  Misses       1304     1304              
- Partials      271      275       +4     
Flag Coverage Δ
unittest 87.33% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ages/eslint-plugin/src/rules/prefer-regexp-exec.ts 97.87% <100.00%> (ø)

... and 2 files with indirect coverage changes

@bradzacher bradzacher added the bug Something isn't working label Apr 4, 2024
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

LGTM! 🔥

@auvred auvred added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Apr 27, 2024
@JoshuaKGoldberg JoshuaKGoldberg merged commit d951d83 into typescript-eslint:main May 16, 2024
@kirkwaiblinger kirkwaiblinger deleted the 8614 branch May 16, 2024 00:31
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [prefer-regexp-exec] False positive when regex is an object property
5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy