Dunqing
a1afd48c68
fix(transformer/react): incorrect scope_id for var hoisted in fast refresh plugin ( #5695 )
...
Fix the last one semantic error in the fast react plugin
2024-09-11 09:02:29 +00:00
Dunqing
f2f5e5aaf5
fix(transformer/react): missing scope_id for function in fast refresh plugin ( #5693 )
...
Fix semantic error in the fast react plugin
2024-09-11 09:02:28 +00:00
Dunqing
a891c31889
fix(transformer/react): refresh plugin has incorrect reference flags ( #5656 )
...
As you see the diff
2024-09-11 07:57:17 +00:00
Dunqing
ffbc4625b4
chore(transformer): treat all React Refresh tests as ESM syntax ( #5644 )
...
related: #5612
2024-09-11 07:57:17 +00:00
Dunqing
95a6d9984c
feat(transformer): enable the react refresh plugin in enable_all ( #5630 )
2024-09-11 07:57:16 +00:00
Dunqing
3e8b96f165
fix(transformer/react): the refresh plugin cannot handle member expressions with React hooks ( #5655 )
...
The previous implementation doesn't handle nested StaticMemberExpression. For example: `A.B.C.useHook`.
2024-09-11 07:57:16 +00:00
Dunqing
0739b5f1e3
fix(transformer/react): don't transform declaration of function overloads ( #5642 )
...
Found a bug in https://github.com/oxc-project/oxc/actions/runs/10768809028/job/29858692560 ; We don't need to transform typescript-syntax-only function
2024-09-11 07:57:15 +00:00
Dunqing
7b543dffd9
feat(transformer/react): handle refresh_sig and refresh_reg options correctly ( #5638 )
...
In previous implementations, even if pass `import.meta.xxxx` into these options this plugin still treats them as `IdentifierReference`
2024-09-11 07:57:15 +00:00
Dunqing
3bf6aaf06a
fix(transformer/react): support emit_full_signatures option in refresh plugin ( #5629 )
2024-09-11 07:57:14 +00:00
Boshen
b8f8dd6612
fix(minifier/replace_global_defines): do not replace shadowed identifiers ( #5691 )
2024-09-11 07:17:17 +00:00
Dunqing
36d864a0c3
fix(transformer/react): don't transform if the variable does not have a value reference ( #5528 )
...
close : #4746
Solved the last two tests, but it's a coincidence. I've added a test to cover it.
2024-09-11 07:10:55 +00:00
leaysgur
304ce25446
fix(regular_expression): Keep LegacyOctalEscape raw digits for to_string ( #5692 )
...
Fixes #5690
- Update `CharacterKind` enum from `Octal` to `Octal1`, `Octal2` and `Octal3`
- Stylistic refactoring for `impl Display`
2024-09-11 07:07:00 +00:00
DonIsaac
9e9435f03b
refactor(linter): add LintFilter ( #5685 )
...
Re-creation of #5329
2024-09-11 03:19:04 +00:00
overlookmotel
731ffaa00e
refactor(semantic): compare nodes by pointer equality ( #5686 )
...
Follow up after #5673 .
It's safer to compare nodes by pointer equality than by equality of `Span`s. Transformer can create multiple nodes of same type with same span.
Once nodes have node IDs, we can use them for comparison instead.
That said, `ptr::eq` is much cheaper, as it doesn't have to follow the pointers to check equality. https://godbolt.org/z/hsqaeKr5M
2024-09-11 02:12:12 +00:00
Boshen
2016bae98c
feat(coverage): add regular expression idempotency test ( #5676 )
...
closes #5634
2024-09-11 02:07:42 +00:00
Dunqing
b9bf54494f
fix(isolated-declarations): false positive for setter method in interface ( #5681 )
...
close : #5668
2024-09-10 16:22:08 +00:00
Dunqing
6e8409a020
fix(isolated-declarations): bindings referenced in TSModuleDeclaration are removed incorrectly ( #5680 )
...
close : #5667
2024-09-10 16:22:07 +00:00
Boshen
afc4548ef4
perf(ast)!: educe byte size of TaggedTemplateExpression::quasi by Boxing it ( #5679 )
2024-09-10 14:17:29 +00:00
Boshen
7415e85764
perf(ast)!: reduce byte size of TSImportType::attributes by Boxing it ( #5678 )
2024-09-10 14:07:51 +00:00
Boshen
ee4fb42d70
perf(ast)!: reduce size of WithClause by Boxing it ( #5677 )
...
relates #5601
2024-09-10 14:01:36 +00:00
Boshen
f9e3a41dd2
fix(semantic): bind SymbolId to function name in if (foo) function id() {} ( #5673 )
2024-09-10 11:05:26 +00:00
Boshen
067f9b5a6f
refactor(semantic): introduce IsGlobalReference trait ( #5672 )
2024-09-10 10:12:08 +00:00
Boshen
68c3cf544f
feat(minifier): fold void 1 -> void 0 ( #5670 )
2024-09-10 08:11:10 +00:00
leaysgur
2da42efb6f
refactor(regular_expression): Improve AST docs with refactoring may_contain_strings ( #5665 )
...
Follow up #5661
2024-09-10 07:32:28 +00:00
Boshen
c6bbf94f4c
feat(minifier): constant fold unary expression ( #5669 )
2024-09-10 07:18:54 +00:00
Boshen
86256ea238
feat(minifier): constant fold typeof ( #5666 )
...
closes #5628
2024-09-10 04:43:00 +00:00
DonIsaac
4f70fe5abf
refactor(linter): start internal/external split of LintPluginOptions ( #5660 )
...
Re-creation of #5142
2024-09-10 03:19:05 +00:00
DonIsaac
5ae9b48509
refactor(linter): start internal/external split of OxlintOptions ( #5659 )
...
re-creation of #5141
2024-09-10 03:19:04 +00:00
leaysgur
0511d55aa8
fix(regular_expression): Report more MayContainStrings error in (nested)class ( #5661 )
...
Fixes #5632
2024-09-10 01:55:51 +00:00
heygsc
febb29f7f5
perf(formatter): use cow and put cow_ascii on clippy ( #5646 )
...
close : #5639
part of: #5586
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Boshen <boshenc@gmail.com>
2024-09-10 09:38:17 +08:00
overlookmotel
e8013d259e
perf(traverse): faster string operations generating UIDs ( #5626 )
...
`get_unique_name` perform string manipulation faster, avoiding bounds checks, and use `itoa` crate for faster conversion of integers to strings for postfixes above 100.
No apparent difference on benchmarks, but I imagine that's only because it's outweighed by cost of hashing strings. If measured alone, I believe it would be a perf improvement.
2024-09-10 01:12:22 +00:00
overlookmotel
4996874dda
perf(traverse): generate_uid cache available binding names ( #5611 )
...
Close #5488 .
`generate_uid` previously iterated through every symbol and unresolved reference in the AST to find a unique var name. If the first var name it tried was already in use, it'd iterate again.
Instead build a hash map recording existing var names in use for every name which could clash with a UID (any var name starting with `_`). Once built, use that hash map to generate UIDs without iterating through all symbols again.
I had hoped to make `generate_uid` cheaper still by just recording the highest digits postfix for each var name, and then incrementing that postfix for each UID. i.e. if AST contains vars `_foo1` and `_foo6`, create UIDs starting at one number higher - `_foo7`, `_foo8` etc. This method would be more efficient, but unfortunately it does not match Babel, and so causes some of Babel's tests to fail.
2024-09-10 01:12:19 +00:00
Boshen
e698418d1a
feat(napi/transform): align output SourceMap with Rollup's ExistingRawSourceMap ( #5657 )
...
closes #5578
2024-09-09 15:55:23 +00:00
overlookmotel
c8bc6f0549
refactor(linter): use std::ptr::eq ( #5649 )
...
Follow-on after #5577 .
`!std::ptr::eq(x, y)` is more idiomatic than `std::ptr::from_ref(x) != std::ptr::from_ref(y)`.
2024-09-09 15:28:10 +00:00
overlookmotel
19cdcc565c
refactor(traverse): revert changes to walk.rs ( #5652 )
...
Revert the changes to `oxc_traverse` made in #5577 .
Those changes may well have been good, but...
The soundness of `Traverse` is a finely balanced thing, and the pointer gymnastics are subtle, so I think it's best to be extremely conservative about changes. I last ran Miri on it with the original formulation (`as *mut _` etc) and it passed. Currently it's not possible to usefully run Miri on the transformer because it contains known unsound code (#3483 ). So until we're able to check soundness with Miri, I think it's best to avoid changes, as it'd be easy to trigger UB unintentionally.
2024-09-09 14:48:10 +00:00
overlookmotel
2de6ea02c0
refactor(index, traverse): remove unnecessary type annotations ( #5650 )
...
Follow-on after #5577 . These type annotations are not required. Probably they were suggested by clippy.
2024-09-09 14:07:56 +00:00
Boshen
a37c064565
refactor(linter): use ContentHash for no_duplicate_case; remove calculate_hash ( #5648 )
...
closes #5600
2024-09-09 14:01:29 +00:00
dalaoshu
bfe9186611
perf(linter): use cow_replace instead of replace ( #5643 )
...
Related to #5586
2024-09-09 22:00:33 +08:00
overlookmotel
e52d006fc8
style(traverse): fix formatting of traverse codegen ( #5651 )
...
`dprint` rather mangled indentation of these files.
2024-09-09 13:54:00 +00:00
IWANABETHATGUY
e38114b825
fix(ast_tools): fix ast-tool panic ( #5641 )
...
`just ast` panic due to
553262842c ,
change the filename to makesure `ast_tool` still working
1. crates/oxc_span/src/source_type/types.rs is removed in
553262842c
2024-09-09 17:57:20 +08:00
Boshen
508cbeafd5
chore(justfile): add just watch-oxlint
2024-09-09 16:57:51 +08:00
Boshen
6dcaae5cd8
chore(linter): move typescript/no-magic-numbers to eslint/no-magic-numbers ( #5640 )
...
closes #5614
2024-09-09 08:53:52 +00:00
leaysgur
41582ea00c
fix(regular_expression): Improve RegExp to_string() results ( #5635 )
...
Hopefully fixes #5487
- `/^([a-zA-Z]+:)?[\p{L}0-9@/.\-_\\]+$/u`
- e3bc0ddcba/packages/cli-tools/src/launchEditor.ts (L53-L57)
2024-09-09 08:17:55 +00:00
heygsc
e3ae5dbb02
perf(linter): use cow_to_ascii_lowercase/uppercase ( #5637 )
...
part of #5586
In addition, can a similar situation in the
[formatter](https://github.com/oxc-project/oxc/blob/main/crates/oxc_prettier/src/format/mod.rs#L1406-L1409 )
be handled in this way?
2024-09-09 16:13:53 +08:00
DonIsaac
0b3c1d72a3
refactor(linter): start internal/external split of OxlintConfig ( #5595 )
...
Re-creation of #5140
2024-09-09 07:17:51 +00:00
overlookmotel
89bdf5536f
refactor(linter): inline Rule trait default methods ( #5619 )
...
Hopefully compiler is already inlining these trivial/empty methods, but mark them `#[inline]` to make sure.
2024-09-09 07:13:55 +00:00
heygsc
a0370bf506
perf(linter): use cow_utils in no_script_url ( #5633 )
...
part of #5586
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-09 15:06:50 +08:00
DonIsaac
023c1607b0
feat(linter): impl Serialize for OxlintConfig ( #5594 )
...
Re-creation of #5331
2024-09-09 05:13:19 +00:00
leaysgur
28aad281b6
fix(regular_expression): Handle - in /[\-]/u as escaped character ( #5631 )
...
Fixes #5487
2024-09-09 04:14:17 +00:00
DonIsaac
af6d240559
fix(linter): panic in consistent-function-scoping ( #5613 )
...
Closes #5608
2024-09-09 01:21:49 +00:00