Cleanup inconsistencies related to (regex) escapes#19804
Conversation
| /* -------------------------------------------------------------------------- */ | ||
|
|
||
| const IS_FRACTION = new RegExp(`^${HAS_NUMBER.source}\s*/\s*${HAS_NUMBER.source}$`) | ||
| const IS_FRACTION = new RegExp(`^${HAS_NUMBER.source}\\s*/\\s*${HAS_NUMBER.source}$`) |
There was a problem hiding this comment.
This was technically a bug, because it would never match 1 / 2 (with spaces). However, in all of our cases, we don't have spaces anyways and 1/2 did match this regex.
The only reason it worked, is because we had the literal s with *, meaning that s has to occur 0 or more times. Which means that 100s/s200 technically matched...
|
Caution Review failedPull request was closed or merged during review WalkthroughThis change set includes minor regex pattern adjustments across multiple integration and utility files, removing unnecessary character escaping in regular expressions that does not affect matching behavior. TypeScript type signatures are updated to use lowercase 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
This PR does some generic cleanup to the codebase.
I'm playing with oxfmt and oxlint and noticed some unnecessary escapes. Might add these dependencies to the project later (and rolldown for building). But baby steps for now.
Test plan