Commit Graph

19876 Commits

Author SHA1 Message Date
Boshen be2e9564e0 fix(react-compiler): support dynamic imports 2026-08-17 15:32:08 +08:00
Boshen b38a3a8dc9 fix(react-compiler): support new.target 2026-08-17 15:16:14 +08:00
Boshen dfc528ef1c fix(react-compiler): support typed assignment targets 2026-08-17 15:03:10 +08:00
Boshen b71b02db31 fix(react-compiler): support bigint object keys 2026-08-16 23:50:35 +08:00
Boshen d4dc6eae21 fix(react-compiler): support escaped tagged templates 2026-08-16 23:34:04 +08:00
Boshen a52c4047e5 fix(react-compiler): validate block nesting 2026-08-16 23:15:13 +08:00
Boshen 535685695a fix(react-compiler): cover incompatible aliasing signatures 2026-08-16 22:45:23 +08:00
Boshen c108d5c45e fix(linter): improve React Compiler diagnostics (#25742)
Improve React Compiler diagnostics with actionable help and cause-oriented labels. Preserve-memoization and recursive-initialization diagnostics previously spanned entire callbacks; they now keep codeframes compact while refs and `try`/`finally` show related locations.

Validated with React Compiler and React linter suites, Clippy, `just ready`, and the 24-rule VS Code ecosystem audit.

AI-assisted: Codex was used to implement and validate this change. I reviewed and take responsibility for the result.
2026-08-16 14:08:22 +00:00
renovate[bot] 2d2b3be43d chore(deps): update rust crate sort-package-json to v1 (#25741)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[sort-package-json](https://redirect.github.com/oxc-project/sort-package-json)
| workspace.dependencies | major | `0.0.15` → `1.0.0` |

---

### Release Notes

<details>
<summary>oxc-project/sort-package-json (sort-package-json)</summary>

###
[`v1.0.0`](https://redirect.github.com/oxc-project/sort-package-json/blob/HEAD/CHANGELOG.md#100---2026-08-16)

[Compare
Source](https://redirect.github.com/oxc-project/sort-package-json/compare/v0.0.15...v1.0.0)

##### Changed

- **Breaking:** Stabilize the public `SortOptions` API and refresh crate
metadata and documentation
([#&#8203;158](https://redirect.github.com/oxc-project/sort-package-json/pull/158))

</details>

---

### Configuration

📅 **Schedule**: (in timezone Asia/Shanghai)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yOS41IiwidXBkYXRlZEluVmVyIjoiNDQuMjkuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Boshen <boshenc@gmail.com>
2026-08-16 13:58:43 +00:00
Boshen daf03ff25d fix(react-compiler): bail out on JSX ref property loads (#25739)
Bail out when JSX `ref` values are loaded through properties, matching React Compiler and preserving getter and live-binding evaluation semantics.

The validator previously stopped temporary tracking for every property result inferred as ref-like instead of only stopping for `ref.current`.

Validation: `cargo test -p oxc_react_compiler` and `just ready`.

AI assistance: Codex was used to investigate and prepare this change; the contributor remains responsible for reviewing it before merge.
2026-08-16 13:25:12 +00:00
Boshen 066b31bdc6 fix(react-compiler): recompile outlined JSX components (#25737)
Queue JSX-outlined components back through the normal `process_fn` pipeline, matching Babel's `Program.ts`. Oxc rebuilds immutable semantics once per FIFO generation and preserves Babel's outlined declaration order.

Validated against the React Compiler fixture suite, Babel output, and `just ready`.

AI-assisted; reviewed and validated by the contributor.
2026-08-16 13:18:57 +00:00
Boshen 892238149b refactor(linter): remove inactive react config rule (#25740)
Remove the inactive `react/config` rule and its generated metadata. Oxlint uses fixed, valid React Compiler options, so the rule cannot produce actionable diagnostics.

AI-assisted: Codex was used to implement and validate this change.
2026-08-16 12:39:27 +00:00
Boshen 28125febdb feat(react-compiler): validate identifier consistency (#25735)
Ports Babel's identifier consistency invariant using Oxc's canonical identifier arena and runs it at every equivalent pipeline point.

Validated with the React compiler fixture corpus and clippy.

AI-assisted: Codex was used to implement and verify this change.
2026-08-16 11:12:30 +00:00
Cameron 77e318af2e chore(all): add .pnpm-store to .gitignore (#25563)
https://github.com/orgs/pnpm/discussions/6936

maybe this should be in my local gitignore?
2026-08-16 19:11:58 +08:00
Boshen 621808eb31 perf(diagnostics): measure graphemes lazily (#25723)
Lazily measure non-ASCII graphemes instead of allocating an eager
boundary table.

Criterion single_unicode_tab: 1.1575 µs → 596.36 ns (-48.6%). ASCII
cases remain neutral or better. Kibana output is unchanged; end-to-end
performance is neutral without type-aware linting.

AI-assisted.
2026-08-16 19:06:18 +08:00
Boshen 2dd7446b8f perf(diagnostics): preallocate graphical output (#25721)
Preallocate graphical reporter output from observed per-diagnostic size.

Criterion: single ASCII -13.7%, batch ASCII -5.7%, Unicode/tab -2.0%.

AI-assisted.

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
2026-08-16 19:06:17 +08:00
Boshen f62ed0e2b9 perf(diagnostics): optimize graphical number rendering (#25715)
Use direct integer formatting for plain graphical snippet coordinates
and line numbers.

Criterion shows 4-14% faster graphical rendering across the covered
cases.

Created with AI assistance.

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
2026-08-16 19:06:17 +08:00
Boshen 71528342ee perf(diagnostics): reduce graphical formatting overhead (#25714)
Keep diagnostic titles inline and bypass color formatting when the
active style is plain, reducing focused graphical-rendering time by
5–9%.

AI assistance: Codex was used. The contributor remains responsible for
this change.

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a></sub>
2026-08-16 19:06:17 +08:00
Boshen 10fc4b7d33 perf(diagnostics): reduce graphical rendering allocations (#25711)
Keep common graphical-rendering buffers inline and add a focused
benchmark for regressions.

AI assistance: Codex was used. The contributor remains responsible for
this change.

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a></sub>
2026-08-16 19:06:16 +08:00
Boshen 9c8abab7a7 perf(diagnostics): batch graphical reports (#25710)
Batch graphical diagnostics so reports sharing a source reuse line
indexing, and route oxlint diagnostic batches through the new API.

AI assistance: Codex was used. The contributor remains responsible for
this change.

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a></sub>
2026-08-16 19:06:16 +08:00
renovate[bot] f004852aac chore(deps): update rust crate sort-package-json to 0.0.15 (#25736)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[sort-package-json](https://redirect.github.com/oxc-project/sort-package-json)
| workspace.dependencies | patch | `0.0.14` → `0.0.15` |

---

### Release Notes

<details>
<summary>oxc-project/sort-package-json (sort-package-json)</summary>

###
[`v0.0.15`](https://redirect.github.com/oxc-project/sort-package-json/blob/HEAD/CHANGELOG.md#0015---2026-08-16)

[Compare
Source](https://redirect.github.com/oxc-project/sort-package-json/compare/v0.0.14...v0.0.15)

##### Fixed

- sort devEngines descriptor fields
([#&#8203;155](https://redirect.github.com/oxc-project/sort-package-json/pull/155))

##### Other

- *(deps)* update Rust dependencies
([#&#8203;157](https://redirect.github.com/oxc-project/sort-package-json/pull/157))
- borrow JSON strings during sorting
([#&#8203;156](https://redirect.github.com/oxc-project/sort-package-json/pull/156))
- reduce Rust dev debug info
([#&#8203;153](https://redirect.github.com/oxc-project/sort-package-json/pull/153))
- *(deps)* update rust crate ignore to v0.4.33
([#&#8203;151](https://redirect.github.com/oxc-project/sort-package-json/pull/151))
- *(deps)* update rust crates
([#&#8203;144](https://redirect.github.com/oxc-project/sort-package-json/pull/144))
- *(deps)* update rust crate ignore to v0.4.30
([#&#8203;142](https://redirect.github.com/oxc-project/sort-package-json/pull/142))
- update sponsor section

</details>

---

### Configuration

📅 **Schedule**: (in timezone Asia/Shanghai)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yOS41IiwidXBkYXRlZEluVmVyIjoiNDQuMjkuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-16 08:49:48 +00:00
Boshen fd0aeb256c feat(react-compiler): validate terminal predecessors (#25734)
Ports Babel's terminal-predecessor invariant and runs it before HIR scope dependency propagation. Keeps terminal successor traversal inline to avoid per-edge heap allocations.

AI-assisted: Codex was used to implement and verify this change.
2026-08-16 07:10:07 +00:00
Boshen 67cf673a7c feat(react-compiler): validate terminal successors (#25732)
Ports React Compiler's terminal-successor invariant and runs it after CFG-rewriting passes. Uses the existing upstream `for-return.js` fixture for regression coverage.

AI-assisted: Codex was used to implement and verify this change.
2026-08-16 06:22:41 +00:00
Boshen 33d4ed9dec fix(react-compiler): preserve unreferenced function expression names (#25733)
Preserve named function expression names when the private name is unreferenced. This matches React Compiler lowering and avoids changing observable `Function.name` values.

Validated with `just ready`.

AI-assisted.
2026-08-16 05:27:34 +00:00
Boshen c9ec55e635 fix(react-compiler): improve diagnostic spans (#25731)
Improve React Compiler diagnostics with focused primary spans and related labels for declarations, dependencies, effects, nested functions, dynamic Hooks, and transitive ref access. This avoids full-function highlights and fixes zero-width arrow labels when lowered parameter spans are missing.

Validation: `env -u NO_COLOR just ready`.

AI-generated with Codex; reviewed and validated by the contributor.
2026-08-16 03:22:59 +00:00
Boshen 4e591ed4ed fix(react_compiler): support destructured context parameters (#25724)
Fix destructured function and rest parameters that become context variables by lowering them through temporaries before `StoreContext`. This avoids inconsistent `Destructure`/context HIR and compiles supported components correctly.

Validated with `just ready` and runtime equivalence checks against React 19.2.1's compiler runtime.

AI usage: Implemented with assistance from OpenAI Codex.
2026-08-16 03:04:17 +00:00
leaysgur 2465e87905 fix(formatter): keep comments in place when dropping EmptyStatement (#25730)
Fixes #25705

---

JS formatter drops `;` (`EmptyStatement`) in a statement list.

However, this raises a question: how are the surrounding comments handled when it is dropped?

This happens because when the comment cursor retrieves that information from the `span`s of the preceding and following nodes, the `EmptyStatement`, which no longer exists, was the one reporting that position.
2026-08-16 02:26:11 +00:00
leaysgur 7e4f3b71cf fix(formatter): print JSDocUnknownType (#25729)
Fixes #25704
2026-08-16 01:52:21 +00:00
overlookmotel ce03ac12dc docs(packages/codegen): fix JSDoc comments for printSync (#25722)
Follow-on after #25720. Fix inaccuracies in JSDoc comments, as pointed out by AI review https://github.com/oxc-project/oxc/pull/25720#pullrequestreview-4944174621. For some reason, it got merged before my change to that PR was integrated.
2026-08-15 16:24:28 +00:00
overlookmotel f91b7739a3 refactor(packages/codegen): re-order write* functions (#25719)
Pure refactor. Re-order `write*` functions, so `*NoLast` versions are grouped together.
2026-08-15 16:04:00 +00:00
overlookmotel cf0b935f7b refactor(packages/codegen): move debug asserts for non-empty code into write* functions (#25718)
Pure refactor.

Move debug asserts that `code` cannot be an empty string into the body of `write` and `writeWithMap`. This makes it clearer what the invariants of these functions are.
2026-08-15 16:04:00 +00:00
overlookmotel a5c4a88d0e refactor(packages/codegen): move setting debug state to last in write* functions (#25717)
Pure refactor. Move setting debug-only state to the end of `write*` functions, instead of start. This makes it clearer that it's setting up state for the _next_ call to reference.
2026-08-15 16:04:00 +00:00
overlookmotel 386a699e81 docs(packages/codegen): correct JSDoc comment (#25716)
Docs-only change. Just correct a JSDoc comment which was out of date.
2026-08-15 16:03:59 +00:00
overlookmotel 365274ea16 feat(packages/codegen)!: printSync return an object (#25720)
`oxc-codegen`'s current API requires passing in a `SourceMapGenerator` as an option to generate source maps. This is currently really slow, and I imagine we'll want to generate source maps internally (perhaps in Rust), and return a source map string from `printSync` instead.

Alter `printSync`'s return type now, to support that without a breaking change later.

- Before: `function printSync(node: ESTree.Node, options?: Options): string`
- After: `function printSync(node: ESTree.Node, options?: Options): { code: string }`

Later on, it can return `{ code: string, map: string }` and that won't break existing users.
2026-08-15 15:53:54 +00:00
Mikhail Baev 1cbbcb7c3e fix(linter/unicorn/prefer-string-replace-all): apply fixes in one pass (#25709) 2026-08-15 16:50:21 +01:00
Boshen 8c4552dfa6 feat(linter)!: split react/react-compiler into per-category rules (#25500)
Splits the experimental `react/react-compiler` rule into 24 category-specific rules matching `eslint-plugin-react-hooks` v7.

- Runs React Compiler once per file and routes structured diagnostics to each enabled rule.
- Removes `react/react-compiler` and `reportAllBailouts`, with rules categorized by user-facing lint intent.
- Adds per-rule documentation and deduplicates shared React lint URLs.
- Preserves standardized compiler diagnostics while reporting each finding under its Oxlint rule name.

Breaking change: configurations using `react/react-compiler` must migrate to the category-specific rules.

Written with Claude Code and Codex.
2026-08-15 14:56:58 +00:00
Boshen dec0a86412 fix(react-compiler): standardize diagnostics (#25702)
Standardize React Compiler diagnostics with concise titles, primary labels, actionable help, notes, structured categories, and official guidance links.

Preserve React guidance when diagnostics are surfaced through Oxlint, and refresh affected snapshots.

AI-assisted; reviewed and validated by the contributor.
2026-08-15 13:31:34 +00:00
Boshen fca2e0cfed fix(parser): reject initialized lexical declarations in for-in (#25700)
Rejects initialized `let` and `const` declarations in `for...in` during parsing while preserving Annex B's non-strict `var` form.

Adds misc coverage for valid and invalid initializer forms.

Verified with `just ready` and parser conformance.

Closes #25149.

AI-assisted.
2026-08-15 06:58:08 +00:00
Boshen ad963b689d refactor(react_compiler): centralize diagnostics (#25699)
Centralizes React compiler diagnostics in explicit `#[cold]` functions and removes the `[ReactCompiler]` prefix, keeping diagnostic formatting off hot paths. Updates related NAPI expectations.

AI assistance was used.
2026-08-15 05:57:29 +00:00
Boshen 48e917fcba fix(react-compiler): preserve tagged template runtime semantics (#25678)
Preserve tagged-template call, aliasing, and mutation effects instead of assuming no-substitution tags are primitive or pure.

Execute opaque or effectful tags unconditionally while retaining memoization only when a configured signature proves a read-only pure call and safe return.

AI-assisted investigation and implementation; reviewed and understood by the contributor.
2026-08-15 05:12:06 +00:00
Boshen 12629e43c0 ci(miri): allow host clock access (#25701)
Allows Miri's transformer checks to access the host clock required by `oxc-browserslist` while preserving strict provenance checks.

This fixes the `baseline_targets` failure caused by isolated `clock_gettime`. The failing target passes with the pinned Miri toolchain.
2026-08-15 05:07:25 +00:00
Boshen ae9be8f8bd fix(parser): forbid type parameters on quoted constructors (#25696)
Quoted constructor methods bypassed the AST-based constructor validation. Validate type parameters after resolving the method key, preserving the AST shape.

Validation: `just ready`, parser conformance, and allocation checks.

Closes #25692.

AI-assisted with Codex.
2026-08-15 05:02:23 +00:00
Boshen b0e6c2574c fix(react-compiler): match upstream inline enum handling (#25672)
Preserve inline TypeScript enums as opaque pass-through HIR nodes, matching upstream React Compiler behavior. Apply Oxc-specific raw AST reference renaming, and skip compilation when passthrough would hide nested captures or flatten block-local bindings.

AI-assisted: Codex was used to implement and validate this change.
2026-08-15 03:45:50 +00:00
Boshen 561001d33e test(transformer): cover baseline browserslist targets (#25697)
Adds transformer integration coverage for Baseline Browserslist queries and verifies feature-specific lowering across dated and year-based targets.

Created with AI assistance.
2026-08-15 03:40:57 +00:00
Boshen c5f188a608 fix(react-compiler): use Babel v1 validation defaults (#25676)
Match the public validation defaults from babel-plugin-react-compiler 1.0 while retaining explicit opt-in for newer validations.

Validated with fixture snapshots and `just ready`.

AI-assisted investigation and implementation; reviewed and understood by the contributor.
2026-08-15 01:52:58 +00:00
Boshen e76632d9a0 fix(react_compiler): lower lowercase JSX tags as strings (#25667)
React Compiler's JSX reconstruction preserved the HIR identifier expression kind, causing compiler-generated lowercase aliases such as `navTitle` to lower as variable references. Classify reconstructed tags by their emitted JSX spelling while preserving underscore-prefixed component references.

Validation: `cargo test -p oxc_react_compiler`, `cargo clippy -p oxc_react_compiler --all-targets -- -D warnings`, and the transform-react NAPI suite.

AI assistance: OpenAI Codex was used to investigate, implement, and validate this change.
2026-08-14 13:53:59 +00:00
camc314 5fd77f79ed fix(linter/react/display-name): report curried HOC inner component (#25662)
## Summary

- retain the innermost JSX-returning arrow node when detecting HOF components
- report react/display-name on the anonymous inner component instead of the outer HOC factory
- cover the TypeScript curried-HOC reproduction and its disable-next-line behavior

Closes #25618.
2026-08-14 13:48:17 +00:00
camc314 4dbb80e6df fix(linter/import/no-named-as-default): report local export conflicts (#25658)
## Summary
- report default imports whose local name conflicts with a named local export
- preserve the same-symbol re-export exemption from eslint-plugin-import
- keep matching disable directives live under unused-directive reporting

Fixes #25624
2026-08-14 13:41:36 +00:00
camc314 e8a7214de6 fix(linter/react/rules-of-hooks): report hooks inside try blocks (#25670)
## Summary
- report custom Hooks inside try/catch blocks as conditional
- preserve the same-CFG fast path for ordinary top-level Hooks
- add focused regression coverage for the reported first-operation-in-try case

Closes #25631
2026-08-14 13:36:06 +00:00
camc314 36f845168c fix(linter/eslint/no-eval): align indirect default with ESLint (#25656)
## Summary

- default `allowIndirect` to `false`, matching ESLint's `no-eval` behavior
- report bare global `eval` references and declared global-object member access by default
- avoid duplicate diagnostics for direct global calls while preserving `allowIndirect: true`
- add regression coverage, including an ESLint disable-next-line directive

Closes #25619.
2026-08-14 13:25:03 +00:00