Boshen
8f179534c2
fix(coverage): remove some broken cases ( #6797 )
2024-10-23 03:10:49 +00:00
Boshen
9c7ae78c75
fix(coverage): better handling of test262 failling cases ( #6794 )
2024-10-23 02:02:18 +00:00
mysteryven
0acca58581
feat(linter): support --print-config all to print config file for project ( #6579 )
...
Continue work on #4742 .
Only `oxlint --print-config all` is supported. It's useful to migrate from command-line interface to config file.
The `--print-config PATH` looks not really useful for us now, I will add it after config file overrides supported.
2024-10-22 17:56:23 +00:00
Boshen
ffa3945465
chore(coverage): ignore v8 failed cases from runtime.snap ( #6780 )
2024-10-22 16:21:42 +00:00
overlookmotel
d2b8f505f1
refactor(ast_tools): TypeDef::name return a &str ( #6776 )
...
It's generally an anti-pattern for functions to return `&String`. `&str` is preferable.
2024-10-22 12:14:41 +00:00
overlookmotel
09d2df1085
refactor(ast_tools): shorter code in AstKindGenerator ( #6775 )
...
Tiny refactor. Shorten code a little and avoid converting `Ident`s unnecessarily.
2024-10-22 12:14:40 +00:00
overlookmotel
46898654a2
refactor(ast_tools): simplify code in AstKindGenerator ( #6774 )
...
Combine multiple filters into one.
The first 2 filters were doing the same thing, and combining the remaining 2 makes the code easier to read.
2024-10-22 12:14:40 +00:00
overlookmotel
0b6db0e17c
refactor(ast_tools): remove support for #[visit(as)] ( #6773 )
...
#6740 and #6744 removed visitor type aliases (`#[visit(as(ClassHeritage))]`). Remove support for `#[visit(as(...))]` from `oxc_ast_tools`, since it's now dead code.
2024-10-22 12:14:39 +00:00
Cam McHenry
e221ea3fb5
chore(tasks/lint_rules): sync rules with ESLint v9 ( #6777 )
...
The previous version of the `react-perf` ESLint plugin was holding us
back from updating this to ESLint V9. I've manually specified the ESLint
version here, because we want to make sure we are running the latest
major version of ESLint which changes a lot of things.
Also changed it so that rules which are not supported and also
implemented do not get counted twice in the total count. For example,
`eslint/no-with` is marked as not supported but it is still implemented.
This was previously counted for both, which made it look like we had an
additional rule implemented.
2024-10-22 20:14:10 +08:00
Boshen
e15b7ce09c
fix(coverage): tests for --> in the first line should not have raw flag. ( #6772 )
2024-10-22 10:24:27 +00:00
leaysgur
8032813bf8
fix(regular_expression)!: Migrate to new regexp parser API ( #6741 )
...
Follow up #6635
- [x] Remove old APIs
- [x] Update linter usage
- [x] Update parser usage
- [x] Update transformer usage
2024-10-22 05:34:18 +00:00
overlookmotel
10484cdeeb
feat(transformer): class static block transform ( #6733 )
...
Add ES2022 class static block transform.
2024-10-22 03:40:02 +00:00
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