100 Commits
Author SHA1 Message Date
Dunqing e751a6a4bb fix(react-compiler): preserve optional-chain cache guards (#28165)
Memoization can hide a required `TypeError` after an optional chain
short-circuits on an earlier render. For `obj?.a.b(getArg())`, rendering
first with `obj = undefined` caches `undefined`; rendering again with
`obj = {}` can reuse that result because the reduced dependency `obj?.a`
is still `undefined`. The second render should throw when reading `.b`.

Keep non-optional continuation dependencies below optional prefixes
instead of letting the prefix subsume them. When a computed or call
continuation cannot be represented as a property path, retain the
original optional guard dependency. For conditionally evaluated chains
such as `getArg() ? obj?.a.b(getArg()) : null`, truncate an unhoistable
dependency before its last optional link. This tracks the guard without
moving a throwing read ahead of its condition. Fully optional chains
keep their existing dependency reduction.

Adds 11 focused Node runtime cases comparing compiled and original
JavaScript over two consecutive renders, with truthy and falsy
conditions. They cover static, computed, optional-call, nested,
conditional, and fully optional chains, plus method receivers. Output
snapshots cover the generated dependencies.

This bug predates and is independent of
https://github.com/oxc-project/oxc/pull/28144. The same static,
computed, and optional-call failures were reproduced with
`babel-plugin-react-compiler@1.0.0` and `@babel/core@8.0.9`; this
intentionally corrects behavior also present upstream.

Validation:
- `cargo +1.99.1 test -p oxc_react_compiler --all-features`: 18 unit
tests, 26 integration tests, and the full snapshot suite passed.
- `cargo +1.99.1 clippy -p oxc_react_compiler --all-targets
--all-features -- -D warnings` passed.
- `cargo +1.99.1 fmt -p oxc_react_compiler -- --check` and `git diff
--check` passed.
- An additional local differential matrix of 73 expressions and 18,688
render transitions passed with no skipped compilations.
- NAPI binding tests were not run locally.

AI assistance: the implementation, regression tests, and PR description
were prepared with AI assistance.
2026-10-26 21:28:58 +08:00
Dunqing b60f8a7c14 fix(coverage): pin the V8 test262 status list to Node's V8 version (#27674)
monitor-oxc's Test262 job fails on every run because `cargo coverage
runtime` no longer matches `runtime.snap`. The runtime suite skips the
cases V8's `test262.status` lists as failing, and it fetches that file
from V8's `main` branch at run time. On 2026-10-09 V8 landed
`03af3c3548` ("[scopes] Reject var arguments in parameter eval") and
removed the 88 `language/eval-code/direct/*declare-arguments*` entries.
Node 26.5 bundles V8 14.6.202, which predates that fix, so those 88
cases now run and fail with `Expected a SyntaxError to be thrown`.

The skip list exists to hide bugs of the engine that executes the cases,
and that engine is Node's V8, not V8 `main`. `main` is wrong in both
directions: it un-skips cases V8 fixed after Node's branch cut, and it
skips 236 entries for test262 files newer than the pinned checkout.

The list is now fetched at the V8 version reported by `node -p
process.versions.v8` (`14.6.202.34`, which V8 tags on GitHub), falling
back to `main` only when that tag does not exist. The gitignored cache
file carries the version in its name so a Node bump cannot serve a stale
list.

With the pinned list the snapshot only changes when the test262 pin or
`.node-version` moves. Regenerated against Node 26.5.0 it adds nothing
and drops: four `delete/super-property-uninitialized-this` cases that V8
fixed upstream after 14.6, the `typeof/symbol.js` timeout, and the two
`bigint-and-number-extremes` minify cases that #27656 fixed (the regular
CI does not run the runtime suite, so that PR could not update the
snapshot):

| skip list | cases | passed | new failures |
| --- | --- | --- | --- |
| V8 `main` today | 18369 | 17307 | 88 |
| V8 `14.6.202.34` | 18277 | 17306 | 0 |

Written with Claude Code; reviewed and tested by me.
2026-10-15 09:43:24 +08:00
Dunqing f14ead5379 fix(minifier): eliminate unused IIFE calls with constant arguments (#27434)
Unused calls such as `const f = x => x + 1; f(1);` currently survive as
`(x => x + 1)(1)`. Track constant arguments for arrow IIFEs and strict
regular-function IIFEs so the existing constant folder and side-effect
analysis can remove the call. Parameter constants guide folding without
replacing bare parameter reads, avoiding duplicated argument literals.

The optimization preserves argument evaluation and respects parameter
writes, redeclarations, and direct eval. It conservatively skips
defaults, destructuring, rest parameters, and spread arguments, and
preserves the existing DCE-only IIFE behavior. Regular functions are
excluded when their own name is referenced or when they are non-strict,
since recursion and mapped arguments can invalidate the call's parameter
values.

Regression coverage includes multiple parameters, nested closures, side
effects, mixed BigInt arithmetic, argument duplication, recursion, and
strict versus sloppy arguments aliasing.

Fixes #27379.

Validation:

- `just fmt`
- `just test -p oxc_minifier` — 723 tests and 2 doctests passed; 33
existing tests ignored
- `just lint -p oxc_minifier`
- `pnpm run build-test` and `pnpm test` in `napi/minify` — 890 tests
passed; 14 skipped and 1 todo
- `just minsize` — size and allocation snapshots unchanged
- 586 runtime equivalence comparisons across 148 inputs through the Node
API, with and without mangling, in module and script modes

AI disclosure: Developed with OpenAI Codex.
2026-10-08 18:36:41 +08:00
Dunqing c3e99d160d fix(minifier): avoid invalid octal escapes in template folds (#25495)
Inlining constant template expressions can join a decimal digit onto a
preceding raw `\0`. The resulting `\00` is a forbidden octal escape
inside template literals, so DCE can emit JavaScript that fails to
parse. This surfaced in rolldown/rolldown#10661.

When a fold would create that boundary, serialize the null as `\x00` and
continue merging the template fragments. This preserves the cooked value
and the optimization, matches Terser and esbuild, and leaves
escaped-backslash cases unchanged.

## Example

Input:

```js
return `${messageId}\0${correlationId}\0${0}`;
```

Before:

```js
return `${messageId}\0${correlationId}\00`;
```

After:

```js
return `${messageId}\0${correlationId}\x000`;
```

Verified with `cargo test -p oxc_minifier` (643 passed, 35 ignored), the
DCE example's `--twice` idempotency check, a runtime equivalence check,
`just minsize` with unchanged size/allocation snapshots, Clippy with
warnings denied, and formatting. `just ready` additionally passed
dependency, typo, generation, formatting, workspace checks, and all
minifier tests; the remaining workspace run stopped on three unrelated
Oxlint ANSI-color snapshots because the environment sets `NO_COLOR=1`,
and a color-enabled rerun was blocked by the filesystem running out of
space.

Refs rolldown/rolldown#10661.

Implemented with AI assistance (OpenAI Codex). The contributor remains
responsible for reviewing, understanding, and submitting the change
under the Oxc AI usage policy.
2026-08-12 09:46:26 +08:00
Dunqing e8caf5bb74 fix(ci): allow Monitor Oxc on fork pull requests (#25055)
The [Monitor Oxc
job](https://github.com/oxc-project/oxc/actions/runs/30413998931/job/90456346227?pr=25041)
fails for fork PRs because `pull_request` workflows do not receive
repository secrets, leaving the GitHub App client ID empty.

Keep the `run-monitor-oxc` label trigger for same-repository PRs. Fork
label events are skipped before secrets are used; a trusted maintainer
can trigger them with `/monitor-oxc run` instead. The comment path
verifies triage permission, rejects PRs pushed after the command, and
dispatches the exact head SHA. This follows [Vite's ecosystem CI
workflow](https://github.com/vitejs/vite/blob/main/.github/workflows/ecosystem-ci-trigger.yml).

Verified with `just ready`.

AI assistance was used to investigate the failure and prepare this
change.
2026-07-31 10:25:55 +08:00
DunqingandYuji Sugiura 52433078a8 fix(formatter): preserve numeric separators in number literals (#19015)
Numbers with numeric separators (underscores) like
`123.000_000_000_000_000_000_000_0` were incorrectly having their
trailing zeros stripped, resulting in `123.0`.

Prettier preserves these numbers because its regex-based `\d` patterns
don't match underscores, so transformations like trailing-zero removal
can't match through separators. This adds an early bailout in
`format_trimmed_number` when the number contains underscores, only
applying lowercase and leading-zero normalization (`.1_1` → `0.1_1`).

Closes #18968

Co-authored-by: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com>
2026-02-08 10:24:30 +09:00
Dunqing 824a0de7c2 chore(github): add a tip for formatter diff issue template (#18453)
Waiting for https://github.com/oxc-project/playground/pull/250
2026-01-24 14:32:46 +08:00
Dunqing a63c88da8f test(tasks/prettier-conformance): ignore js/strings/template-literals.js which is an embedded formatting test (#18393) 2026-01-22 20:55:45 +08:00
DunqingandDunqing d3e4354282 refactor(formatter): clean up dead code in JSX (#16319)
Pure refactor, those are dead code

Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
2025-12-01 14:54:37 +09:00
9097167c30 fix(formatter): incorrect printing of union types with comments (#16205)
close: #16176

---------

Signed-off-by: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com>
Co-authored-by: Yuji Sugiura <y.sugiura.0316@gmail.com>
Co-authored-by: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-27 20:59:38 +09:00
d32d22e80c fix(formatter): correct FormatElement size check (#15461)
Fixes
https://github.com/oxc-project/playground/actions/runs/19187163966/job/54855957272

---------

Signed-off-by: Dunqing <dengqing0821@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-08 15:17:26 +08:00
DunqingandYuji Sugiura 467b3a1bbf perf(formatter): optimize grouping logic for call arguments (#15033)
Co-authored-by: Yuji Sugiura <y.sugiura.0316@gmail.com>
2025-10-30 10:02:03 +09:00
Dunqing 283e127224 docs(AI): let Claude read AGENTS.md (#13603)
References: 

https://github.com/anthropics/claude-code/issues/6235#issuecomment-3217884068
https://github.com/rolldown/rolldown/pull/6039

I've confirmed that it works.
2025-09-09 11:20:05 +08:00
Dunqingandoverlookmotel 24fee158e2 fix(transformer/legacy-decorator): emit correct metadata types for enum (#13327)
* close:  #13319

---------

Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2025-08-28 16:23:21 +01:00
Dunqingandautofix-ci[bot] 93b7e8a2cf docs(AI): make AI know how to test better (#13326)
Add critical information on how we test in each crate. Additionally, add
CLAUDE.md to fix the issue that Claude code doesn't read AGENTS.md
automatically.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-27 21:50:46 +08:00
Dunqing f6475e1965 refactor(codegen): remove the redundant base_len variable (#12882)
A follow-up of https://github.com/oxc-project/oxc/pull/12847. I just
noticed `base_len` is redundant
2025-08-10 15:18:31 +08:00
Dunqing 23c5951d26 fix(transformer/legacy-decorator): decorated fields with the declare modifier are not transformed (#12212)
Input: 
```ts
class DeclareFields {
  @dec declare name: string;
  @dec declare output: number;
}
```

Before output:
```ts
class DeclareFields {}
```

After output:
```ts
class DeclareFields {}

babelHelpers.decorate([dec], DeclareFields.prototype, "name", void 0);
babelHelpers.decorate([dec], DeclareFields.prototype, "output", void 0);
```


The `declare` fields with decorators should be transformed, but they
would be removed in the typescript plugin before legacy decorators
transform them, so this PR is to adjust the transform order and allow
`declare` fields can be transformed
2025-07-12 09:52:13 +08:00
Dunqing a2b7e9d29f feat(semantic)!: do not need to return old name in Scoping::set_symbol_name (#10613)
The only usage that needs the old name has been refactored in #10612.
Remove the returning old name logic, then the implementation is simpler.
2025-04-27 21:55:00 +08:00
Dunqing 075d4b54ca perf(semantic): optimize Scoping::rename_symbol method (#10612)
Optimize `Scoping::rename_symbol` to avoid calling `to_string`, since
the borrow checker is getting in the way, so the `set_symbol_name` and
`rename_binding` method implementations need to be combined.
2025-04-27 21:26:13 +08:00
Dunqing f35efd34cc refactor(traverse, semantic): move rename_symbol from TraverseScoping to Scoping (#10611)
Part of https://github.com/oxc-project/backlog/issues/163

Prepare #10612. I just found that this method has a `to_string`
allocation that can be avoided. However, it needs to combine
`set_symbol_name` and `rename_binding`, so move to `Semantic`.
2025-04-27 20:48:21 +08:00
DunqingandDunqing 8db9dc55dc perf(minifier/minimize_statements): reduce allocations of Vec (#10435)
Use `ctx.ast.vec_from_iter` to allocate a `Vec` for the result of
`drain` and use `take_in` to take a `Vec` rather than use
`vec_from_iter` + `drain` to avoid intermediate allocation.

<img width="742" alt="image"
src="https://github.com/user-attachments/assets/10011073-6706-435a-8d79-0b805e14f20c"
/>

Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
2025-04-16 14:56:24 +01:00
DunqingandDunqing ebe3496bdc perf(transformer/class-properties): return early if no private fields are found (#10418)
If a class or its parent classes don't have a private field, we don't
need to transform the expression. Because we only transform expressions
that include a private field.

Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
2025-04-16 21:26:53 +08:00
Dunqing f5b53d4cbb perf(transformer): do not update options from comments when only_remove_type_imports is enabled (#10167)
Because if `only_remove_type_imports` is enabled, no imports will be
removed, so we don't care about TypeScript's `jsx_pragma` and
`jsx_pragma_frag` options.

<img width="869" alt="image"
src="https://github.com/user-attachments/assets/1a3787f6-3af4-44b4-bf5e-e3db27b07659"
/>
2025-04-07 16:51:49 +08:00
aa06932abc feat(transformer): support ModuleRunnerTransform (#9371)
close: #9169 

NOTE: I didn't copy any `sourcemap` tests to here, because these are not
directly related to this plugin.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: 翠 / green <green@sapphi.red>
2025-03-03 11:38:47 +08:00
Dunqing 31746754a8 chore(coverage): update runtime snapshots (#8489)
Found a bunch of failed tests related to we don't use
`classPrivateSetter` and `classPrivateGetter` to transform private
getter and private setter. The simplest way is to add alternative helper
functions for these two. The reason we don't use I have explained in
#8132

```shell
tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «15») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «257») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0.5») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1000») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «96») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «6») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true
```
2025-01-14 22:06:10 +08:00
Dunqing 2a400d66d4 fix(transformer/typescript): retain TSImportEqualsDeclaration when it is exported 2025-01-14 19:12:23 +08:00
Dunqing 07edf74c58 perf(transformer/arrow-function): stop traversal at function as super() can't appear in a nested function (#8383) 2025-01-10 00:30:11 +00:00
Dunqing 8ed976661a fix(codegen): source map builder panicked because it attempted to subtract with overflow in search_original_line_and_column (#8185)
See:
https://github.com/oxc-project/monitor-oxc/actions/runs/12531534720/job/34949348092
Related: #7926 

This line causes panic.

https://github.com/oxc-project/oxc/blob/46fc1a8b7d26f1971d1809d68060cb0259dc4b53/crates/oxc_codegen/src/sourcemap_builder.rs#L147-L148

After investigation, I found that the root cause was the code removed
in this PR. I don’t understand what the code was used for, but it was
obviously wrong. Because `idx` is always smaller than `cap`
2024-12-31 20:00:41 +08:00
Dunqing e0d440a618 fix(wasm): use ScopeTree's flags rather than enter_scope's flags parameter (#7950)
close:
https://github.com/oxc-project/oxc/issues/7900#issuecomment-2545374960
2024-12-17 10:32:37 +08:00
Dunqing 49606ef2d8 fix(website): failed to build (#5230)
https://github.com/oxc-project/oxc/actions/runs/10558055209/job/29246786880

Looks caused by #5213
2024-08-26 19:41:40 +08:00
Dunqing e3561127fe chore(semantic): remove accidentally left comment (#5162) 2024-08-24 00:41:01 -04:00
Dunqing d3bbc620cc fix(isolated-declarations): declare modifier of PropertyDefinition should not be retained (#4941)
related: #4937

There are no tests/snapshots updates and seems we don't have a way to
test it until #4937 is merged. But I tested it locally and it worked!
2024-08-16 22:11:43 +08:00
Dunqing ecdee88cfb fix(transformer/typescript): incorrect eliminate exports when the referenced symbol is both value and type (#4507) 2024-07-27 12:11:29 -04:00
Dunqing cb2fa4924e fix(semantic): typeof operator cannot reference type-only import (#4500) 2024-07-27 00:21:06 -04:00
Dunqing ef0e953702 fix(semantic): generic passed to typeof not counted as a reference (#4499) 2024-07-27 00:16:25 -04:00
Dunqing e4ca06ae8c fix(semantic): incorrect symbol’s scope_id after var hoisting (#4458)
Bug found in https://github.com/rolldown/rolldown/pull/1726
2024-07-25 21:12:26 +08:00
Dunqing 855f2f6286 fix(website): incorrect reference displayed (#4453)
close: #4447
2024-07-24 23:13:18 -04:00
Dunqing 25dab7b1ac Revert "chore: fix failed publish caused by cyclic dev dependencies " (#4419)
Reverts oxc-project/oxc#4416

This trick doesn't work for crates that have circular dependencies on
each other that all need to be published!
2024-07-23 15:56:42 +08:00
Dunqing 426016d1d6 Revert "Release crates v0.22.0" (#4418)
Still release failed. Reverts oxc-project/oxc#4417
2024-07-23 15:51:01 +08:00
Dunqing c1cf0e6dd9 Revert "Release crates v0.22.0" (#4415)
Reverts oxc-project/oxc#4414
2024-07-23 09:59:38 +08:00
Dunqing fc39ffa009 Revert "Release crates v0.21.0" (#4342)
Reverts oxc-project/oxc#4338


https://github.com/oxc-project/oxc/actions/runs/9986290706/job/27598542089
Release failed
2024-07-18 14:11:42 +08:00
Dunqing 7ed27b75f9 perf(isolated-declarations): use FxHashSet instead of Vec to speed up the contain (#4074) 2024-07-08 00:16:25 +08:00
Dunqing 54b3b6c0da chore(benchmark): add isolated declarations (#4078) 2024-07-07 17:14:48 +08:00
Dunqing 0b147062c6 ci: ignore fixtures in link-check (#4002) 2024-07-01 23:56:01 +08:00
Dunqing 3e9e4c9912 chore(napi/transform): support wasm build (#3933)
~~Encountered the same problem as
https://github.com/oxc-project/oxc-resolver/issues/190. Fixed in
napi@2.16.7, but oxc use `3.x`~~

Fixed in napi@3.0.0-alpha.3
2024-06-30 19:49:02 +08:00
Dunqing 253410017f chore(ci): auto label for oxc_isolated_declarations (#3924) 2024-06-26 19:13:51 +08:00
Dunqing af5009a591 feat(transformer-dts): report error for invalid signature property key (#3698) 2024-06-16 16:10:14 +08:00
Dunqing 0578ece6a4 refactor(ast)!: remove ExportDefaultDeclarationKind::TSEnumDeclaration (#3666)
TypeScript doesn't support `export default enum id {}`


https://www.typescriptlang.org/play/?target=2&isolatedDeclarations=true&emitDeclarationOnly=true&isolatedModules=false&ts=5.5.1-rc#code/KYDwDg9gTgLgBAE2AMwIYFcA29gDt0C2cAlgnAN4C+QA

https://github.com/microsoft/TypeScript/issues/3320
2024-06-14 14:40:37 +08:00
Dunqing 59666e0127 fix(transformer): do not rename accessible identifier references (#3623)
close: #3620

In `Babel`, the expected output is:

```ts
var x = 10;
var Foo = function(Foo) {
       Foo[Foo['a'] = 10] = 'a';
       Foo[Foo['b'] = 10] = 'b';
       Foo[Foo['c'] = 30] = 'c';
       return Foo;
}(Foo || {});
```

IMO, `Foo.b + x` is enough, because `x` is not a const variable. The
output same as with `typescript`
2024-06-13 15:26:38 +08:00
Dunqing 5793ff1986 refactor(transformer): replace &’a Trivias with Rc<Trivias> (#3580)
`Transformer` needs to borrow `Trivias`.
https://github.com/rolldown/rolldown/pull/1364/files/8be1cc80520e1a466cd7b2d3fb8b637db9e529a9#r1630711060
2024-06-11 13:23:41 +08:00
DunqingandBoshen 0007ee47be chore(coverage, transformer_conformance): print all AST whether or not they are Typecript AST (#3556)
We have a conclusion that codegen will print whatever is in the AST,
instead of having an option to enable printing TypeScript syntax. I plan
to remove codegen's `enable_typescript` option after we strip out all
typescript AST in the transformer typescript plugin.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-06 15:45:20 +08:00
Dunqing affb2c864e fix(codegen): print indentation before directive (#3512) 2024-06-05 16:32:12 +08:00
Dunqing ddac2a0e12 refactor(codegen): reduce allocation for print_unquoted_str (#3525) 2024-06-04 16:46:56 +08:00
Dunqing d8063b6210 fix(codegen): wrong escape string (#3514)
close: #3492
2024-06-03 15:48:01 +08:00
Dunqing 350cd9158a fix(parser): should parser error when function declaration has no name (#3461)
https://oxc-project.github.io/oxc/playground/?code=3YCAAICNgICAgICAgICzncl%2FKeF7k4Y7upgY2l43c79%2FYxaAgA%3D%3D
2024-05-30 19:58:50 +08:00
Dunqing cf41513d28 fix(parser): parse const extends in arrow functions correctly (#3450)
close: #3443
2024-05-28 21:34:52 +08:00
Dunqing 9c58231c62 refactor(semantic): use a simpler way to resolve reference for ReferenceFlag::Type (#3430) 2024-05-27 22:43:52 +08:00
Dunqing 816a782254 feat(transformer): support targets option of preset-env (#3371)
The implementation of the `targets` options was copied from
[swc](https://github.com/swc-project/swc/tree/main/crates/preset_env_base),
which resulted in some added dependencies in transformer.
Currently, it has supported enabling plugins by `targets`
2024-05-27 10:33:40 +08:00
Dunqing 241e8d1899 feat(transformer/typescript): if the binding exists, the identifier reference is not renamed (#3387)
Related:
https://github.com/oxc-project/oxc/discussions/3251#discussioncomment-9528247
2024-05-27 01:00:04 +00:00
Dunqing bb2221e4f4 fix(linter/next): false positives for non-custom font link (#3383)
fix: #3378

They only check google fonts. 

https://github.com/vercel/next.js/blob/7e34b4cf98dff276147564b295572ccd6f142dd4/packages/eslint-plugin-next/src/rules/no-page-custom-font.ts#L152-L154
2024-05-22 12:01:14 +08:00
Dunqing e2c6fe0cb1 feat(transformer): report errors when options have unknown fields (#3322) 2024-05-19 01:19:40 +08:00
Dunqing 8ff1ffba74 feat(transformer_conformance): skip some tests that are known to fail (#3293)
I don't think we need to be completely consistent with Babel's output.
Because Babel's output doesn't always make sense.
2024-05-15 22:06:00 +08:00
Dunqing b9d69ad665 feat(transformer): do not add self attribute in react/jsx plugin (#3287)
follow-up: https://github.com/oxc-project/oxc/pull/3258.
2024-05-15 17:59:57 +08:00
Dunqing f38d138d97 chore: update the test-transformer command to support passing arguments (#3286) 2024-05-15 12:57:52 +08:00
Dunqing b4fa27a2ee fix(transformer): do no add __self when the jsx is inside constructor (#3258) 2024-05-14 16:12:49 +01:00
Dunqing 93030e8af9 chore(linter): change the category of all react-perf rules to perf (#3243)
close: #3242
2024-05-12 10:55:48 +08:00
Dunqing 6ac8a8479e fix(transformer): correctly jsx-self inside arrow-function (#3224) 2024-05-11 00:48:18 +00:00
Dunqing 18d853bb2b feat(transformer/react): support development mode (#3143) 2024-05-10 22:07:33 +08:00
Dunqing 0ba7778e5e fix(parser): correctly parse cls.fn<C> = x (#3208)
close: #3206
2024-05-09 10:23:45 +08:00
Dunqing a227050ed0 chore: update babel repo (#3205) 2024-05-08 20:15:15 +08:00
Dunqing fa0093b222 feat(linter): eslint-plugin-next/no-page-custom-font (#3185) 2024-05-07 09:53:43 +00:00
Dunqing 5514936f51 feat(linter): eslint-plugin-next/no-styled-jsx-in-document (#3184) 2024-05-07 10:35:28 +08:00
Dunqing f88f330426 feat(linter/import): improve multiple exports error message (#3160)
https://github.com/oxc-project/oxc/issues/3157#issuecomment-2094113518
2024-05-04 22:14:26 +08:00
DunqingandBoshen 6f5df113af feat(linter/import): move some rules out of nursery (#2841)
### Correctness
- named
- export
- default
- namespace
- no-unresolved

The above rules will prevent bugs or broken, so I changed these to
correctness

### Suspicious
- no-duplicates
- no-named-as-default-member
- no-named-as-default

I'm still not sure whether the `no-unresolved` rule should be changed to
`correctness`. Because I found that the rule reported a lot in the
AFFiNE. But in fact, they are all correct reports

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-04 18:51:26 +08:00
Dunqing a52e321b25 feat(transformer/jsx-source): get the correct lineNumber and columnNumber from the span. (#3142) 2024-05-01 00:30:47 +00:00
Dunqing be8fabedab feat(transformer/react): enable jsx plugin when development is true (#3141) 2024-04-30 15:48:17 +08:00
Dunqing b5894964d1 fix(transformer/arrow-functions): should not transform this in class (#3129) 2024-04-29 13:44:10 +00:00
DunqingandBoshen 843318cdbe refactor(transformer/typescript): reimplementation of Enum conversion based on Babel (#3102)
The remaining test cases will perform better with a scope
implementation, and while we can implement them without the scope, it
still requires us to do what the scope did.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-04-29 16:26:22 +08:00
Dunqing 905ee3fef1 feat(transformer): add arrow-functions plugin (#3083)
close: #2983
2024-04-29 08:04:01 +00:00
Dunqing c3d8a85eb5 feat(semantic): report that enum member must have initializer (#3113)
See
https://www.typescriptlang.org/play/?target=99#code/KYOwrgtgBAglDeAoKKoEMoF4oFk0BcALAOgGcBLEACgEYBKAGmVQCMmBfRRUSKAIQTMUGbACIaAJgDMopqihtEnRABtg+KADMwIAMZYoVOlgB8USVIDc3cNADCg+SK07dRuaw6IgA
2024-04-27 22:08:02 +08:00
Dunqing 2dd96df847 feat(semantic): report namespace related errors (#3093)
See
https://www.typescriptlang.org/play/?target=99#code/GYVwdgxgLglg9mABAIzgEwJ4AoCUiDeAUIomAIYC2ApgM4AOZEViAIgQL6HtA
2024-04-25 14:01:58 +08:00
Dunqing 3831147b6d feat(transformer/typescript): report error for export = <value> (#3021) 2024-04-18 18:56:29 +08:00
Dunqing 7416de217b feat(transformer/typescript): reports error for import lib = require(...); (#3020) 2024-04-18 18:54:45 +08:00
Dunqing e14ac17c72 feat(transformer/typescript): insert this assignment after the super call (#3018) 2024-04-18 18:53:01 +08:00
Dunqing b72bdcaf96 feat(transformer/react): reports duplicate __self/__source prop error (#3009) 2024-04-17 13:34:31 +08:00
Dunqing cdd3bc5a4e feat(transformer_conformance): enable typescript when the typescript plugin is present (#3007) 2024-04-16 10:47:06 +00:00
Dunqing 99e038cfc0 fix(transformer/typescript): modifiers should not be removed (#3005)
`codegen` relies on the modifier to decide whether to print or not. For
example, if declare is present, nothing will be printed if typescript is
not enabled.

We may need to solve this problem in a way that doesn't rely on
modifers.
2024-04-16 10:33:13 +00:00
Dunqing afb1dd4b24 feat(transformer/typescript): support for transform TSImportEqualsDeclaration (#2998) 2024-04-16 06:45:41 +00:00
Dunqing 6732e8b9af feat(transformer/typescript): support for transform enum (#2997)
The current implementation is copied from the previous implementation
2024-04-16 14:39:37 +08:00
Dunqing 6a53fa367b feat(transformer/typescript): correct elide imports/exports statements (#2995)
remove ts annotations one benefit: `IdentifierReference` only used on js
code

The `TypescriptReferenceCollector` implementation is inspired by
https://github.com/swc-project/swc/blob/5f75019683a2f1dc03dda68d6832632ee5d8699c/crates/swc_ecma_transforms_typescript/src/strip_import_export.rs#L9-L99

This seems simpler to implement than using scope
2024-04-16 11:06:58 +08:00
Dunqing fd5002bc51 feat(codegen): correctly print type-only imports/exports (#2993) 2024-04-15 18:33:02 +08:00
Dunqing df628289ff fix(linter/import): ignore export declaration in no-duplicates (#2863) 2024-03-30 12:57:43 +08:00
Dunqing c4528974cb fix(linter/import): false positive for indirect export in namespace (#2862) 2024-03-30 12:55:51 +08:00
Dunqing 23651980d1 feat(cli): add tsconfig file validation in LintRunner (#2850) 2024-03-29 19:56:30 +08:00
Dunqing 76cc90684a feat(linter/import): ignore type-only imports and exports in no_unresolved (#2849)
https://github.com/import-js/eslint-plugin-import/blob/fa60e3d738078fa2fccbc36260b9da534795f720/src/rules/no-unresolved.js#L32-L35
2024-03-29 19:54:45 +08:00
Dunqing 1b5e544a36 refactor(semantic): distinguish whether requested_modules is type imports/exports (#2848) 2024-03-29 19:52:30 +08:00
Dunqing 2c6bfa3dde feat(linter/import) check type import in no_duplicates (#2777)
Grouping unmergeable imports to determine if they are duplicates
2024-03-28 17:13:25 +08:00
Dunqing 920d1be286 feat(linter/import) check module import in no_duplicates (#2771)
We should use `requested_modules` instead of `loaded_modules` because
`loaded_modules` only contains successfully resolved modules.
2024-03-28 15:25:10 +08:00
Dunqing d63807e703 feat(linter): fallback to the default tsconfig path (#2842)
Users usually do not need to manually set the tsconfig path, as it is
usually located in cwd/tsconfig.json.
2024-03-28 15:23:12 +08:00
Dunqing ab7d7dcbe8 feat(linter/import) support allow_computed option in namespace (#2840) 2024-03-28 14:49:39 +08:00