Skip to content

fix(linter/plugins): decode escapes in identifier tokens#19838

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-22-fix_linter_plugins_decode_escapes_in_identifier_tokens
Feb 28, 2026
Merged

fix(linter/plugins): decode escapes in identifier tokens#19838
graphite-app[bot] merged 1 commit intomainfrom
om/02-22-fix_linter_plugins_decode_escapes_in_identifier_tokens

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 28, 2026

Fix tokens in linter. Use options for tokens which match ESLint's tokens style, instead of matching TS-ESLint's.

Copy link
Member Author

overlookmotel commented Feb 28, 2026


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 February 28, 2026 12:37
Copilot AI review requested due to automatic review settings February 28, 2026 12:37
Copy link
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 token serialization in the linter and JS plugin layer to use ESLint-compatible (Espree) token values for identifiers containing Unicode escape sequences (e.g., \u0061). Previously, the linter() constructor had decode_identifier_escapes: false (matching TS-ESLint's behavior), while ESLint's Espree parser decodes escapes in the token value. The fix replaces ESTreeTokenOptions::linter() with the existing ESTreeTokenOptions::test262() (Espree-compatible) and removes the now-redundant linter() constructor.

Changes:

  • Remove ESTreeTokenOptions::linter() and replace both call sites with ESTreeTokenOptions::test262()
  • Add escaped_idents.js fixture file covering Unicode-escaped identifiers and legacy keyword identifiers
  • Update the test snapshot to reflect correctly decoded token values

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_estree_tokens/src/lib.rs Removes the linter() constructor (which differed from test262() only in decode_identifier_escapes: false)
crates/oxc_linter/src/lib.rs Switches token options from removed linter() to test262()
apps/oxlint/src/js_plugins/parse.rs Switches token options from removed linter() to test262()
apps/oxlint/test/fixtures/tokens/files/escaped_idents.js New test fixture with Unicode escape sequences in identifiers and legacy keywords
apps/oxlint/test/fixtures/tokens/output.snap.md Updated snapshot showing decoded identifier values matching ESLint behavior

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 28, 2026

Merging this PR will not alter performance

✅ 52 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/02-22-fix_linter_plugins_decode_escapes_in_identifier_tokens (a175b31) with main (0681ca3)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on om/02-28-refactor_estree_tokens_re-order_code (0f666d6) during the generation of this report, so main (0681ca3) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Feb 28, 2026
Copy link
Member Author

overlookmotel commented Feb 28, 2026

Merge activity

@overlookmotel overlookmotel force-pushed the om/02-22-fix_linter_plugins_decode_escapes_in_identifier_tokens branch from a175b31 to 425151b Compare February 28, 2026 12:59
@overlookmotel overlookmotel force-pushed the om/02-28-refactor_estree_tokens_re-order_code branch from 0f666d6 to 7a9d19e Compare February 28, 2026 12:59
Fix tokens in linter. Use options for tokens which match ESLint's tokens style, instead of matching TS-ESLint's.
@graphite-app graphite-app bot force-pushed the om/02-28-refactor_estree_tokens_re-order_code branch from 7a9d19e to 04c4284 Compare February 28, 2026 13:01
@graphite-app graphite-app bot force-pushed the om/02-22-fix_linter_plugins_decode_escapes_in_identifier_tokens branch from 425151b to 7682e5a Compare February 28, 2026 13:02
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 28, 2026
Base automatically changed from om/02-28-refactor_estree_tokens_re-order_code to main February 28, 2026 13:10
@graphite-app graphite-app bot merged commit 7682e5a into main Feb 28, 2026
22 checks passed
@graphite-app graphite-app bot deleted the om/02-22-fix_linter_plugins_decode_escapes_in_identifier_tokens branch February 28, 2026 13:11
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