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

chore(biome): Add useRegexLiterals rule #10010

Merged
merged 2 commits into from
Jan 3, 2024
Merged

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 2, 2024

This PR adds the useRegexLiterals rule to our biome config which will flag unnecessary usage of the RegExp constructor where a static regex could be used instead.

The fix codemod seems to be still quite buggy, as it e.g. can't correctly convert slashes new RegExp('/my/path') becomes //my/path/ instead of /\/my\/path/. However, an incorrect conversion will trigger other warnings, so I'm okay with that for the moment.

ref #9960 (in contrast to #10009, this PR doesn't address the RegExp usage problem but it's a nice addition IMO)

@Lms24 Lms24 requested review from anonrig and AbhiPrasad January 2, 2024 13:12
@Lms24 Lms24 marked this pull request as ready for review January 2, 2024 13:12
@anonrig
Copy link
Contributor

anonrig commented Jan 2, 2024

Love it, but there is a conflict.

@Lms24 Lms24 force-pushed the lms/chore-biome-regex-literals branch from 27a2272 to 94bc349 Compare January 3, 2024 09:13
@Lms24 Lms24 enabled auto-merge (squash) January 3, 2024 09:13
Copy link
Contributor

github-actions bot commented Jan 3, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.02 KB (+0.11% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 67.38 KB (+0.12% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.96 KB (+0.26% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.42 KB (0%)
@sentry/browser - Webpack (gzipped) 22.12 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 73.4 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 65.09 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 31.24 KB (+0.28% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.16 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 204.14 KB (+0.12% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 94.03 KB (+0.25% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 68.73 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 34.21 KB (+0.27% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 67.78 KB (+0.12% 🔺)
@sentry/react - Webpack (gzipped) 22.16 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 84.43 KB (+0.09% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.06 KB (+0.15% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 16.63 KB (0%)

@Lms24 Lms24 merged commit 4c82160 into develop Jan 3, 2024
95 checks passed
@Lms24 Lms24 deleted the lms/chore-biome-regex-literals branch January 3, 2024 10:32
anonrig pushed a commit that referenced this pull request Jan 3, 2024
Add the
[useRegexLiterals](https://biomejs.dev/linter/rules/use-regex-literals/)
rule to our biome config which will flag unnecessary usage of the
`RegExp` constructor where a static regex could be used instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants