fix(linter/plugins): do not escape tab or CR in test case names in RuleTester#16712
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR fixes an inconsistency in RuleTester where tabs (\t) and carriage returns (\r) were being escaped in test case names, while newlines (\n) were not. The fix updates the control character regex to exclude these three common whitespace characters from escaping, making test output more readable.
Key Changes:
- Introduced a new
CONTROL_CHAR_REGEXconstant that excludes tab (\x09), newline (\x0A), and carriage return (\x0D) from the set of escaped control characters - Updated snapshot file to reflect the more readable test case names with actual whitespace instead of escape sequences
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/oxlint/src-js/package/rule_tester.ts | Adds CONTROL_CHAR_REGEX constant with hex ranges that exclude tab, newline, and CR; refactors getTestName() to use the new regex |
| apps/oxlint/conformance/snapshot.md | Updates test case display to show actual tabs and carriage returns instead of escape sequences like \u0009 and \u000d, improving readability |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…uleTester` (#16712) `RuleTester` escapes control character in test names. Exclude `\t` and `'r` from escaping. Not sure why Claude included them - we already do not escape `\n`, so this seems inconsistent.
d432e70 to
6832464
Compare

RuleTesterescapes control character in test names. Exclude\tand'rfrom escaping. Not sure why Claude included them - we already do not escape\n, so this seems inconsistent.