Commit graph

4968 commits

Author SHA1 Message Date
overlookmotel
05fff16d55 fix(semantic): transform checker compare binding symbol IDs (#5057) 2024-08-22 02:34:44 +00:00
overlookmotel
f187b71877 fix(semantic): transform checker compare scope children (#5056) 2024-08-22 02:34:44 +00:00
overlookmotel
b52c6a4269 fix(semantic): transform checker compare scope parents (#5055) 2024-08-22 02:34:43 +00:00
overlookmotel
da64014a6c fix(semantic): transform checker catch more scope flags mismatches (#5054)
There was a bug previously where scope flags were only checked if there was also a bindings mismatch.
2024-08-22 02:34:43 +00:00
overlookmotel
7156fd2f91 refactor(semantic): transform checker Pair structure (#5053)
Introduce `Pair` structure containing a pair values from the "after transform" and "rebuilt" semantics, to reduce repetitive code.
2024-08-22 02:34:42 +00:00
overlookmotel
67d1a96391 fix(semantic): transform checker compare scope flags (#5052) 2024-08-22 02:34:41 +00:00
overlookmotel
0ba6f50f00 refactor(semantic): simplify raising errors in transform checker (#5051)
Simplify creating errors in transformer checker.
2024-08-22 02:34:41 +00:00
dalaoshu
f1e46116de
feat(linter/eslint-plugin-vitest): implement no-conditional-in-test (#4971)
Related to #4656
2024-08-22 08:15:32 +08:00
dalaoshu
14bf5d5177
feat(linter/eslint-plugin-vitest): implement no-restricted-vi-methods (#4956)
Related to #4656
2024-08-22 08:07:53 +08:00
Earl Chase
ddf83ff1b9
fix(linter/react): Fixed false positive with missing key inside React.Children.toArray() (#4945)
Closes: #4421 

Added three new functions in order to check if an element is inside of
React.Children.toArray.
Tests added for this fix are exactly the same as those used by
eslint-plugin-react.
2024-08-22 08:05:14 +08:00
overlookmotel
ee7ac8b0b7 refactor(semantic): store all data in PostTransformChecker in transform checker (#5050)
Pure refactor of transform checker. Store all scope data in `PostTransformChecker` so it doesn't need to be passed around. `SemanticData` contains a full set of all semantic data for semantic pass, so we have 2 instances of it for 1. after transform and 2. rebuilt semantic.
2024-08-21 17:04:48 +00:00
overlookmotel
4e1f4abf89 refactor(semantic): add SemanticIds to transformer checker (#5048)
Transformer checker use `SemanticIds` to store collected IDs. `SemanticIds` only contains the IDs, without the `Vec` of errors which is only used temporarily.
2024-08-21 15:49:07 +00:00
overlookmotel
c1da5741f4 refactor(semantic): add comments to transformer checker (#5045)
Just add comments.
2024-08-21 15:22:08 +00:00
overlookmotel
8cded08eb8 refactor(semantic): rename error labels in transformer checker snapshots (#5044)
Rename labels in transformer checker snapshots "after transform" vs "rebuilt".
2024-08-21 14:33:19 +00:00
overlookmotel
602244f440 refactor(semantic): rename vars in transformer checker (#5043)
Pure refactor. Rename vars in transformer checker - "transformer"/"rebuild" instead of "previous"/"current".
2024-08-21 13:47:37 +00:00
IWANABETHATGUY
2b21be31ff feat(oxc_minifier): define plugin with postfix wildcard (#4979)
1. support `import.meta.env.*` in `ReplaceGlobalDefine`
2024-08-21 13:27:09 +00:00
overlookmotel
ae94b9a890 refactor(semantic): remove unused function params in transformer checker (#5042)
Pure refactor, just tidying code.
2024-08-21 13:05:43 +00:00
overlookmotel
863b9cb921 fix(semantic): transform checker handle conditional scopes (#5040)
Some scopes are conditional e.g. `ForStatement` only gets a scope when initializer has a binding (`for (let i = 0; ...)` vs `for (i = 0; ...)`).

Make transform compare this between post-transform and fresh semantics.
2024-08-21 12:07:14 +00:00
overlookmotel
586e15c814 refactor(semantic): reformat transform checker errors (#5039)
Reformat transform checker error output - shorter and consistent capitalization.
2024-08-21 12:07:11 +00:00
overlookmotel
47029c4d45 fix(semantic): transform checker output symbol names in errors (#5038)
Transform checker: For symbol mismatch errors, output symbol names.
2024-08-21 12:07:09 +00:00
overlookmotel
d69e34e983 refactor(semantic): fix indentation (#5037)
Small follow-on after #5035. Not sure why rustfmt didn't correct indentation here.
2024-08-21 09:48:43 +00:00
Boshen
1bd9365bd0 fix(coverage): correctly check semantic data after transform (#5035)
closes #4999
2024-08-21 09:35:04 +00:00
Dunqing
bcc8da96ae refactor(transformer/logical-assignment-operator): use ctx.clone_identifier_reference (#5014)
Use TraverseCtx's built-in `clone_identifier_reference`
2024-08-21 09:19:38 +00:00
Dunqing
3f9433ce3b refactor(transformer/es2021): move all entry points to implementation of Traverse trait (#5013)
follow-up: #4881
2024-08-21 08:04:43 +00:00
overlookmotel
a4247e9353 refactor(allocator): move Box and Vec into separate files (#5034)
Pure refactor. Split `Box` and `Vec` definitions into separate files. Definitions are completely unchanged.
2024-08-21 01:08:08 +00:00
DonIsaac
cd9f1cd278 docs(linter/consistent-function-scoping): improve rule documentation (#5015) 2024-08-21 00:47:17 +00:00
overlookmotel
79c2493223 refactor(website): rename fields in Playground from flag to flags (#5033)
Part of #4991.
2024-08-21 00:19:59 +00:00
overlookmotel
4336a3275c refactor(semantic): rename fields in snapshots from flag to flags (#5032)
Part of #4991.
2024-08-21 00:19:59 +00:00
overlookmotel
83dfb1484e refactor(semantic): rename vars from flag to flags (#5031)
Part of #4991.
2024-08-21 00:19:59 +00:00
overlookmotel
5f4c9ab38e refactor(semantic)!: rename SymbolTable::get_flag to get_flags (#5030)
Part of #4991.
2024-08-21 00:19:58 +00:00
overlookmotel
ca70cc7c03 refactor(linter, mangler, parser, semantic, transformer, traverse, wasm): rename various flag vars to flags (#5028)
Part of #4991.
2024-08-21 00:19:58 +00:00
overlookmotel
3b7de18eb2 refactor(semantic): rename SemanticBuilder::current_reference_flags field (#5027)
Part of #4991.
2024-08-21 00:19:58 +00:00
overlookmotel
0bacdd8102 refactor(semantic): rename Reference::flag field to flags (#5026)
Part of #4991.
2024-08-21 00:19:57 +00:00
overlookmotel
58bf21531e refactor(semantic)!: rename Reference::flag and flag_mut methods to plural (#5025)
Part of #4991.
2024-08-21 00:19:57 +00:00
overlookmotel
c4c08a7433 refactor(ast)!: rename IdentifierReference::reference_flags field (#5024)
Part of #4991.
2024-08-21 00:19:57 +00:00
overlookmotel
d262a58eb5 refactor(syntax)!: rename ReferenceFlag to ReferenceFlags (#5023)
Part of #4991.
2024-08-21 00:19:56 +00:00
DonIsaac
9354779ad4 fix(linter/no-unused-vars): give argsIgnorePattern the same default behavior as varsIgnorePattern (#5018) 2024-08-21 00:15:10 +00:00
DonIsaac
5a55dcf39b fix(linter/no-unused-vars): type specifier not deleted for type imports (#5029)
fixes a bug in eslint/no-unused-vars where, when unused type imports were deleted, the `type` modifier was not.
2024-08-21 00:11:45 +00:00
overlookmotel
c30e2e9cce refactor(semantic)!: Reference::flag method return ReferenceFlag (#5019)
Closes #4992.
2024-08-20 22:02:08 +00:00
camc314
2292606a1f feat(linter): typescript-eslint/no-wrapper-object-types (#5022) 2024-08-20 21:45:38 +00:00
Don Isaac
c43945c808
fix(linter/consistent-function-scoping): allow functions passed as arguments (#5011) 2024-08-20 17:00:50 -04:00
Dunqing
4425b177d4 docs(transformer): add documentation for logical-assignment-operators plugin (#5012)
follow-up #4881
2024-08-20 16:32:37 +00:00
DonIsaac
86d0c0cb62 fix(linter): change consistent-function-scoping to suspicious (#5010) 2024-08-20 16:22:30 +00:00
overlookmotel
896b92f272 refactor(semantic): correct typo in doc comment (#5009)
Correct a typo in doc comment, and capitalize "ID" in couple of places.
2024-08-20 15:27:51 +00:00
Boshen
b4407c4e9a
refactor(oxc,mangler): oxc crate add mangler; mangler use options API 2024-08-20 22:58:59 +08:00
IWANABETHATGUY
0f64d106a0 refactor(minifier): remove duplicated helper move_out_expression (#5007) 2024-08-20 14:00:33 +00:00
overlookmotel
8d15e65a78 refactor(transformer): use into_member_expression (#5006)
Use new `into_member_expression` API introduced in #5005 in TS transforms.
2024-08-20 13:39:26 +00:00
overlookmotel
714373dc5e feat(ast): inherit_variants! macro add into_* methods (#5005)
`inherit_variants!` macro generate `into_*` methods for owned objects. e.g.:

```rs
let expr: Expression = get_expr();
match expr {
  match_member_expression!(Expression) => {
    let member_expr: MemberExpression = expr.into_member_expression();
  },
  _ => {},
}
```
2024-08-20 12:11:54 +00:00
overlookmotel
7f3129efd1 fix(ast): correct code comment (#5004)
Comment showing macro expansion did not match the actual macro output.
2024-08-20 11:56:29 +00:00
IWANABETHATGUY
b7db235065
fix: comments gen regression (#5003)
try to fix: https://github.com/rolldown/rolldown/issues/2013
1. Before we only considering the ast is untouched, but considering the
scenario.
```js

const a = /*__PURE__*/ test(),
//    ^^^              ^^^^^^ is removed during transform
	b = a();

```
Then according to the previous algorithm, `PURE` will attach to `b =
a()`
2. Now, we try to attach comments as much as possible unless the
comments are separated by comments, for the case above, `PURE` will not
be attached to `a()` since the content between `b = a()` and `/*
__PURE__*/` is not all whitespace.
3. we added back `MoveMap`, for the special case 
```js
/*__NODE_SIDE_EFFECTS__*/ export const c = 100;
// ^^^^^^^^^^^^^^^^^^^^^         should be attached to first declarator,
//                        ^^^^^^ are not whitespace

```
2024-08-20 18:57:12 +08:00