Commit Graph

14228 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
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
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 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
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
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 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
camc314 d901d24c55 fix(linter/react/exhaustive-deps): handle destructured object dependencies (#25669)
## Summary

- treat destructuring initializers as whole-object dependencies
- avoid reporting narrower declared paths as unnecessary while their reactive ancestor is missing
- preserve unnecessary-dependency diagnostics for stable ancestors such as state setters

Fixes #25621
2026-08-14 13:21:17 +00:00
camc314 beb724dce2 fix(linter/eslint/no-unused-vars): report bare underscore parameters (#25663)
## Summary

- report a bare underscore parameter when no args ignore pattern is configured
- preserve the optimized underscore-prefix behavior for explicit argsIgnorePattern configuration
- update focused rule coverage and generated documentation

Closes #25626
2026-08-14 13:16:16 +00:00
camc314 fa36f26785 fix(linter/react/no-this-in-sfc): detect this in nested arrow callbacks (#25653)
## Summary

- walk through nested arrow callbacks when resolving the enclosing stateless component
- preserve ordinary function boundaries that introduce their own this binding
- add regression coverage for the reported JSX ref callback and unused disable directives

Closes #25615
2026-08-14 13:11:54 +00:00
camc314 44d1be348c fix(linter/typescript/no-var-requires): run rule on JavaScript (#25664)
## Summary
- run typescript/no-var-requires on JavaScript files
- match typescript-eslint behavior and prevent false unused-disable diagnostics

Fixes #25623.
2026-08-14 13:06:00 +00:00
camc314 4004c101ca fix(linter/eslint/no-irregular-whitespace): check comments by default (#25660)
## Summary

- align the skipComments default with ESLint
- report irregular whitespace in line and block comments by default
- preserve the skipComments: true opt-out
- verify suppressed comment diagnostics count disable directives as used
- regenerate the published configuration schema

Fixes #25616.
2026-08-14 12:59:55 +00:00
camc314 625401da43 fix(linter/import/no-named-default): flag type-only named defaults (#25661)
## Summary

- flag declaration-level TypeScript type-only named default imports
- preserve inline type specifier behavior to match eslint-plugin-import
- add regression and disable-directive coverage
- regenerate rule dispatch and timing metadata

Closes #25613
2026-08-14 11:22:14 +00:00
camc314 8eacb2d3b2 fix(linter/typescript/no-non-null-asserted-optional-chain): detect assertions after continued optional chains (#25659)
## Summary

- detect non-null assertions after continued optional chains
- preserve optional-chain labels and parenthesized chain boundaries
- add focused diagnostic and suggestion regression coverage

Closes #25622.
2026-08-14 11:16:43 +00:00
camc314 d55b76c7ab fix(linter/react/no-direct-mutation-state): detect computed state mutations (#25654)
## Summary

- traverse member-expression chains across computed accesses before checking for `this.state`
- add regression coverage for computed assignment and update targets

Fixes #25625
2026-08-14 11:03:22 +00:00
camc314 f92c6518c0 fix(linter/unicorn/no-abusive-eslint-disable): use directive prefix in diagnostic (#25657)
## Summary

- report oxlint-disable for diagnostics triggered by oxlint directives
- preserve eslint-disable wording for ESLint directives
- add regression coverage for malformed directives and rule suppression

Fixes #25647
2026-08-14 10:48:22 +00:00
camc314 ee44996c43 fix(linter/eslint/max-classes-per-file): anchor diagnostic at program start (#25652)
## Summary

- anchor max-classes-per-file diagnostics at the first program token to match ESLint behavior
- update diagnostic snapshots to assert the program-level location
- preserve disable-next-line behavior for top-of-file directives

Fixes #25629.
2026-08-14 10:43:53 +00:00
camc314 403ec40c71 fix(linter/eslint/no-multi-assign): handle parenthesized declarator initializers (#25651)
## Summary

- treat parenthesized assignment expressions as direct children in the three contexts covered by ESLint's no-multi-assign rule
- add regression coverage for the reported TypeScript declarator initializers, class fields, assignment right-hand sides, and disable directives

Fixes #25617.
2026-08-14 10:40:29 +00:00