Skip to content

Cleanup inconsistencies related to (regex) escapes#19804

Merged
RobinMalfait merged 3 commits intomainfrom
feat/cleanup-code
Mar 15, 2026
Merged

Cleanup inconsistencies related to (regex) escapes#19804
RobinMalfait merged 3 commits intomainfrom
feat/cleanup-code

Conversation

@RobinMalfait
Copy link
Copy Markdown
Member

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

  1. All tests should still pass

@RobinMalfait RobinMalfait requested a review from a team as a code owner March 15, 2026 20:59
/* -------------------------------------------------------------------------- */

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}$`)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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...

@RobinMalfait RobinMalfait merged commit faa5e88 into main Mar 15, 2026
9 checks passed
@RobinMalfait RobinMalfait deleted the feat/cleanup-code branch March 15, 2026 21:04
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 15, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This 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 symbol instead of Symbol for consistency with modern TypeScript conventions. Test expectations in candidate and CSS parser tests are modified to reflect adjusted validation patterns. Additionally, regex escaping in template-based pattern construction is corrected to ensure proper character matching. No changes to control flow, error handling, or public API signatures beyond type annotation updates are introduced.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main purpose of the pull request: cleaning up unnecessary regex and other escapes throughout the codebase.
Description check ✅ Passed The description explains the cleanup effort, the source of the improvements (oxfmt and oxlint), future plans, and includes a test plan that aligns with the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant