Skip to content

fix(formatter): determine type cast target from span instead of lexical scan#24447

Merged
graphite-app[bot] merged 1 commit into
mainfrom
07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan
Jul 13, 2026
Merged

fix(formatter): determine type cast target from span instead of lexical scan#24447
graphite-app[bot] merged 1 commit into
mainfrom
07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan

Conversation

@leaysgur

@leaysgur leaysgur commented Jul 13, 2026

Copy link
Copy Markdown
Member

The previous logic scanned the string, which led to it misinterpreting the ) within the RegExp literal. This appears to have been a long-standing issue, but I have now ensured that it cannot occur due to the way the code is structured.

leaysgur commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

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 changes, fast-track this PR to the front of 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.

@oxc-guard

oxc-guard Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Oxfmt Ecosystem CI

suite oxfmt@latest main refs/pull/24447/head branch
monkeytypegame/monkeytype
Comfy-Org/ComfyUI_frontend ⚠️ 🟨
cnpm/cnpmcore
huggingface/huggingface.js 🟨
fastify/fastify-vite
actualbudget/actual 🟨
eggjs/egg
vuejs/pinia
cloudflare/workers-sdk 🟨
dyad-sh/dyad 🟨
fuma-nama/fumadocs
tale/headplane
getsentry/sentry-javascript 🟨
AmanVarshney01/create-better-t-stack
vercel/turborepo
mantinedev/mantine
aidenybai/react-grab
mastodon/mastodon
vuejs/core 🟨
lichess-org/lila
npmx-dev/npmx.dev
cloudflare/agents 🟨
openclaw/openclaw 🟨
rolldown/rolldown
formatjs/formatjs

💥 = panic, ⚠️ = error e.g. parse error (main/branch columns: only new errors), ❌ = diff or exit code mismatch, 🟨 = differs from oxfmt@latest (merged-but-unreleased changes)

@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 52 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing 07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan (0856dc3) with main (8b1f6a2)

Open in CodSpeed

Footnotes

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

@leaysgur leaysgur force-pushed the 07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan branch from 90c6ac5 to d139857 Compare July 13, 2026 07:43
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Jul 13, 2026

leaysgur commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jul 13, 7:43 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jul 13, 7:47 AM UTC: leaysgur added this pull request to the Graphite merge queue.
  • Jul 13, 8:24 AM UTC: This pull request was removed from the Graphite merge queue because the batch it was included in timed out. Please re-enqueue the PR to retry merge.
  • Jul 13, 8:24 AM UTC: The merge label '0-merge' was removed. This PR will no longer be merged by the Graphite merge queue
  • Jul 13, 8:30 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jul 13, 8:30 AM UTC: The merge label '0-merge' was removed. This PR will no longer be merged by the Graphite merge queue
  • Jul 13, 8:44 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jul 13, 8:48 AM UTC: leaysgur added this pull request to the Graphite merge queue.
  • Jul 13, 8:53 AM UTC: Merged by the Graphite merge queue.

