Skip to content

fix(linter/plugins): do not escape tab or CR in test case names in RuleTester#16712

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-10-fix_linter_plugins_do_not_escape_tab_or_cr_in_test_case_names_in_ruletester_
Dec 10, 2025
Merged

fix(linter/plugins): do not escape tab or CR in test case names in RuleTester#16712
graphite-app[bot] merged 1 commit intomainfrom
12-10-fix_linter_plugins_do_not_escape_tab_or_cr_in_test_case_names_in_ruletester_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 10, 2025

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-bug Category - Bug labels Dec 10, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 10, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@overlookmotel overlookmotel marked this pull request as ready for review December 10, 2025 18:28
Copilot AI review requested due to automatic review settings December 10, 2025 18:28
@overlookmotel overlookmotel self-assigned this Dec 10, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 10, 2025
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 10, 2025

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.
@graphite-app graphite-app bot force-pushed the 12-10-fix_linter_plugins_do_not_escape_tab_or_cr_in_test_case_names_in_ruletester_ branch from d432e70 to 6832464 Compare December 10, 2025 18:53
@graphite-app graphite-app bot merged commit 6832464 into main Dec 10, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 12-10-fix_linter_plugins_do_not_escape_tab_or_cr_in_test_case_names_in_ruletester_ branch December 10, 2025 18:59
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants