Commit graph

3099 commits

Author SHA1 Message Date
Boshen
c1a2958a5a
chore: remove oxc_transformer for a reimplementation (#2865)
closes #2860
2024-03-30 17:19:46 +08:00
Boshen
31ed532b79
Release crates v0.11.0 2024-03-30 13:54:53 +08:00
Boshen
52a9f08a57
chore: remove release-plz 2024-03-30 13:50:41 +08:00
Boshen
e7307ed23c
Release oxlint and vscode extension v0.2.15 2024-03-30 13:34:38 +08:00
Boshen
ec0bb077ca
chore(linter): change rule category for some of the new rules 2024-03-30 13:26:33 +08:00
Boshen
348c3e9bb3
ci: rename and tweak publish crates action 2024-03-30 13:20:29 +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)
fa60e3d738/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
underfin
6177c2f7ef
fix(codegen): sourcemap token name should be original name (#2843)
close https://github.com/oxc-project/oxc/issues/2753.
2024-03-28 20:14:10 +08:00
underfin
b199cb89a2
feat: add oxc sourcemap crate (#2825)
The sourcemap implement port from
[rust-sourcemap](https://github.com/getsentry/rust-sourcemap), but has
some different with it.

- Encode sourcemap at parallel, including quote `sourceContent` and
encode token to `vlq` mappings.
- Avoid `Sourcemap` some methods overhead, like `SourceMap::tokens()`
caused extra overhead at common cases. Here using `SourceViewToken` to
instead of it.
2024-03-28 19:36:38 +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
Dunqing
40f4c1fafd
feat(linter/import) check deep namespace in namespace rule (#2805) 2024-03-28 14:47:36 +08:00
Wang Wenzhe
0cae373672
feat(linter/tree-shaking): pass CallExpression cases (#2839) 2024-03-28 09:48:41 +08:00
Dunqing
ec05a41525
chore: update transformer snapshots (#2838) 2024-03-27 15:02:09 +08:00
Dunqing
d67100730b
feat(tasks/transforme_conformance): support for testing oxc's test cases (#2835)
Related to:
https://github.com/oxc-project/oxc/pull/2822#issuecomment-2021802212

Although `babel` has a lot of test cases, we still need to add edge
cases that `babel` doesn't have.

This PR will allow us to add out test cases to
`/root/oxc/tasks/transform_conformance/tests`. The directory structure
is consistent with `babel`

For example
```shell
# cd /root/oxc/tasks/transform_conformance/tests
- babel-transform-plugin–optional-catch-binding
   - test
       - fixtures
           - your tests # add test cases here
```
2024-03-27 14:14:15 +08:00
Dunqing
947a9f05e8
fix(semantic): missing SymbolFlags::Export when identifier used in ExportDefaultDeclaration (#2837) 2024-03-27 14:13:25 +08:00
Ali Rezvani
528744ca0a
fix(transformer): optional-catch-binding unused variable side effect (#2822)
Before this PR for this given case:

```javascript
const _unused = "It's a lie, They gonna use me:(";
try {
    throw 0;
} catch {
  console.log(_unused);
}
```

We would've generated this:

```javascript
const _unused = "It's a lie, They gonna use me:(";
try {
    throw 0;
} catch (_unused) {
  console.log(_unused);
}
```

This is incorrect, This PR aims to use the `CreateVars` trait in order
to ensure the variable uniqueness.

Now it would output this:

```javascript
const _unused = "It's a lie, They gonna use me:(";
try {
    throw 0;
} catch (_unused2) {
  console.log(_unused);
}
```
2024-03-27 13:53:02 +08:00
Ali Rezvani
b76b02d019
fix(parser): add support for empty module declaration (#2834)
Should be merged after #2829, Tried a few times to get it done with
graphite stacking but found no success. I guess it either doesn't work
with forks or It is just a skill issue since I'm not familiar with it.

closes: #2829
closes: #2830

---------

Co-authored-by: Dmytro Maretskyi <maretskii@gmail.com>
2024-03-27 13:48:03 +08:00
cinchen
f6391f9b43
feat(linter): eslint-plugin-jest/prefer-comparison-matcher (#2806)
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-comparison-matcher.ts)

---------

Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-03-27 12:17:36 +08:00
renovate[bot]
8c6936ab74
chore(deps): lock file maintenance rust crates (#2827) 2024-03-26 16:04:53 +00:00
Boshen
95fc28168c
chore: apply cargo autoinherit (#2826)
See https://github.com/mainmatter/cargo-autoinherit
2024-03-26 23:57:50 +08:00
overlookmotel
881329dc1a
chore: remove cargo-machete package metadata (#2824)
`cargo-machete` has been replaced with `cargo-shear`, so the package
metadata for `cargo-machete` is no longer required.
2024-03-26 22:40:49 +08:00
Wang Wenzhe
3897cf4118
chore(eslint/tree-shaking): add NoEffect explicitly (#2823) 2024-03-26 21:32:29 +08:00
Wang Wenzhe
fa39fa87b3
feat(linter/tree-shaking): check CallExpression when called (#2809) 2024-03-26 21:24:04 +08:00
Ali Rezvani
fe12617315
refactor(transformer): pass options via context. (#2794)
With this PR all transformers would get their `AstBuilder` and options
via `TransformerCtx`.
2024-03-26 21:21:31 +08:00
Boshen
75edb49c43
chore: add CHANGELOG.md 2024-03-26 21:03:22 +08:00
cinchen
f131442bbf
feat(linter): eslint-plugin-jest/no-untyped-mock-factory (#2807)
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/no-untyped-mock-factory.ts)

---------

Co-authored-by: wenzhe <mysteryven@gmail.com>
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-03-26 20:05:36 +08:00
Yuji Sugiura
df744b205a
feat(semantic/jsdoc): Add Span for JSDoc, JSDocTag (#2815) 2024-03-26 18:40:31 +08:00
Boshen
c5ccd5e7a1
ci: add release-plz 2024-03-26 18:18:16 +08:00
Ali Rezvani
243131d7a4
feat(transformer): numeric separator plugin. (#2795)
[es2021 numeric
separator](https://babeljs.io/docs/babel-plugin-transform-numeric-separator)
2024-03-26 18:15:12 +08:00
Ali Rezvani
56493bd02b
feat(transformer): add transform literal for numeric literals. (#2797)
[es2015 transform
literals](https://babeljs.io/docs/babel-plugin-transform-literals)

---------

Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-03-26 16:27:32 +08:00
Ali Rezvani
3d0ea545ca
chore: using numeric value for profile.dev.debug. (#2820)
Change the `profile.dev.debug` value from `limited` to `1` which is the
same thing according to
[this](https://doc.rust-lang.org/cargo/reference/profiles.html#debug).

For some reason, the numeric value was failing when running the codspeed
benchmark.

------

#### Edit:

it was resulting in the following error:

```
   failed to parse manifest at `/home/runner/work/oxc/oxc/Cargo.toml`
```

Related to #2812
2024-03-26 16:15:34 +08:00
Dunqing
224299fe5c
ci: ci should run when clone-submodules/action.yml changes (#2816)
When we change `clone-submodules/action.yml`, the snapshot will probably be updated as well, so I'd run ci to make sure the snapshot is correct.
2024-03-26 11:58:55 +08:00
Dunqing
220f722f19
chore: update snapshots (#2817)
Babel repo is updated in #2813 and #2814
2024-03-26 11:53:26 +08:00
Ali Rezvani
dcbbda3b2d
ci: update babel version (#2814)
In my privius PR I changed this version in justfile It seems like the
version used in CI is different from justfile.
2024-03-26 10:13:34 +08:00
Ali Rezvani
f9d6f33a80
ci(coverage): update babel version. (#2813)
This PR updates the babel submodule in the justfile to take advantage of
[this PR](https://github.com/babel/babel/pull/16381). Related to #2795
and #2797.
2024-03-26 09:42:19 +08:00
Boshen
66117b10aa
ci: cargo doc --no-deps 2024-03-26 01:56:16 +08:00
Boshen
33eca79440
chore: try speeding up compilation by setting debug = "limited" for [profile.dev] (#2812) 2024-03-26 01:55:46 +08:00
Boshen
c92e0ff892
ci: force install Rust minimal profile 2024-03-26 01:38:15 +08:00
Boshen
06a81409f1
ci: actions/checkout@v4 -> taiki-e/checkout-action@v1 (#2811)
This does not depend on node.js, and sets persist-credentials to false
2024-03-26 01:24:51 +08:00
Ali Rezvani
fc3878350f
refactor(ast): add walk_mut functions (#2776)
* move `visit` and `visit_mut` modules to a super module called `visit`
* add `walk_mut` module containing walk functions
* update `enter_node` and `leave_node` events to not pass a reference in the `VisitMut` trait
* add `AstType`, a non-referencing version of `AstKind` to use with `VisitMut` trait
* update the `VisitMut` trait's usages.
2024-03-25 20:40:13 +03:30
Boshen
e32a3b3783
ci: use cargo-shear (#2810) 2024-03-26 00:43:10 +08:00
Dunqing
68e011c479
fix(tasks/transform-conformance) when the output file does not exist, the output content should be empty (#2808)
https://github.com/oxc-project/oxc/pull/2795#issuecomment-2018018675
2024-03-25 23:28:00 +08:00
renovate[bot]
3d761f17c2
chore(deps): lock file maintenance rust crates (#2804) 2024-03-25 17:24:30 +08:00