overlookmotel
78fee6ee24
feat(ast): add AstBuilder::*_with_scope_id etc methods ( #6760 )
...
Add methods to `AstBuilder` to create AST nodes with `ScopeId`, `SymbolId`, `ReferenceId`, for use in transformer.
e.g. `identifier_reference_with_reference_id`, `binding_identifier_with_symbol_id`, `block_statement_with_scope_id `.
2024-10-22 03:40:02 +00:00
overlookmotel
e8d3d8b07b
refactor(ast_tools): remove dead code in AstBuilder generator ( #6757 )
...
`ReferenceFlags` no longer appears in the AST.
2024-10-22 00:12:01 +00:00
overlookmotel
46720be7af
docs(ast): improve formatting of AstBuilder doc comments ( #6756 )
2024-10-22 00:12:01 +00:00
Boshen
70efa47d75
fix(coverage): turn off refresh plugin in runtime test ( #6749 )
2024-10-21 15:53:29 +00:00
overlookmotel
8c489a4e7e
refactor(ast_tools): remove dead code ( #6745 )
...
This code has been unused for a couple of months, so it seems unlikely we'll need it again.
2024-10-21 14:53:23 +00:00
overlookmotel
5b41eeaa9d
fix(ast_tools): fix miscalculation of enum niches ( #6743 )
...
Follow-on after #5774 . Correct the logic for calculating niches in enums.
It's still not quite correct - number of niches depends on how many spare discriminant "slots" there are at *start or end* of the range, not in total. But this is closer to correct than it was - we now don't take into account whether enum variant payloads have niches or not, which is not relevant.
2024-10-21 14:27:45 +00:00
Boshen
202c7f66c7
fix(ast)!: remove AstKind::ExpressionArrayElement and AstKind::ClassHeritage ( #6740 )
...
closes #6392
2024-10-21 13:30:48 +00:00
rzvxa
e8f8409d01
fix(ast_tools): fix miscalculation of enum layouts. ( #5774 )
...
Fixes a bug with how we were calculating the size of enums when there are different padding on variants and there aren't enough niches. Now it aligns the largest variant size to the largest alignment before consuming niches.
2024-10-21 12:19:37 +00:00
Boshen
b09e28b720
fix(coverage): fix compile error
2024-10-21 19:44:02 +08:00
Boshen
112580a408
feat(coverage): add transformer and minifier to runtime test ( #6734 )
...
closes #6578
2024-10-21 08:55:29 +00:00
Boshen
2e8579ce81
chore(coverage): update codegen runtime snapshot ( #6730 )
2024-10-21 06:14:53 +00:00
DonIsaac
8d27e2daab
docs(ast): enforce doc comments on generated ASTBuilder methods ( #6713 )
...
Part of https://github.com/oxc-project/backlog/issues/130
2024-10-21 05:28:54 +00:00
overlookmotel
41a6ad63b6
refactor(ast_tools): add Derive::snake_name method ( #6717 )
...
Follow-on after #6404 . Add `Derive::snake_name` method which defaults to `Self::trait_name().to_case(Case::Snake)`, but can be overridden. This allows moving the "special case" code for `ESTree` filename into `estree.rs`.
2024-10-21 02:55:38 +00:00
Cam McHenry
fc647ab7aa
fix(tasks/lint_rules): sync vitest compatible rules with jest rules ( #6667 )
...
Ensures that Jest rules which are compatible with Vitest are properly
reflected in the tracking issue.
Here is a preview of what the updated markdown looks like:
---
---
> [!WARNING]
> This comment is maintained by CI. Do not edit this comment directly.
> To update comment template, see
https://github.com/oxc-project/oxc/tree/main/tasks/lint_rules
This is tracking issue for `eslint-plugin-vitest`.
There are 51(+ 1 deprecated) rules.
- 1/8 recommended rules are remaining as TODO
- 30/43 not recommended rules are remaining as TODO
To get started, run the following command:
```sh
just new-vitest-rule <RULE_NAME>
```
Then register the rule in `crates/oxc_linter/src/rules.rs` and also
`declare_all_lint_rules` at the bottom.
## Recommended rules
<details open>
<summary>
✨ : 7, 🚫 : 0 / total: 8
</summary>
| Status | Name | Docs |
| :----: | :--- | :--- |
| ✨ | vitest/no-identical-title |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
|
| ✨ | vitest/expect-expect |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
|
| ✨ | vitest/no-commented-out-tests |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
|
| ✨ | vitest/no-import-node-test |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
|
| | vitest/valid-title |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
| ✨ | vitest/valid-expect |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
|
| ✨ | vitest/require-local-test-context-for-concurrent-snapshots |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
| ✨ | vitest/valid-describe-callback |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
|
✨ = Implemented, 🚫 = Not supported
</details>
## Not recommended rules
<details open>
<summary>
✨ : 13, 🚫 : 0 / total: 43
</summary>
| Status | Name | Docs |
| :----: | :--- | :--- |
| | vitest/prefer-lowercase-title |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
|
| | vitest/max-nested-describe |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
|
| ✨ | vitest/no-focused-tests |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
|
| ✨ | vitest/no-conditional-tests |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
| ✨ | vitest/consistent-test-it |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
|
| | vitest/prefer-to-be |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
|
| | vitest/no-hooks |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
| | vitest/no-restricted-vi-methods |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
| | vitest/consistent-test-filename |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
| | vitest/max-expects |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
| ✨ | vitest/no-alias-methods |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
|
| ✨ | vitest/no-conditional-expect |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
|
| ✨ | vitest/no-conditional-in-test |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
|
| ✨ | vitest/no-disabled-tests |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
|
| | vitest/no-duplicate-hooks |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
|
| | vitest/no-large-snapshots |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
|
| | vitest/no-interpolation-in-snapshots |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
| | vitest/no-mocks-import |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
|
| | vitest/no-restricted-matchers |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
| | vitest/no-standalone-expect |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
|
| ✨ | vitest/no-test-prefixes |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
|
| | vitest/no-test-return-statement |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
| | vitest/prefer-called-with |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
|
| ✨ | vitest/prefer-to-be-falsy |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
| ✨ | vitest/prefer-to-be-object |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
| ✨ | vitest/prefer-to-be-truthy |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
| | vitest/prefer-to-have-length |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
|
| | vitest/prefer-equality-matcher |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
| | vitest/prefer-strict-equal |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
| | vitest/prefer-expect-resolves |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
|
| ✨ | vitest/prefer-each |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
| | vitest/prefer-hooks-on-top |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
|
| ✨ | vitest/prefer-hooks-in-order |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
|
| | vitest/prefer-mock-promise-shorthand |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
| | vitest/prefer-snapshot-hint |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
|
| | vitest/require-top-level-describe |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
| | vitest/require-to-throw-message |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
|
| | vitest/require-hook |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
| | vitest/prefer-todo |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
|
| | vitest/prefer-spy-on |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
|
| | vitest/prefer-comparison-matcher |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
|
| | vitest/prefer-to-contain |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
|
| | vitest/prefer-expect-assertions |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
✨ = Implemented, 🚫 = Not supported
</details>
## Deprecated rules
<details >
<summary>
✨ : 0, 🚫 : 0 / total: 1
</summary>
| Status | Name | Docs |
| :----: | :--- | :--- |
| | vitest/no-done-callback |
https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md
|
✨ = Implemented, 🚫 = Not supported
</details>
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-21 10:55:17 +08:00
overlookmotel
902a3d0495
feat(ast_tools): ability to generate text files ( #6686 )
...
This was originally in #6404 but I pulled it out to reduce that PR's diff.
Add ability (currently unused) to output arbitrary text files from `oxc_ast_tools` generators.
2024-10-20 21:28:59 +00:00
overlookmotel
136029ee58
refactor(ast_tools): give GeneratorOutput and SideEffect named fields ( #6685 )
...
Pure refactor. Named fields are clearer.
2024-10-20 21:28:59 +00:00
overlookmotel
53049fe7fa
fix(wasm): remove type defs for ArrayExpressionElement and Elision ( #6683 )
...
Follow-on after #6404 .
`ArrayExpressionElement` and `Elision` are not used in the TS types, because `ArrayExpression` has an override for the field it uses.
002289b4b1/crates/oxc_ast/src/ast/js.rs (L293-L302)
Prevent these TS type defs being emitted by introducing a new `#[estree(custom_ts_def)]` attr, to go with `#[estree(custom_serialize)]`.
2024-10-20 21:22:56 +00:00
Boshen
f99528d3c2
refactor(coverage): remove unused run_sync_v8_test262_status ( #6704 )
2024-10-20 16:02:26 +00:00
Boshen
8b25131d11
refactor(minifier): binary operations use ConstantEvaluation ( #6700 )
2024-10-20 15:13:27 +00:00
Boshen
3711c32f22
chore(coverage): bump test262, babel and TypeScript ( #6702 )
...
closes #6692
2024-10-20 15:02:26 +00:00
overlookmotel
85e69a11ef
refactor(ast_tools): add line breaks to generated code for ESTree derive ( #6680 )
...
Follow-on after #6404 . Style nit. Add line breaks to generated code, to make it easier to read.
2024-10-19 19:50:13 +00:00
overlookmotel
ad8e293197
refactor(ast_tools): shorten generated code for impl Serialize ( #6684 )
...
Follow-on after #6404 . Shorten generated code for `impl Serialize`.
2024-10-19 19:50:12 +00:00
overlookmotel
9ba2b0e3a3
refactor(ast_tools): move #[allow] attrs to top of generated files ( #6679 )
...
Follow-on after #6404 . Shorten generated code for `impl Serialize` by moving `#[allow]` attrs to top of file.
2024-10-19 19:50:12 +00:00
overlookmotel
f0dd19a48f
refactor(ast_tools): shorten code ( #6678 )
...
Follow-on after #6404 . Pure refactor. Shorten code for deriving `ESTree` by reducing repetition.
2024-10-19 19:50:11 +00:00
overlookmotel
59dd061cea
refactor(ast_tools): rename var ( #6676 )
...
Follow-on after #6404 . Pure refactor. Rename `type_def` to `ts_type_def` to clarify that it's not an instance of `TypeDef` type.
2024-10-19 19:50:11 +00:00
overlookmotel
11458a5bfd
refactor(ast_tools): shorten generated code by avoiding ref in matches ( #6675 )
...
Follow-on after #6404 .
Shorten generated code for deriving `ESTree` by avoiding `ref` in matches.
2024-10-19 19:50:10 +00:00
overlookmotel
002289b4b1
style(ast_tools): do not use ref in matches ( #6674 )
...
Style nit.
2024-10-19 08:57:06 +00:00
overlookmotel
a47b38ff1a
style(ast_tools): fix formatting ( #6673 )
2024-10-19 08:50:05 +00:00
ottomated
e310e52ca2
feat(parser): Generate Serialize impls in ast_tools ( #6404 )
...
Beginning of #6347 . Instead of using serde-derive, we generate
`Serialize` impls manually.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2024-10-19 09:38:44 +01:00
overlookmotel
458f8f3822
refactor(ast_tools): consistent comments on AstBuilder methods ( #6664 )
...
Affects comment style only. Use "Build" consistently, not "Builds" in some places, and correct use of "a" / "an".
2024-10-18 15:57:36 +00:00
Boshen
f4cdc56577
refactor(minifier): use constant folding unary expression from oxc_ecmascript ( #6647 )
2024-10-17 15:30:38 +00:00
magic-akari
1d3d256db3
fix(transformer): Correctly trim JSX ( #6639 )
...
- Closes : #6638
2024-10-17 14:41:02 +00:00
Dunqing
a3dea9c542
feat(transformer/async-to-generator): handle arrow-function correctly ( #6640 )
2024-10-17 08:47:28 +00:00
Dunqing
673b66620b
chore(transform_conformance): do not extend plugins if current options has plugins ( #6627 )
...
I saw many tests were ignored even if they don't contain any unsupported plugins
2024-10-17 02:07:03 +00:00
Boshen
e5ed6a56a8
feat(codegen): print negative numbers ( #6624 )
2024-10-16 22:38:54 +00:00
Dmitry Zakharov
25a49a5700
feat(rulegen): add import to rulegen ( #6631 )
...
Added for fast rule creation
2024-10-16 17:05:40 -04:00
DonIsaac
5213ba7fb4
feat(website/linter): render mapped types in config docs ( #6604 )
...
Render better types for config properties that accept arbitrary keys. For example, `Record<string, boolean>` instead of `object`.
2024-10-15 20:35:45 +00:00
DonIsaac
dcd4607a40
feat(website/linter): render defaults in config docs ( #6603 )
...
Render default values for each section in oxlintrc config docs.
2024-10-15 20:35:45 +00:00
DonIsaac
d4cb7e6f58
fix(website/linter): better md rendering for primitive arrays ( #6602 )
...
Improves how config docs are rendered for the website. If a config property is an array of primitive values, we now skip subsection rendering and render a better type, e.g. `string[]` instead of `array`.
2024-10-15 20:35:45 +00:00
Boshen
389d2615d0
fix(minifier): ~~ operator should only work on numbers ( #6598 )
2024-10-15 16:37:00 +00:00
Boshen
8d9a2da9f3
ci(benchmark): add small test file to linter benchmark ( #6572 )
...
closes #6540
2024-10-15 02:37:22 +00:00
Boshen
435a89c6e4
refactor(oxc): remove useless allocator.alloc(program) calls ( #6571 )
2024-10-15 02:21:20 +00:00
Dunqing
c67acfaae7
chore(transformer): turns off async_to_generator plugin in enable_all ( #6554 )
...
The plugin is not ready to test
2024-10-15 02:08:28 +00:00
Ethan Goh
a9260cf6d1
feat(transformer): async-to-generator plugin. ( #5590 )
...
Tests are still not passed. A lot need to do yet.
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-10-14 17:16:58 +08:00
Tapan Prakash
9f9057b99f
fix(regular_expression): Fixed control Y regular expression ( #6524 )
...
Fixes https://github.com/oxc-project/oxc/issues/6413
Fixed regular expression for control Y
2024-10-14 11:19:37 +08:00
Boshen
591f5dd960
chore(deps): update rust crates ( #6542 )
2024-10-14 03:14:15 +00:00
dalaoshu
97c8a3608f
feat(minifier): implement collapse-variable-declarations ( #6464 )
2024-10-13 23:01:50 +08:00
camc314
14d0590b0b
feat(minifier): implement folding of simple function calls (Boolean) ( #6484 )
...
Basically `Boolean(true)` -> `true` or `Boolean(foo)` -> `!!foo`
2024-10-13 06:26:32 +00:00
camc314
7fbc7b6dae
feat(minifier): implement folding of simple function calls (String) ( #6483 )
...
basically `String(foo)` -> `foo + ''`
2024-10-13 06:26:31 +00:00
DonIsaac
58467a53a1
feat(parser): better handling of invalid modifiers ( #6482 )
...
## What This PR Does
1. Recover on, and provide a better message for, invalid `export` modifier on constructor parameters. Before, an `unexpected token` error would be produced and the parser would panic. Now, the parser recovers and produces a message saying `'export' modifier cannot appear on a parameter.`
```ts
class Foo {
constructor(export x: number) {}
}
```
2. Recover on, and provide a better message for, invalid modifiers on index signatures. Same recovery/message characteristics as above.
```ts
class Foo {
public [x: string]: string;
}
```
2024-10-13 03:16:02 +00:00