Boshen
0d7bc8f255
feat(ast): fill in missing ast visits ( #2705 )
...
closes #2700
2024-03-13 16:31:01 +08:00
Boshen
1facc8d35d
chore: add clippy::cargo rules
2024-03-13 15:01:08 +08:00
cinchen
265030d049
feat(linter): eslint-plugin-jest: prefer-spy-on ( #2666 )
...
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-spy-on.ts )
2024-03-13 14:01:31 +08:00
underfin
2dfc0cc28e
chore: upgrade sourcemap 7.1.1 ( #2701 )
2024-03-13 13:52:36 +08:00
Wang Wenzhe
11219d4415
feat(linter/tree_shaking): check assignment of identifier ( #2697 )
2024-03-13 11:45:42 +08:00
Wang Wenzhe
f3eab76410
chore(linter/tree_shaking): comment tree-shaking test code and remove ignore flag ( #2696 )
2024-03-13 11:42:16 +08:00
overlookmotel
acf127be35
fix(ast): correct TS type for ArrayAssignmentTarget ( #2699 )
...
`trailing_comma` field in JSON AST is camel case `trailingComma`.
2024-03-13 00:15:57 +00:00
overlookmotel
89e8d1526f
refactor: derive SerAttrs on all AST types ( #2698 )
...
Add `SerAttrs` derive to a few types that I missed out in #2669 .
2024-03-13 00:14:04 +00:00
Boshen
0f86333437
refactor(ast): refactor Trivias API - have less noise around it ( #2692 )
2024-03-12 20:16:36 +08:00
Boshen
86ee074678
fix(parser): remove all duplicated comments in trivia builder ( #2689 )
2024-03-12 17:51:22 +08:00
Boshen
977c20b677
feat(coverage): add a duplicate comment check ( #2688 )
2024-03-12 16:52:34 +08:00
Boshen
cda9c93436
fix(parser): improve lexing of jsx identifier to fix duplicated comments after jsx name ( #2687 )
2024-03-12 15:51:51 +08:00
Boshen
6c6adb46d1
fix(ast): parse rest parameter with the correct optional and type annotation syntax ( #2686 )
...
closes #2653
2024-03-12 15:47:22 +08:00
Dunqing
e86cd629c8
feat(linter/import): support check reexport binding in namespace ( #2678 )
2024-03-12 13:21:19 +08:00
Wang Wenzhe
220eba14cd
refactor(lint): split files for no_side_effects rule ( #2684 )
2024-03-12 11:09:33 +08:00
Wang Wenzhe
3ae94795a1
feat(linter): report side effect for array element in node_side_effects rule ( #2683 )
2024-03-12 11:04:38 +08:00
Boshen
366a87975d
feat(linter): resolve ESM star exports ( #2682 )
2024-03-11 21:43:11 +08:00
Boshen
8a73d18fcf
chore(parser): make sure all span.end >= span.start ( #2681 )
...
closes #2679
2024-03-11 19:49:51 +08:00
overlookmotel
75ae563dbc
refactor(span): change shape of Language ( #2680 )
...
Closes #2677 .
Also changed the JSON output to be `javascript`, `typescript` or
`typescriptDefinition`. The current value `javaScript` / `typeScript` is
a bit weird.
2024-03-11 19:03:06 +08:00
Arnaud Barré
b378e7ecc9
fix(parser): fix span for JSXEmptyExpression with comment ( #2673 )
...
[playground](https://oxc-project.github.io/oxc/playground/?code=3YCAAICVgICAgICAgICejwtjmCpbllbPawdM2eEFKwhGb62iFlQWu39yrLCA )
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-03-11 10:50:33 +00:00
renovate[bot]
68c01d304e
chore(deps): update softprops/action-gh-release action to v2 ( #2676 )
2024-03-11 15:33:50 +08:00
renovate[bot]
7128b814d4
chore(deps): update website npm packages ( #2675 )
2024-03-11 15:14:24 +08:00
overlookmotel
3305734b34
fix(ast): add type field to TS types for ObjectPattern etc ( #2670 )
...
Fixes #2658 (details given in https://github.com/oxc-project/oxc/issues/2657#issuecomment-1987289481 ).
Add `type` fields to TS types for `ObjectPattern`, `ArrayPattern` etc which were missing previously.
2024-03-11 13:42:28 +08:00
renovate[bot]
3a19169764
chore(deps): update vscode npm packages ( #2672 )
2024-03-11 13:39:27 +08:00
renovate[bot]
b822b6d9eb
chore(deps): update rust crates ( #2671 )
2024-03-11 13:39:02 +08:00
overlookmotel
3c1e0db53f
refactor: reduce cfg_attr boilerplate with SerAttrs derive ( #2669 )
...
Closes #2641 .
Also added `tsify` attribute to the `SerAttrs` derive macro, so `#[cfg_attr(feature = "wasm", tsify(...))]` can also be reduced to `#[tsify(...)]`.
2024-03-11 13:38:24 +08:00
overlookmotel
f27db301a9
fix(ast): fix TS type for AssignmentTargetRest ( #2668 )
...
Fix for #2657 .
2024-03-11 12:42:45 +08:00
overlookmotel
cba1e2f338
refactor(ast): import Tsify to shorten code ( #2665 )
...
Pure refactor. Import `tsify::Tsify` in files that use it, so then shorten a load of:
```diff
- #[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
+ #[cfg_attr(feature = "wasm", derive(Tsify))]
```
2024-03-11 12:37:10 +08:00
overlookmotel
d47f0e247d
fix(ast): rename TSIndexSignatureName in JSON AST ( #2664 )
...
Fixes #2656 .
2024-03-10 17:11:28 +00:00
Wang Wenzhe
975bc05f76
chore(tasks): remove unused rulegen command ( #2667 )
2024-03-10 23:00:22 +08:00
Wang Wenzhe
f8e8af2a66
feat(task): init eslint-plugin-tree-shaking rule ( #2662 )
2024-03-10 22:07:34 +08:00
Wang Wenzhe
588e94604c
chore(tasks): replace \" with single double quote ( #2663 )
2024-03-10 22:02:35 +08:00
Wang Wenzhe
a218242632
fix(wasm): use default compress option when compress is opened in playground ( #2661 )
...
Closes : #2645
2024-03-10 14:29:29 +08:00
Arnaud Barré
82260318a9
fix(parser): fix span start for return type in function type ( #2660 )
...
This matter for code like. This matches the behavior of both Babel and
TSESLint.
```ts
export type Plugin = (
a: string
) => // Comment
number
```
[TSESLint](https://ast.sxzz.moe/#eNo9jMEKwjAMQH8l5KQw2X0wL/6AB/HUS61hVNq0pKkoY/9u52C35L3kzRhwwJd92+LEZ8UOcwP6zbSBE5XgeeWucfrkJAqrhmuok2cY4WAYwA5QVDxPho8wnqHv4ZJiJFbDXOODpCVSS8zrtcGSqji6tZDBoe0xPWtoc7dpctHeSYpPvPlglYruXixP/0+VSoYXXH53+0Kk )
[OXC](https://oxc-project.github.io/oxc/playground/?code=3YCAAIC5gICAgICAgICyHorESipoTp3admelrvvzLVu5WllVkMM9n7p1s27YYhddDchOGSC6foF%2BGw%2B1Mfo7DYhiNueGpuc27%2F3gf2tToIA%3D )
2024-03-10 13:32:25 +08:00
Arnaud Barré
c3477de64e
fix(ast)!: rename BigintLiteral to BigIntLiteral ( #2659 )
...
This matches the case for the name in Babel. (in ESTree everything is a
`Literal`)
2024-03-10 13:31:51 +08:00
overlookmotel
a01cf9f115
refactor(ast): remove Serialize impls for Identifier types ( #2651 )
...
`Serialize` can be derived for `IdentifierName` etc without explicit
`impl Serialize`, as they just need serde to skip some fields. No
changes to the JSON output, just a bit simpler.
2024-03-10 13:31:25 +08:00
Arnaud Barré
b453a072cc
fix(parser): parse named rest element in type tuple ( #2655 )
...
This is fixing the parser for `type X = [...args: string[]];`
In TSESLint TSNamedTupleMember in part of the TSType union, so I did the
same.
2024-03-10 13:25:15 +08:00
Arnaud Barré
776812315d
fix(parser)!: drop TSImportEqualsDeclaration.is_export ( #2654 )
...
This is one point where Babel and TSESLint diverge. For linter purposes
TSESLint structure makes more sense and that the reason of
https://github.com/typescript-eslint/typescript-eslint/issues/4130
The remaining `is_export` was creating redundant information and made
prettier (and the WIP oxc/prettier) print the AST of `export import X =
Y` as `export export import X = Y`.
2024-03-10 13:22:18 +08:00
overlookmotel
cc5be633f2
fix(ast): fix serializing rest elements ( #2652 )
...
Fix a mistake I made in #2567 . Length that `serialize_seq` is called
with should only be `+1` if there is a rest element being added on the
end.
Makes no difference for serializing to JSON, as JSON serializer doesn't
use the `len` value, but still better to get it right.
2024-03-10 02:03:05 +00:00
Boshen
32303b20fb
New tool: oxc_module_lexer ( #2650 )
...
# Oxc Module Lexer
This is not a lexer. The name "lexer" is used for easier recognition.
## [es-module-lexer](https://github.com/guybedford/es-module-lexer )
Outputs the list of exports and locations of import specifiers,
including dynamic import and import meta handling.
Does not have any
[limitations](https://github.com/guybedford/es-module-lexer?tab=readme-ov-file#limitations )
mentioned in `es-module-lexer`.
I'll also work on the following cases to make this feature complete.
- [ ] get imported variables
https://github.com/guybedford/es-module-lexer/issues/163
- [ ] track star exports as imports as well
https://github.com/guybedford/es-module-lexer/issues/76
- [ ] TypeScript specific syntax
- [ ] TypeScript `type` import / export keyword
## [cjs-module-lexer](https://github.com/nodejs/cjs-module-lexer )
- [ ] TODO
## Benchmark
This is 2 times slower than `es-module-lexer`, but will be significantly
faster when TypeScript is processed.
The difference is around 10ms vs 20ms on a large file (700k).
2024-03-09 23:23:55 +08:00
Cameron
66a64dfc48
feat(linter) eslint: no-useless-rename ( #2648 )
2024-03-09 21:37:48 +08:00
Boshen
8b3de7748b
feat(span): impl<'a> PartialEq<str> for Atom<'a> ( #2649 )
2024-03-09 09:30:14 +00:00
Boshen
c72675e89e
chore: Rust v1.76.0 ( #2643 )
2024-03-08 20:54:36 +08:00
Boshen
265b2fb640
feat: miette v7 ( #2465 )
2024-03-08 15:50:00 +08:00
overlookmotel
88f94bb6f6
fix(ast): add RestElements in serialized AST to elements array ( #2567 )
...
A step towards #2463 .
This PR adds `rest` onto end of `elements` / `properties` array in JSON
AST for `ObjectPattern`, `ArrayPattern`, `ObjectAssignmentTarget`,
`ArrayAssignmentTarget` and `FormalParameters`.
2024-03-08 02:56:12 +00:00
Yuji Sugiura
2609e9021b
fix(semantic/jsdoc): Fix up builder ( #2623 )
...
- [x] Update `should_attach_jsdoc` definition
- [x] Update ~poem~ architecture decision comments
- [x] Refine tests
2024-03-08 10:49:51 +08:00
overlookmotel
d76ee6b2db
refactor: "wasm" feature enable "serde" feature ( #2639 )
...
Make `wasm` feature also enable `serde` feature. This allows shortening
a lot of `#[cfg_attr]`s.
As discussed in
https://github.com/oxc-project/oxc/pull/2638#issuecomment-1984066757 .
2024-03-08 10:06:49 +08:00
overlookmotel
6b5723cdbe
refactor(ast): shorten manual TS defs ( #2638 )
...
Does the same thing, just (in my opinion) a little bit more readable.
2024-03-08 00:53:51 +08:00
Dunqing
308b780ff6
feat(transformer/decorators): handling the coexistence of class decorators and member decorators ( #2636 )
...
No snapshots have been updated. Because our output is a bit different
from babel's
<img width="961" alt="image"
src="https://github.com/oxc-project/oxc/assets/29533304/9926766c-b1ec-46c3-8c8f-53f053b14f84 ">
2024-03-07 16:52:30 +08:00
magic-akari
8e3e4043bc
feat(prettier): print with_clause in reexport declaration ( #2635 )
2024-03-07 14:24:16 +08:00