oxc-bot
8ef85a43c0
Release oxlint v0.8.0 ( #5104 )
...
## [0.8.0] - 2024-08-23
- 5f4c9ab semantic: [**BREAKING**] Rename `SymbolTable::get_flag` to
`get_flags` (#5030 ) (overlookmotel)
- ce4d469 codegen: [**BREAKING**] Remove const generic `MINIFY` (#5001 )
(Boshen)
- b2ff2df parser: [**BREAKING**] Remove builder pattern from `Parser`
struct (#5000 ) (Boshen)
- f88970b ast: [**BREAKING**] Change order of fields in CallExpression
(#4859 ) (Burlin)
### Features
- 2292606 linter: Typescript-eslint/no-wrapper-object-types (#5022 )
(camc314)
- a0effab linter: Support more flexible config.globals values (#4990 )
(Don Isaac)
- cdbfcfb linter: Start import fixer for eslint/no-unused-vars (#4849 )
(DonIsaac)
- 915cb4d linter: Add dangerous fixer for oxc only used in recursion
(#4805 ) (camc314)
- 3f28c77 linter/eslint: Improve no-dupe-keys (#4943 ) (DonIsaac)
- e1582a5 linter/eslint: Improve no-duplicate-case rule (#4942 )
(DonIsaac)
- f1e4611 linter/eslint-plugin-vitest: Implement no-conditional-in-test
(#4971 ) (dalaoshu)
- 14bf5d5 linter/eslint-plugin-vitest: Implement
no-restricted-vi-methods (#4956 ) (dalaoshu)
- ed9a1c4 linter/eslint-plugin-vitest: Implement
require-local-test-context-for-concurrent-snapshots (#4951 ) (dalaoshu)
- 7859f58 linter/eslint-plugin-vitest: Implement no-conditional-tests
(#4955 ) (dalaoshu)
- 841174f linter/no-unused-vars: Delete non-root arrows, skip `await`
(#5083 ) (Don Isaac)
### Bug Fixes
- 86d0c0c linter: Change consistent-function-scoping to suspicious
(#5010 ) (DonIsaac)
- 7b99386 linter: Missing closing ticks in some example blocks (#4994 )
(DonIsaac)
- 9c64b12 linter: Improve no-zero-fractions rule for member expressions
and scientific notation (#4793 ) (Burlin)
- c43945c linter/consistent-function-scoping: Allow functions passed as
arguments (#5011 ) (Don Isaac)
- 9354779 linter/no-unused-vars: Give `argsIgnorePattern` the same
default behavior as `varsIgnorePattern` (#5018 ) (DonIsaac)
- 5a55dcf linter/no-unused-vars: `type` specifier not deleted for type
imports (#5029 ) (DonIsaac)
- 4081293 linter/no-unused-vars: Panic in fixer when removing
destructures (#4923 ) (Don Isaac)
- ddf83ff linter/react: Fixed false positive with missing key inside
React.Children.toArray() (#4945 ) (Earl Chase)
- 508644a linter/tree-shaking: Correct the calculation of `>>`, `<<` and
`>>>` (#4932 ) (mysteryven)
- e99836d linter/unicorn: Allow set spreading in no-useless-spread
(#4944 ) (Don Isaac)
- 5f8a7c2 oxlint: Rules in the configuration file are not being
correctly … (#4949 ) (dalaoshu)
### Documentation
- e331ca0 linter: Improve documentation for several rules (#4997 )
(DonIsaac)
- cd9f1cd linter/consistent-function-scoping: Improve rule documentation
(#5015 ) (DonIsaac)
### Refactor
- eca6fdb linter: Move plugin options into separate struct (#5100 )
(DonIsaac)
- 06f2d81 linter: Avoid unnecessary temp `Vec`s (#4963 ) (overlookmotel)
- 4cb8c37 linter: Move default_true to utils (#4947 ) (Don Isaac)
- ca70cc7 linter, mangler, parser, semantic, transformer, traverse,
wasm: Rename various `flag` vars to `flags` (#5028 ) (overlookmotel)
- 59d15c7 semantic: `root_unresolved_references` contain only
`ReferenceId` (#4959 ) (overlookmotel)
### Testing
- c21d735 linter/no-unused-vars: Add ignored destructuring test cases
(#4922 ) (Don Isaac)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-23 11:09:14 +08:00
heygsc
ad2be97078
fix(semantic): incorrect semantic check for label has same name ( #5041 )
...
fix : #5036
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-08-23 10:36:12 +08:00
overlookmotel
d5de97d6fe
fix(semantic): transform checker check reference flags ( #5092 )
2024-08-23 00:21:21 +00:00
DonIsaac
eca6fdbffe
refactor(linter): move plugin options into separate struct ( #5100 )
...
Part of #5046
2024-08-23 00:01:21 +00:00
overlookmotel
9da6a21e40
refactor(semantic): rename transform checker output for reference symbol mismatches ( #5091 )
2024-08-22 23:40:27 +00:00
overlookmotel
90c74ee449
fix(semantic): transform checker check reference symbol IDs ( #5090 )
...
Previously was checking that references point to symbols with same name, but not necessarily the same symbol (there could be 2 different symbols with same name).
2024-08-22 23:40:26 +00:00
overlookmotel
a8005b9914
fix(semantic): transform checker check symbol redeclarations ( #5089 )
2024-08-22 23:40:26 +00:00
overlookmotel
205bff7ea9
fix(semantic): transform checker check symbol references ( #5088 )
2024-08-22 23:40:25 +00:00
overlookmotel
fb46eafab6
refactor(semantic): add remap functions to transform checker ( #5082 )
...
Move remapping into separate functions.
2024-08-22 23:40:24 +00:00
Dean Srebnik
d5bfecce3b
fix(README): rename runtime to engine ( #5099 )
...
Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-08-23 07:38:42 +08:00
Dunqing
c60a50d2f3
refactor(transformer/exponentiation-operator): use built-in ctx.clone_identifier_reference ( #5086 )
2024-08-22 21:21:36 +00:00
Dunqing
a9fcf292fe
refactor(transformer/es2016): move all entry points to implementation of Traverse trait ( #5085 )
...
follow-up #4881
2024-08-22 21:02:32 +00:00
Dunqing
178d1bd986
docs(transformer): add documentation for exponentiation-operator plugin ( #5084 )
...
follow-up #4881
2024-08-22 20:45:41 +00:00
Boshen
4b49cf8ce4
feat(transformer): always pass in symbols and scopes ( #5087 )
...
We no longer need to build semantic data inside the transformer.
The caller should be responsible for handling semantic data and its
errors.
The best way to achieve this in via `CompilerInterface`.
closes #3565
2024-08-22 16:06:31 +00:00
Don Isaac
841174f73c
feat(linter/no-unused-vars): delete non-root arrows, skip await ( #5083 )
...
This PR updates no-unused-var's fixer for `VariableDeclarator`s in two
ways:
1. Unused function expressions and arrow functions not declared in the
top scope
will now be removed.
```ts
// not deleted, no change
const x = function() {}
const y = (a) => a
function z() {}
// new behavior
function foo() { // <- not deleted
const x = () => {} // <- deleted
const y = function() {} // <- this too
}
```
2. Variables initialized to an `await` expression will not be deleted.
```ts
// unused await-initialized variables are often API calls with side
effects
// in the real world; we don't want to delete these.
const res = await createUser(data)
```
2024-08-22 11:48:27 -04:00
Boshen
2a5e15d03e
fix(npm): libc field should not be null
...
closes #4952
2024-08-22 23:29:22 +08:00
overlookmotel
a00bf18b9f
refactor(semantic): add IdMapping to transform checker ( #5079 )
...
`IdMapping<Id>` wraps `FxHashMap<Id, Id>` for ease in dealing with ID types which are `Copy`.
2024-08-22 15:08:49 +00:00
overlookmotel
4a57086d79
fix(semantic): transform checker check symbol IDs ( #5078 )
2024-08-22 15:08:48 +00:00
overlookmotel
ea7d2163e3
fix(semantic): transform checker check symbol spans ( #5076 )
2024-08-22 15:08:47 +00:00
overlookmotel
b14a302ed0
refactor(semantic): transform checker: change symbol name mismatch error ( #5075 )
2024-08-22 15:08:46 +00:00
overlookmotel
1b6b27a6de
fix(semantic): transform checker check symbol flags ( #5074 )
2024-08-22 15:08:45 +00:00
Boshen
78f135d686
refactor(ast)!: remove ReferenceFlag from IdentifierReference ( #5077 )
...
closes #4512
2024-08-22 14:30:50 +00:00
overlookmotel
b8c6ce5317
refactor(semantic): rename vars in transform checker ( #5072 )
...
Pure refactor. Just rename some vars for consistency.
2024-08-22 13:41:35 +00:00
Boshen
6d87b0f1f2
fix(semantic): fix error message for duplicated label ( #5071 )
2024-08-22 12:30:04 +00:00
Boshen
efbdced597
fix(parser): only show flow error if it's a flow file ( #5069 )
...
Otherwise we get a mixture of confusing error messages.
2024-08-22 12:19:45 +00:00
leaysgur
96f57984eb
refactor(regular_expression): Misc refactoring for body_parser ( #5062 )
...
- Add examples to list all `RegExp`s in source code
- Refactor `MayContainStrings` related part
2024-08-22 11:21:41 +00:00
Dunqing
3b353321ad
fix(transformer/logical-assignment-operators): fix semantic errors ( #5047 )
...
Fix semantic error caused by `clone_in` causing `reference_id` to not exist.
In this PR, I try to use `move_expression` as much as possible instead of `expr.clone_in`. But in some cases, we need to reuse the same expression in multiple places. I have added a `clone_expression` to workaround it
I felt a bit painful we missing a [clone_in_scope](https://github.com/oxc-project/oxc/issues/4804 ) API
2024-08-22 08:41:31 +00:00
Dunqing
deda6ac136
refactor(transformer/es2019): move all entry points to implementation of Traverse trait ( #5065 )
...
follow-up #4881
2024-08-22 08:34:44 +00:00
Dunqing
d50eb72399
docs(transformer): add documentation for optional-catch-binding plugin ( #5064 )
...
follow-up #4881
2024-08-22 08:34:42 +00:00
overlookmotel
f73d486d25
refactor: correct typos and standardize capitalization in Cargo.toml ( #5063 )
...
Nitty. Purely alters comments in `Cargo.toml`.
2024-08-22 07:42:55 +00:00
overlookmotel
f2b8d82499
refactor(semantic)!: ScopeTree::get_child_ids + get_child_ids_mut return value not Option ( #5058 )
...
Previously `ScopeTree::get_child_ids` and `ScopeTree::get_child_ids_mut` returned an `Option`. Instead return the unwrapped value, in line with other methods e.g. `get_flags`.
2024-08-22 05:57:55 +00:00
Boshen
afe728a73a
feat(parser): parse regular expression with regex parser ( #4998 )
...
Many false positives and incorrect errors. @leaysgur Enjoy 😁
Run `just conformance` to update the snapshot.
2024-08-22 03:09:55 +00:00
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