Closes#25339.
## The problem
`no-redeclare` gated the entire rule on the file not being an ES module:
```rust
fn should_run(&self, ctx: &ContextHost) -> bool {
// ES modules run in their own scope, and don't conflict with existing globals
!ctx.source_type().is_module()
}
```
The comment justifies the globals half of the rule, and it is right
about that: an ES module has its own top-level scope, so declaring
`Object` or `self` there shadows nothing, which is why ESLint reports
`builtinGlobals` redeclarations against the global scope rather than
inside a module. But the gate took the rest with it — plain `var a = 3;
var a = 10;`, redeclarations in nested scopes, and the TS type/value
collision check added for #10396 all stopped running too.
**One correction to the issue's framing, from testing it rather than
reading it.** `.ts` is parsed as `ModuleKind::Unambiguous`, which
resolves to `Module` only when ESM syntax is actually present. So a
`.ts` file with no `import`/`export` is a script, and the rule *did* run
there — `var a = 3; var a = 10;` on its own is reported today. What was
dead is every `.ts` file that contains an import or an export, which in
practice is nearly all of them. The effect the issue describes is real;
the boundary is ESM syntax, not the extension.
The rule's own tests hid this either way. Every failing case runs under
`.change_rule_path_extension(".cts")` — CommonJS, never a module — and
the single `.ts` block asserts a *pass*, which it would do whether or
not the rule executed.
## The change
Drop `should_run`, and narrow the exemption to the thing the comment
actually describes:
```rust
// ES modules run in their own scope, so a top-level `Object` or `self` shadows nothing.
// Only the globals half of the rule is skipped for them -- redeclaring a local binding is
// still a redeclaration.
let builtin_globals = if self.builtin_globals && !ctx.source_type().is_module() {
Some(&GLOBALS_BUILTIN)
} else {
None
};
```
`builtin_globals` is already the single switch for that half — it drives
`is_builtin`, which chooses between
`no_redeclare_as_builtin_in_diagnostic` and the plain redeclaration
diagnostic — so `None` in modules disables exactly the globals
reporting, for the builtin table and user-configured `globals` alike,
and leaves both redeclaration loops running.
## Tests
A new `.ts` block under the `es-modules` snapshot suffix. Every case
carries ESM syntax so it resolves as a module — otherwise it would test
the script path by accident, which is the trap above:
- **pass** — `export {}; var Object = 0;` and `export {}; var globalThis
= 0;` (a module shadows nothing, so these must stay quiet), plus a
redeclaration-free case and a TS overload pair.
- **fail** — `export {}; var a = 3; var a = 10;`; `export {}; function
f() { var a; var a; }` (nested scope — nothing to do with global scope
at all, and previously silent); the #10396 `type foo = 1; export
function foo(): void; …` case; and `export {}; var Object = 0; var
Object = 0;`.
That last one is the seam this change creates, so it is worth pinning:
inside a module the first `var Object` is no longer reported as
shadowing a builtin, but the second is still reported as a redeclaration
of the first. Without it, narrowing the gate could quietly have turned
builtin-named symbols into a blind spot.
The existing `.cts` blocks and their snapshot are untouched — `.cts` is
CommonJS, so `is_module()` was already false there.
## Verification
Ran locally with `cargo test -p oxc_linter --lib no_redeclare`: passes,
the existing `eslint_no_redeclare.snap` is unchanged, and the new
`eslint_no_redeclare@es-modules.snap` is included. `cargo clippy -p
oxc_linter --lib` is clean.
> AI disclosure, per the contributing policy: I used an AI assistant
while investigating and writing this. I have read and understand the
change, ran the tests myself, and stand behind it.
---------
Co-authored-by: Cameron <cameron.clark@hey.com>
## Summary
- mark `unicorn/prefer-default-parameters` as suggestion-only
- prevent `--fix` from changing behavior for `null` and other falsy values
Closes#25799
## Summary
- represent variadic rule options as a severity followed by zero or more
option values
- regenerate the Oxlint configuration schema and TypeScript declarations
- add a type-level regression for mapped options spread into
`no-restricted-globals`
## Root cause
The schema wrapper materialized the first `additionalItems` entry as a
required tuple element and set `minItems` to 2. A dynamic TypeScript
spread has type `T[]` and may be empty, so it cannot satisfy that
required position even though the severity-only form is already valid
through `RuleNoConfig`.
Keeping severity as the only fixed tuple item and leaving the rule
options in `additionalItems` generates `[severity, ...options]`, which
accepts both an empty spread and populated spreads without changing
runtime rule behavior.
Closes#25666
## AI assistance
Implemented with assistance from OpenAI Codex. The contributor remains
responsible for reviewing, understanding, and submitting the change
under the repository AI usage policy.
---------
Co-authored-by: Cameron <cameron.clark@hey.com>
Use compact `Display` formatting for React Compiler terminals and reuse `ConfigBuilderError`'s existing `Display` implementation for `Debug`.
This reduces the release `oxlint` binary from 12,773,552 to 12,740,432 bytes: **-33,120 bytes (-0.26%)**, with `__text` reduced by 24,452 bytes.
Validated with the affected crate tests, workspace checks, and oxlint snapshot tests.
AI assistance was used for implementation and measurement.
## Summary
- classify typescript/no-unnecessary-type-conversion as suggestion-only
- prevent its runtime-changing removal from being advertised as a normal autofix
- keep TSGolint RuleSuggestion edits available through suggestion handling
Related to #25549.
## Summary
- anchor switch/if missing-return diagnostics on the array callback function head, matching ESLint
- preserve the inner control-flow statement as a secondary diagnostic label
- add regression coverage for diagnostic location and eslint-disable-next-line behavior
Fixes#25632
## Summary
- emit `any | undefined` for default-initialized `any` parameters followed by required parameters
- add a regression fixture for #25290 and update the existing parameter snapshot
- preserve the existing handling of `unknown`
Closes#25290
Switches order-independent sorts to unstable sorting and avoids cloning rule-table plugin names.
Reduces the stripped `oxlint` release binary from 12,773,568 to 12,757,040 bytes: 16,528 bytes (0.13%).
Validated with `cargo test -p oxc_linter` and focused oxlint JSON checks.
AI assistance was used for analysis and implementation.
`@__KEY__` and `#__KEY__` are currently treated as normal comments. Codegen can drop them before a later property-mangling pass. The property may then be renamed while the annotated string keeps its old name.
This classifies the marker as a property-key annotation. Codegen keeps it next to string and no-substitution template literals when annotation comments are enabled, and the property mangler reads that classification instead of scanning source text. Final output still follows the normal comment options, so whitespace-minified or annotation-disabled output removes the marker.
## Example
Input:
```js
const object = { _field: 1 };
const key = /* #__KEY__ */ "_field";
object[key];
```
Before, an intermediate codegen pass could remove the marker:
```js
const object = { _field: 1 };
const key = "_field";
object[key];
```
After, the marker survives for the later property-mangling pass.
Verified with the affected crate suites, `just minsize`, workspace lint, docs, AST generation, and independent review. `just ready` is only blocked locally by existing Node-version and terminal-color snapshot differences.
Implemented with AI assistance (OpenAI Codex). I reviewed and understand the changes and remain responsible for this contribution under the repository AI usage policy.
BigInt object keys fell through generic unsupported-key handling. Lower
them through the exact parser-provided decimal string, preserving
alternate bases and values beyond Number precision.
Validated with `just ready`.
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>
React Compiler HIR already preserves both raw and cooked tagged-template
values, but lowering rejected templates whenever they differed. Remove
the stale bailout and cover escaped and invalid escape sequences.
Validated with `just ready`.
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>
Port `assertValidBlockNesting` to reject partially overlapping
program-block and reactive-scope ranges before and after scope-terminal
rewriting. Reuse the traversal when constructing scope terminals.
Validated with `just ready`.
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>
`known_incompatible` is already checked before both aliasing and legacy
signature handling, making the legacy-path TODO stale. Add
aliasing-signature coverage to guard the shared behavior.
Validated with `just ready`.
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>
## Summary
- inspect the third argument for built-in `AggregateError` options
- preserve the existing second-argument behavior for `Error` and `TypeError`
- add focused valid-cause and wrong-cause regression coverage
Fixes#25761
Oxc can shorten variable names and private class names, but it cannot shorten property names such as `obj._field`. This change adds optional property mangling. It replaces #23772 and gives bundlers a way to use the same property names across several files.
### Feature
- `include` selects names to mangle. `exclude` and `reserved` keep names unchanged.
- The cache can give a property a fixed output name or keep it unchanged.
- The mangler supports member access, object and class keys, destructuring, optional chains, the left side of `in`, and JSX property names.
- `mangle_quoted` also handles strings and template literals used directly as property keys. `/* @__KEY__ */` and `/* #__KEY__ */` can mark one other string or template literal as a property key.
- Short names are assigned in a stable order. More common properties get shorter names. Existing and reserved names are avoided.
- Bundlers can collect names from several programs, create one shared map, and apply it to every program.
- Numeric keys, `__proto__`, `constructor`, `prototype`, TypeScript-only keys, and private names are never changed by this pass.
### Design
Property names are part of JavaScript syntax, not local scope. For this reason, the code lives in `oxc_minifier`. It only reuses the short-name generator from `oxc_mangler`.
For one program, the order is:
```text
collect names → assign names → rewrite once → compress → mangle variables and private names
```
Property names are rewritten before compression because compression can remove information about quotes and comments.
For several programs, a bundler collects names from each program, merges the results, assigns one shared map, and rewrites each program once. Collection can run in parallel. All programs must use the same options.
The shared map keeps property names consistent inside one build. The cache has a different job: it keeps fixed names and reservations across separate minify calls.
### Example
With `include: "^_"` and `mangle_quoted: true`:
```js
obj[`_field`] = 1;
obj._field = 2;
```
becomes:
```js
obj[`e`] = 1;
obj.e = 2;
```
### Limitation
- Property mangling is unsafe when other code still uses the old property name. Public APIs and names shared with external code, host APIs, imported namespace objects, or separate builds must be excluded or reserved.
- Quote handling is per use. Without `mangle_quoted`, `obj._field` may change while `obj["_field"]` does not.
- The mangler cannot find names built at runtime or stored in arbitrary strings. Code that uses `eval`, `Function`, or `with` must reserve any affected names.
- Compression may create a matching property after this pass has finished. For example, `'f' + 'oo_'` may later become `foo_` and will not be mangled.
- TypeScript enum reverse mappings are not supported because the transform creates quoted strings.
- Multi-program support is a caller API. The caller must collect every program that shares mangled properties before assigning names.
The public `oxc-minify` API is stacked in #24741. The downstream multi-chunk integration is shown in rolldown/rolldown#10374.
Supersedes #23772.
AI assistance: OpenAI Codex and Claude were used for research, implementation, review, and testing. The contributor is responsible for reviewing and understanding the changes before submission.
Type-erase the shared LSP server future so CLI and NAPI reuse one async state machine. This removes duplicate LSP machinery and reduced the measured release binary by about 1.3 MiB.
AI assistance was used to implement this change.
Share non-generic array/null/error normalization for `DefaultRuleConfig` and route all 279 call sites through the direct `Value` path. This reduced the local release binary by 66,784 bytes.
Validated with `just ready`.
Prepared with AI assistance.
An uninitialized module-level `var` is `undefined` until it is assigned. After Rolldown removed an unreachable setter, Oxc did not keep this fact, so a dead optional call could remain in the output.
This PR records safe uninitialized module `var` bindings as known `undefined`. Existing minifier passes can then remove optional chains and simplify other reads.
The optimization is limited to module scope. It is disabled for resolved writes, redeclarations, and direct `eval`. Script globals and function-local variables are not changed.
Direct aliases keep the same known value without replacing every read with `void 0`. This avoids larger output and lets the existing alias cleanup work normally.
Generic optimizer tests now use function parameters when they need an unknown value. Focused tests cover the new behavior for uninitialized module variables.
## Example
Input:
```js
var slot
function make(value) {
slot?.(value)
return value
}
console.log(make(1))
```
Before:
```js
var slot;
function make(value) {
slot?.(value);
return value;
}
console.log(make(1));
```
After:
```js
function make(value) {
return value;
}
console.log(make(1));
```
Verified with the full `oxc_minifier` test suite (649 passed, 34 ignored), Clippy, formatting, minsize, and allocation checks. Minsize and allocation snapshots are unchanged.
Fixesrolldown/rolldown#10659
AI-assisted by OpenAI Codex.
Diagnostic reporting is a cold path, but `LintContext::diagnostic` was explicitly inlined into hundreds of rule bodies. This also duplicated `Message::new`, its primary-label search, and generic diagnostic builders.
Mark these paths `#[cold]` and `#[inline(never)]` so call sites share a few outlined implementations instead of embedding the construction code.
This reduces the stripped aarch64 macOS `oxlint` binary by 224.9 KiB (1.66%; `__text` by 224.3 KiB).
Validated with `just ready` and a release fat-LTO size comparison.
AI assistance: Codex was used to implement and validate this change.
`f64::powf` implements IEEE 754 `pow`, which returns `1` for a base of
`1` whatever the exponent.
[`Number::exponentiate`](https://tc39.es/ecma262/#sec-numeric-types-number-exponentiate)
instead returns `NaN` when the exponent is `NaN` (step 1), and when the
base has magnitude `1` and the exponent is infinite (steps 9-10).
Constant folding called `powf` directly, so:
```js
1 ** Infinity // spec: NaN oxc folded to: 1
(-1) ** Infinity // spec: NaN oxc folded to: 1
1 ** -Infinity // spec: NaN oxc folded to: 1
1 ** NaN // spec: NaN oxc folded to: 1
```
`1` is truthy and `NaN` is not, so an `if` guarded by such an expression
takes the wrong branch.
The one case the two agree on — an exponent of `0` returning `1`
whatever the base, including `NaN ** 0` and `Infinity ** 0` — is
unchanged, since `powf` already gets it right and the spec checks the
exponent before the base.
`cargo minsize` shows no snapshot change.
Found by the minifier fuzzer (#25594).
---
Written with AI assistance (Claude Code). Reviewed by me, and every
expected value in the added test was checked against Node.js.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
## Summary
- treat value declarations in ambient namespaces as implicitly exported for expando-function validation
- preserve local versus exported namespace visibility to match TypeScript declaration merging
- add regression coverage for accepted ambient value declarations and rejected local or type-only declarations
## TypeScript compatibility
The regression fixture was checked with TypeScript 6.0.3. TypeScript and Oxc produce TS9023 only for the exported-function/local-namespace mismatch and the type-only namespace property.
Closes#24975
Fixes comment-placement bugs, idempotency and also inconsistency around unions/intersections, type aliases, conditional types, and assignment-likes.
- Fix invariant violations where comments crossed `=`, the value, or `;`
- removed the relocation logic emulating old Prettier 3.8 behavior
- Normalize a union's leading comments to one canonical form behind the synthesized leading `|`, independent of the source shape
- Comments around a formatter-added `(` keep their source side of the `(`
- Hug conditional-type branch comments behind `?`/`:` with the content one level under the operator, matching conditional expressions
- Extend `= // c` position preservation from type aliases to all of JS
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.
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
([#​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>
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.
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.
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.
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.
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>
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>
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>
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>
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.