@graphite-app graphite-app Bot changed the base branch from 07-13-refactor_formatter_unify_type_cast_binding_classification to graphite-base/24447 July 13, 2026 07:44
graphite-app Bot pushed a commit that referenced this pull request Jul 13, 2026
…al scan (#24447)

The previous logic scanned the string, which led to it misinterpreting the `)` within the `RegExp` literal. This appears to have been a long-standing issue, but I have now ensured that it cannot occur due to the way the code is structured.
@graphite-app graphite-app Bot force-pushed the 07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan branch from d139857 to f0a31e9 Compare July 13, 2026 07:49
@graphite-app graphite-app Bot changed the base branch from graphite-base/24447 to 07-13-refactor_formatter_unify_type_cast_binding_classification July 13, 2026 07:50
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 13, 2026
Base automatically changed from 07-13-refactor_formatter_unify_type_cast_binding_classification to main July 13, 2026 07:53
@graphite-app graphite-app Bot added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Jul 13, 2026
@leaysgur leaysgur force-pushed the 07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan branch from f0a31e9 to 0856dc3 Compare July 13, 2026 08:43
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Jul 13, 2026
…al scan (#24447)

The previous logic scanned the string, which led to it misinterpreting the `)` within the `RegExp` literal. This appears to have been a long-standing issue, but I have now ensured that it cannot occur due to the way the code is structured.
@graphite-app graphite-app Bot force-pushed the 07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan branch from 0856dc3 to 2d22a91 Compare July 13, 2026 08:49
@graphite-app graphite-app Bot merged commit 2d22a91 into main Jul 13, 2026
29 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 13, 2026
@graphite-app graphite-app Bot deleted the 07-13-fix_formatter_determine_type_cast_target_from_span_instead_of_lexical_scan branch July 13, 2026 08:53
Boshen added a commit that referenced this pull request Jul 14, 2026
# Oxlint
### 🚀 Features

- 0433a83 linter/eslint/no-inner-declarations: Add `namespaces` option
(#24044) (Boshen)
- 92f154a oxlint,oxfmt: Auto-discover `.mts` config files (#24357)
(camc314)
- 8c1d74b linter/import/no-duplicates: Add autofix logic (#24273) (Cole
Ellison)

### 🐛 Bug Fixes

- 0b086de linter/jest/prefer-lowercase-title: False positive when
`lowercaseFirstCharacterOnly` is false (#24414) (Connor Shea)
- 097cb95 linter: Allow `vite-plus/test` and `@effect as Vitest source
(#24196) (Liang)
- 8337835 linter: Error on `ignorePatterns` that cannot match files
aoutside the config directory (#24341) (leaysgur)
- 9ba30e5 linter/oxc/bad-replace-all-arg: Add note to enhance diagnostic
(#24346) (camc314)
- 2ce5a33 linter: Resolve `ignorePatterns` relative to the config dir
(#24339) (leaysgur)
- ab90eed linter/eslint/no-loop-func: Do not error on catch variables
(#24316) (Chris Opperwall)
- b67f0a6 linter/eslint/no-unused-vars: Count default parameter updates
as usage (#24323) (camc314)
- d193f8e linter: Detect Junie agent env vars (#24277) (Jeevan Mohan
Pawar)
- 2aecf60 linter/eslint/no-unreachable: Handle `break` in switch stmts
correctly (#24260) (camc314)

### ⚡ Performance

- 7f80cac linter/vue/prop-name-casing: Precompile `ignoreProps` regex
pattern (#24413) (connorshea)
- 6272051 linter/typescript/no-require-imports: Compile allow patterns
once (#24417) (connorshea)
- fb1edf1 linter: Compute comment fix span only for directive comments
(#24419) (connorshea)
- 33805b9 linter/jsdoc/require-param: Compile checkTypesPattern regex
once (#24420) (connorshea)
- 8de6fca linter/jest/valid-title: Compile disallowedWords regex once
(#24412) (Connor Shea)
- 4a0d8dc linter/eslint/no-underscore-dangle: Avoid String clone per
identifier (#24371) (Ian Macalinao)
- f3ab04c linter/typescript/consistent-type-imports: Remove redundant
Vec per violation (#24370) (Ian Macalinao)
- 4d2d78d linter/typescript/prefer-ts-expect-error: Avoid String clone
per comment (#24369) (Ian Macalinao)
# Oxfmt
### 🚀 Features

- 3a7fe74 formatter_css: Update oxc-css-parser to 0.0.7 (#24434)
(leaysgur)
- 0173cd3 formatter_css: Format Less :extend and merge props (#24358)
(leaysgur)
- 92f154a oxlint,oxfmt: Auto-discover `.mts` config files (#24357)
(camc314)
- df250df formatter: Support `quoteProps` for TS enum and methods
(#24309) (leaysgur)
- a9a5cd6 formatter_core: Expose `SourceText::as_str()` (#24281)
(leaysgur)

### 🐛 Bug Fixes

- 162bddf formatter: Add required parens for conditional type in type
parameter constraint (#24450) (leaysgur)
- 2d22a91 formatter: Determine type cast target from span instead of
lexical scan (#24447) (leaysgur)
- 25306e9 formatter: Do not add extra parens with type cast comment
(#24444) (leaysgur)
- bd6edfe formatter: Break arrow signature that exactly fills the line
when cond body may hug (#24440) (leaysgur)
- a99ef41 formatter: Keep quotes on method signature named new (#24432)
(leaysgur)
- fcc28df formatter_css: Keep glued-braket-value tight (#24352)
(leaysgur)
- 8337835 linter: Error on `ignorePatterns` that cannot match files
aoutside the config directory (#24341) (leaysgur)
- b7c7e15 formatter: Add parens for import and private field in new
callee chain (#24320) (leaysgur)
- 0c8f6e4 formatter: Update detect_code_removal for #24309 (#24314)
(leaysgur)
- a85aad0 formatter: Fix member-chain and non-null parens (#24312)
(leaysgur)
- 1c29c73 formatter: Preserve `TSNonNullExpression` in chain expression
(#24311) (leaysgur)
- 8933c0e formatter: Keep comment inside of empty `switch` block
(#24308) (leaysgur)
- ec26af2 formatter: Preserve blank lines between JSX attrs (#24290)
(leaysgur)
- 70bd54d formatter: Keep arrow function body comment (#24287)
(leaysgur)
- 415fe1e oxfmt: Error on ignorePatterns that cannot match files outside
the config directory (#24286) (leaysgur)
- eeabc4a formatter_css: Bail on EOF-recovered parse errors (#24282)
(leaysgur)
- 42ec8de formatter: Keep comments inside surviving parens and
suppressed statement terminators (#24253) (leaysgur)
- 1343779 formatter: Keep comment inline for empty statements (#24249)
(leaysgur)
- b996579 formatter: Print ; before trailing comments part 2 (#24246)
(leaysgur)
- 4f86e8c formatter: Print `;` before trailing comments (#24244)
(leaysgur)
- 01252e4 formatter: Add or remove parens for `let` declaration (#24215)
(leaysgur)

### ⚡ Performance

- eeb1913 formatter_core: Avoid per-call `Vec` work-stack in soft-line
removal (#23775) (Marius Schulz)
- a2f255b formatter: Use `SmallVec` for `MemberChain` collections
(#23776) (Marius Schulz)

### 📚 Documentation

- b52d0f5 formatter: Add TODO comment about unsound code (#24372)
(overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant