Yuji Sugiura
0ce7ce7ff4
refactor(prettier): Revive doc macro ( #7639 )
...
As @Boshen advised, reintroduced the macro.
https://github.com/oxc-project/oxc/pull/7639/files#diff-18e08d6e3a6853a2ae1a973ab1615ee04ed585638eef92c8c1e49f7814f6193f
It feels addictive...! 🤩
2024-12-04 16:58:00 +08:00
Boshen
e787e9d41a
fix(codegen): print parentheses correctly for ClassHeritage ( #7637 )
...
closes #7631
2024-12-04 06:43:32 +00:00
Boshen
d2767bea62
feat(semantic): syntax error for delete object?.#a ( #7636 )
...
closes #7603
2024-12-04 05:33:05 +00:00
Boshen
1486849ec2
fix(semantic): syntax error for undeclared private field access ( #7635 )
...
closes #7582
2024-12-04 05:33:04 +00:00
camc314
a14e76aade
feat(linter): report identical logical expressions in const-comparisons ( #7630 )
2024-12-04 03:10:17 +00:00
camc314
afe1e9b929
feat(linter): enhance const-comparisons for more cases ( #7628 )
2024-12-04 02:59:56 +00:00
camc314
b445654fbd
refactor(linter): use get_inner_expression in const-comparisons ( #7627 )
2024-12-04 02:59:55 +00:00
overlookmotel
3b1e63ecab
perf(transformer/jsx): no string comparisons generating pragma expression ( #7620 )
...
#7553 introduced support for some unusual JSX pragmas e.g. `this.foo` and `import.meta.foo`. We want to support these to pass tests, but they're very unlikely to be used in practice.
Identify these strange patterns when parsing the pragma (which happens only once per file), and encode them as an enum. The removes expensive string comparisons from `Pragma::create_expression` (which is called for every JSX element), and keeps the path for common cases fast.
2024-12-04 02:47:28 +00:00
overlookmotel
8ad52be359
refactor(transformer/jsx): Pragma::parse take a &str ( #7619 )
...
`Pragma::parse` take an `Option<&str>` instead of `Option<&String>`. Passing `&String`s to functions is an odd pattern.
2024-12-04 02:47:27 +00:00
overlookmotel
2158c3851b
test(transformer/jsx): move tests setup into a macro ( #7618 )
...
Follow up after #7553 . Move tests setup for JSX pragmas into a macro to prevent tests having access to an owned `TraverseCtx`, for safety.
2024-12-04 02:47:26 +00:00
camc314
fcc2546f9f
fix(linter): move no-unused-expressions from TS to eslint ( #7624 )
2024-12-04 02:26:47 +00:00
Alexander S.
29db060c78
fix(linter): detect typescript eslint alias rules ( #7622 )
...
closes #7233
2024-12-04 10:16:00 +08:00
Boshen
771c698a81
feat(oxc): remove oxc_napi crate ( #7634 )
...
napi has a limitation, it cannot feature gate type exposure.
closes #7623
2024-12-04 10:07:32 +08:00
camc314
e824501a21
fix(linter): false positive in exhaustive-deps ( #7626 )
2024-12-04 01:58:25 +00:00
camc314
8a68ef4c3b
fix(linter): update reporting spans for exhaustive-deps ( #7625 )
2024-12-04 01:58:23 +00:00
camc314
543df6e3a8
fix(linter): fix false positives in exhaustive-deps ( #7615 )
...
part of https://github.com/oxc-project/oxc/issues/7246
2024-12-03 23:54:22 +00:00
Boshen
b4f3812c4a
refactor(oxc_napi): remove source_map - moved to its crate ( #7614 )
2024-12-03 14:42:34 +00:00
Boshen
4eb87eadbf
feat(linter): RulesOfHooks from nursery to correctness ( #7607 )
2024-12-03 14:15:43 +00:00
Boshen
bd977cf742
feat(oxc): add oxc_napi crate ( #7612 )
2024-12-03 14:02:47 +00:00
IWANABETHATGUY
6af8659624
fix(oxc_transformer): correct generate ThisExpr and import.meta in jsx pragma ( #7553 )
2024-12-03 13:54:15 +00:00
camc314
6dd71c6d05
test(linter): port eslint tests to no-unused-expressions ( #7611 )
2024-12-03 13:15:49 +00:00
overlookmotel
eb825edee2
fix(transformer/class-properties): replace references to class name with temp var in static prop initializers ( #7610 )
...
Similar to #7516 . Fix class properties transform to replace references to class name in static prop initializers with temp var.
Input:
```js
class C {
static getSelf = () => C;
}
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Output:
```js
var _C;
class C {}
_C = C;
_defineProperty(C, "getSelf", () => _C);
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Previously, temp var wasn't used so code was `_defineProperty(C, "getSelf", () => C);`. `C` is altered later by `C = 123`, so `C2.getSelf()` returned `123`, instead of reference to the class.
2024-12-03 12:43:21 +00:00
overlookmotel
7d1c12e5e2
refactor(transformer/class-properties): rename misleadingly-named method ( #7609 )
...
This method replaces `this` with class temp var, not reference to class name. Name the method accordingly, and update comments.
2024-12-03 12:43:21 +00:00
overlookmotel
206de912dc
feat(semantic): add SymbolTable::add_resolved_reference method ( #7608 )
...
Add `SymbolTable::add_resolved_reference` method to add a reference for a symbol.
2024-12-03 12:43:20 +00:00
camc314
e80214c74f
fix(linter): fix false positives in rules-of-hooks ( #7606 )
...
closes https://github.com/oxc-project/oxc/issues/7572
should remove all false positives from this rule
2024-12-03 12:19:00 +00:00
Boshen
40792b4440
feat(napi/parser): change parse API to accept mandatory filename and optional lang ( #7605 )
2024-12-03 12:09:48 +00:00
Boshen
348d4f451a
feat(sourcemap): move oxc_sourcemap to github.com/oxc-project/oxc-sourcemap ( #7604 )
...
It's mostly stable so we can v1.0.0 it.
And we will create cyclic dependency with StringWizard soon.
2024-12-03 11:59:43 +00:00
Boshen
7c62a33a06
feat(napi/parser): return esm info ( #7602 )
...
The parser now returns import / export statement information, which can be used for parser plugins.
2024-12-03 11:21:54 +00:00
Yuji Sugiura
521df425de
refactor(prettier): Unified method of Doc generation ( #7600 )
...
Before:
- `Doc::Xxx()` + `XXX.with_xxx()`
- `macro!()`
- `p.xxx()`
After:
- `p.xxx()` with `p_vec!` macro
2024-12-03 17:27:55 +08:00
翠 / green
58643529d1
feat(napi/transform): add TransformerOptions::assumptions ( #7601 )
...
so that I can use `setPublicClassFields` for #6735 when it's ready.
2024-12-03 17:25:18 +08:00
overlookmotel
802233d151
refactor(transformer/class-properties): remove pointless method ( #7592 )
...
#7516 removed the need for a special method to handle `export default class {}`. Delete it.
2024-12-03 07:46:05 +00:00
overlookmotel
0eadd9f6de
fix(transformer/class-properties): create temp var for class where required ( #7516 )
...
Fix class properties transform to create a temp var for class when it's required.
Input:
```js
class C {
static getSelf = () => this;
}
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Output:
```js
var _C;
class C {}
_C = C;
_defineProperty(C, "getSelf", () => _C);
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Previously, temp var wasn't used so code was `_defineProperty(C, "getSelf", () => C);`. `C` is altered later by `C = 123`, so `C2.getSelf()` returned `123`, instead of reference to the class.
The logic around when a temp var is required and when it's not, and when/where it's referenced is ridiculously complicated. So add some debug assert mechanisms to double-check the logic.
2024-12-03 07:46:04 +00:00
overlookmotel
a07f278dfd
refactor(transformer/class-properties): PrivatePropsStack type ( #7589 )
...
Pure refactor. Move all logic and types related to storing details of what private properties classes have into a separate file `private_props.rs`. Introduce a type `PrivatePropsStack` to represent the stack of classes.
2024-12-03 07:46:03 +00:00
overlookmotel
370d4b9176
docs(transformer/class-properties): add missing docs ( #7588 )
...
Docs only. Add mention of what `static_prop.rs` does to the main doc comment for the transform.
2024-12-03 07:46:02 +00:00
overlookmotel
7bd6350978
refactor(transformer/class-properties): move creating temp var out of main loop ( #7587 )
...
Small optimization. Move code out of the loop which determines if class property transform has nothing to do and can bail out early. This also clears the way for correcting the logic around when temp vars are/aren't created in #7516 .
2024-12-03 07:46:01 +00:00
overlookmotel
ebd11fb5e9
refactor(transformer/class-properties): exit transform_class faster if nothing to do ( #7586 )
...
Small optimization. Class properties transform doesn't have to do anything if the class has no properties, which will often be the case. Exit sooner in this case.
2024-12-03 07:46:00 +00:00
overlookmotel
dccff38afe
refactor(transformer/class-properties): ResolvedPrivateProp type ( #7532 )
...
Pure refactor. `lookup_private_property` returns a tuple of 3 items, and future changes will make that 4. That's silly. Create a type `ResolvedPrivateProp` for it to return, so the various parts can have descriptive names.
2024-12-03 07:45:59 +00:00
overlookmotel
367b6c8053
refactor(transformer/class-properties): shortcut_static_class take SymbolId ( #7531 )
...
Pure refactor. `shortcut_static_class` method take `SymbolId` of class name, instead of the `&BoundIdentifier`. This change is in preparation for later PRs fixing class properties transform.
2024-12-03 07:45:58 +00:00
overlookmotel
ab1214d33c
refactor(transformer/class-properties): rename class_binding ( #7533 )
...
Pure refactor. Just rename a variable. `class_binding` is preferable, since this binding isn't always for the class *name*.
2024-12-03 07:45:57 +00:00
翠 / green
71b3437a4c
test(oxc_transformer): define works differently with esbuild ( #7593 )
...
See https://github.com/oxc-project/oxc/issues/7594
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-03 15:23:40 +08:00
Boshen
943462f22c
feat(module_lexer)!: remove oxc_module_lexer ( #7595 )
...
This crate will no longer be relevant after we export esm information
directly from the parser.
Besides, `ex-module-lexer`'s output data is too limited for plugin
authors to use.
2024-12-03 04:22:51 +00:00
overlookmotel
b553d6ff9c
fix(span): fix clippy warning ( #7591 )
...
Fix clippy warning. Only triggers when running clippy in `--release` mode.
2024-12-03 02:18:57 +00:00
Cameron
3dc46a80c9
fix(linter): no-unused-expressions false positive with arrow fn expressions ( #7585 )
...
fixes https://github.com/oxc-project/oxc/issues/7584
2024-12-03 09:48:50 +08:00
Alexander S.
810671a4a0
fix(linter): detect vitest jest alias rules ( #7567 )
...
closes #7240
2024-12-03 09:46:05 +08:00
Boshen
33e5a49c78
feat(syntax): add statement span to ImportEntry and ExportEntry ( #7583 )
2024-12-02 14:20:30 +00:00
IWANABETHATGUY
a784a82f4f
feat(oxc_transformer): support jsx pragma that are long member expressions ( #7538 )
...
related tests:
d34e79e2a9/internal/bundler_tests/bundler_default_test.go (L6188-L6236)
2024-12-02 14:02:38 +00:00
Boshen
f0e7acc68b
refactor(syntax): change ModuleRecord::not_esm to has_module_syntax ( #7579 )
2024-12-02 09:32:57 +00:00
Boshen
18519dea33
refactor(syntax): remove ModuleRecord::export_default ( #7578 )
...
This value can be derived.
2024-12-02 09:17:57 +00:00
Boshen
d476660b0b
refactor(syntax): remove ModuleRecord::exported_bindings_duplicated because it is a syntax error ( #7577 )
2024-12-02 08:48:01 +00:00
Boshen
17663f55d3
refactor(syntax): remove ModuleRecord::export_default_duplicated because it is a syntax error ( #7576 )
2024-12-02 08:19:59 +00:00
camc314
275d6256bb
feat(linter): output rules to json array ( #7574 )
...
closes #7517
cc @Sysix
2024-12-02 03:17:57 +00:00
camc314
4e3044e225
fix(linter): rules-of-hooks fix false positive with default export ( #7570 )
...
closes #7555
2024-12-02 03:09:30 +00:00
camc314
cb1f8e6e03
chore(linter): update rules_of_hooks test cases ( #7569 )
...
updates test cases based on what's currently in react's repo
2024-12-02 03:09:30 +00:00
overlookmotel
e62153bdd7
chore(deps): remove memoffset dependency ( #7573 )
...
`offset_of!` macro [became stable in Rust 1.77.0](https://doc.rust-lang.org/nightly/core/mem/macro.offset_of.html ) which is now within our MSRV. Remove the `memoffset` crate, and use `std::mem::offset_of` instead.
2024-12-01 23:39:27 +00:00
Boshen
79014ffb1d
refactor(syntax): clean up ModuleRecord ( #7568 )
2024-12-01 14:49:04 +00:00
oxc-bot
c61a383e8c
release(oxlint): v0.14.0 ( #7563 )
...
## [0.14.0] - 2024-12-01
### Features
- 32f860d linter: Add support for ignorePatterns property within config
file (#7092 ) (Nicholas Rayburn)
- 053bc08 linter: Implement typescript/no-unused-expressions (#7498 )
(camc314)
- 60b28fc linter: Implement typescript/consistent-generic-constructors
(#7497 ) (camc314)
- bd0693b linter: Allow lint rules with the same name (#7496 ) (camc314)
- 2ac9f96 linter: Typescript/no-inferrable-types (#7438 ) (camc314)
- 8d89fdc linter: Add eslint/prefer-spread (#7112 ) (tbashiyy)
### Bug Fixes
- 123b5b7 linter: False positive in
`typescript/consistent-type-definitions` (#7560 ) (dalaoshu)
- cc078d6 linter: Add missing error message prefix to
`eslint/no-const-assign` (Boshen)
- 17c0dd8 linter: Fix `jsx_no_script_url` doc failed to build (Boshen)
### Performance
- 6cc7a48 linter: Use `OsString` for module cache hash (#7558 ) (Boshen)
- 6655345 linter: Use `FxDashMap` for module cache (#7522 )
(overlookmotel)
### Documentation
- a6b0100 linter: Fix config example headings (#7562 ) (Boshen)
### Refactor
- 0f3f67a linter: Add capability of adding semantic data to module
record (#7561 ) (Boshen)
- 8392177 linter: Clean up the runtime after the module record change
(#7557 ) (Boshen)
- 823353a linter: Clean up APIs for `ModuleRecord` (#7556 ) (Boshen)
- f847d0f linter: Call `str::ends_with` with array not slice (#7526 )
(overlookmotel)
- 2077ff9 linter: Remove `once_cell` (#7510 ) (Boshen)
- 169b8bf linter, syntax: Introduce type alias `FxDashMap` (#7520 )
(overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-01 16:47:21 +08:00
Boshen
a6b0100501
docs(linter): fix config example headings ( #7562 )
...
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-01 16:31:22 +08:00
Boshen
0f3f67a05a
refactor(linter): add capability of adding semantic data to module record ( #7561 )
...
closes #5814
closes #5816
2024-12-01 08:14:43 +00:00
dalaoshu
123b5b7f38
fix(linter): false positive in typescript/consistent-type-definitions ( #7560 )
...
closes #7552
2024-12-01 16:03:29 +08:00
Boshen
6cc7a48b52
perf(linter): use OsString for module cache hash ( #7558 )
2024-12-01 05:47:40 +00:00
Boshen
839217770c
refactor(linter): clean up the runtime after the module record change ( #7557 )
2024-12-01 05:32:41 +00:00
Boshen
823353a6fc
refactor(linter): clean up APIs for ModuleRecord ( #7556 )
2024-12-01 04:48:42 +00:00
Boshen
c2ced15dfd
feat(parser,linter)!: use a different ModuleRecord for linter ( #7554 )
...
The parser returns a simple `ModuleRecord` that is allocated in the arena for performance reasons.
The linter uses a more complicated, `Send` + `Sync` `ModuleRecord` that will hold more cross-module information.
The next step is to return more esm information from the parser to eliminated the need of the `oxc_module_lexer` crate.
2024-11-30 16:02:01 +00:00
Boshen
0be5233c84
refactor(semantic)!: remove ModuleRecord from Semantic ( #7548 )
...
`ModuleRecord` will eventually be moved to be linter specific thing for cross module data sharing, which means we can add more data to it.
2024-11-29 16:30:54 +00:00
Boshen
8a788b8f4b
feat(parser)!: Build ModuleRecord directly in parser ( #7546 )
...
This has the benefit of:
* expose dynamic import / import meta info from parser
* 1 less ast shallow in semantic builder
* no ast walk in oxc's module lexer
* some more benefits coming soon
2024-11-29 14:50:42 +00:00
Boshen
b24beeb0f5
refactor(parser): use PropName trait from oxc_ecmascript ( #7543 )
2024-11-29 09:18:47 +00:00
Boshen
9d6e14bb67
test(ecmascript): move tests to oxc_minifier due to cyclic dependency with oxc_parser ( #7542 )
2024-11-29 09:18:45 +00:00
Boshen
63a66cfff3
refactor(minifier): remove unused ast pass from DCE ( #7540 )
2024-11-29 08:10:07 +00:00
renovate
d0842e070a
chore(deps): update dependency rust to v1.83.0 ( #7537 )
...
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust ) | minor | `1.82.0` -> `1.83.0` |
---
### Release Notes
<details>
<summary>rust-lang/rust (rust)</summary>
### [`v1.83.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1830-2024-11-28 )
[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.82.0...1.83.0 )
\==========================
<a id="1.83.0-Language"></a>
## Language
- [Stabilize `&mut`, `*mut`, `&Cell`, and `*const Cell` in const.](https://redirect.github.com/rust-lang/rust/pull/129195 )
- [Allow creating references to statics in `const` initializers.](https://redirect.github.com/rust-lang/rust/pull/129759 )
- [Implement raw lifetimes and labels (`'r#ident`).](https://redirect.github.com/rust-lang/rust/pull/126452 )
- [Define behavior when atomic and non-atomic reads race.](https://redirect.github.com/rust-lang/rust/pull/128778 )
- [Non-exhaustive structs may now be empty.](https://redirect.github.com/rust-lang/rust/pull/128934 )
- [Disallow implicit coercions from places of type `!`](https://redirect.github.com/rust-lang/rust/pull/129392 )
- [`const extern` functions can now be defined for other calling conventions.](https://redirect.github.com/rust-lang/rust/pull/129753 )
- [Stabilize `expr_2021` macro fragment specifier in all editions.](https://redirect.github.com/rust-lang/rust/pull/129972 )
- [The `non_local_definitions` lint now fires on less code and warns by default.](https://redirect.github.com/rust-lang/rust/pull/127117 )
<a id="1.83.0-Compiler"></a>
## Compiler
- [Deprecate unsound `-Csoft-float` flag.](https://redirect.github.com/rust-lang/rust/pull/129897 )
- Add many new tier 3 targets:
- [`aarch64_unknown_nto_qnx700`](https://redirect.github.com/rust-lang/rust/pull/127897 )
- [`arm64e-apple-tvos`](https://redirect.github.com/rust-lang/rust/pull/130614 )
- [`armv7-rtems-eabihf`](https://redirect.github.com/rust-lang/rust/pull/127021 )
- [`loongarch64-unknown-linux-ohos`](https://redirect.github.com/rust-lang/rust/pull/130750 )
- [`riscv32-wrs-vxworks` and `riscv64-wrs-vxworks`](https://redirect.github.com/rust-lang/rust/pull/130549 )
- [`riscv32{e|em|emc}-unknown-none-elf`](https://redirect.github.com/rust-lang/rust/pull/130555 )
- [`x86_64-unknown-hurd-gnu`](https://redirect.github.com/rust-lang/rust/pull/128345 )
- [`x86_64-unknown-trusty`](https://redirect.github.com/rust-lang/rust/pull/130453 )
Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.
<a id="1.83.0-Libraries"></a>
## Libraries
- [Implement `PartialEq` for `ExitCode`.](https://redirect.github.com/rust-lang/rust/pull/127633 )
- [Document that `catch_unwind` can deal with foreign exceptions without UB, although the exact behavior is unspecified.](https://redirect.github.com/rust-lang/rust/pull/128321 )
- [Implement `Default` for `HashMap`/`HashSet` iterators that don't already have it.](https://redirect.github.com/rust-lang/rust/pull/128711 )
- [Bump Unicode to version 16.0.0.](https://redirect.github.com/rust-lang/rust/pull/130183 )
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://redirect.github.com/rust-lang/rust/pull/130229 ).
<a id="1.83.0-Stabilized-APIs"></a>
## Stabilized APIs
- [`BufRead::skip_until`](https://doc.rust-lang.org/stable/std/io/trait.BufRead.html#method.skip_until )
- [`ControlFlow::break_value`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.break_value )
- [`ControlFlow::continue_value`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.continue_value )
- [`ControlFlow::map_break`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.map_break )
- [`ControlFlow::map_continue`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.map_continue )
- [`DebugList::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugList.html#method.finish_non_exhaustive )
- [`DebugMap::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugMap.html#method.finish_non_exhaustive )
- [`DebugSet::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugSet.html#method.finish_non_exhaustive )
- [`DebugTuple::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugTuple.html#method.finish_non_exhaustive )
- [`ErrorKind::ArgumentListTooLong`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ArgumentListTooLong )
- [`ErrorKind::Deadlock`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.Deadlock )
- [`ErrorKind::DirectoryNotEmpty`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.DirectoryNotEmpty )
- [`ErrorKind::ExecutableFileBusy`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ExecutableFileBusy )
- [`ErrorKind::FileTooLarge`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.FileTooLarge )
- [`ErrorKind::HostUnreachable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.HostUnreachable )
- [`ErrorKind::IsADirectory`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.IsADirectory )
- [`ErrorKind::NetworkDown`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NetworkDown )
- [`ErrorKind::NetworkUnreachable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NetworkUnreachable )
- [`ErrorKind::NotADirectory`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotADirectory )
- [`ErrorKind::NotSeekable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotSeekable )
- [`ErrorKind::ReadOnlyFilesystem`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ReadOnlyFilesystem )
- [`ErrorKind::ResourceBusy`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ResourceBusy )
- [`ErrorKind::StaleNetworkFileHandle`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.StaleNetworkFileHandle )
- [`ErrorKind::StorageFull`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.StorageFull )
- [`ErrorKind::TooManyLinks`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.TooManyLinks )
- [`Option::get_or_insert_default`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.get_or_insert_default )
- [`Waker::data`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.data )
- [`Waker::new`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.new )
- [`Waker::vtable`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.vtable )
- [`char::MIN`](https://doc.rust-lang.org/stable/core/primitive.char.html#associatedconstant.MIN )
- [`hash_map::Entry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/hash_map/enum.Entry.html#method.insert_entry )
- [`hash_map::VacantEntry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/hash_map/struct.VacantEntry.html#method.insert_entry )
These APIs are now stable in const contexts:
- [`Cell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.Cell.html#method.into_inner )
- [`Duration::as_secs_f32`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.as_secs_f32 )
- [`Duration::as_secs_f64`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.as_secs_f64 )
- [`Duration::div_duration_f32`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.div_duration_f32 )
- [`Duration::div_duration_f64`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.div_duration_f64 )
- [`MaybeUninit::as_mut_ptr`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.as_mut_ptr )
- [`NonNull::as_mut`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_mut )
- [`NonNull::copy_from`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_from )
- [`NonNull::copy_from_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_from_nonoverlapping )
- [`NonNull::copy_to`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_to )
- [`NonNull::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_to_nonoverlapping )
- [`NonNull::slice_from_raw_parts`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.slice_from_raw_parts )
- [`NonNull::write`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write )
- [`NonNull::write_bytes`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write_bytes )
- [`NonNull::write_unaligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write_unaligned )
- [`OnceCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.OnceCell.html#method.into_inner )
- [`Option::as_mut`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut )
- [`Option::expect`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.expect )
- [`Option::replace`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.replace )
- [`Option::take`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.take )
- [`Option::unwrap`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.unwrap )
- [`Option::unwrap_unchecked`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.unwrap_unchecked )
- [`Option::<&_>::copied`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.copied )
- [`Option::<&mut _>::copied`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.copied-1 )
- [`Option::<Option<_>>::flatten`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.flatten )
- [`Option::<Result<_, _>>::transpose`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.transpose )
- [`RefCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.RefCell.html#method.into_inner )
- [`Result::as_mut`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.as_mut )
- [`Result::<&_, _>::copied`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.copied )
- [`Result::<&mut _, _>::copied`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.copied-1 )
- [`Result::<Option<_>, _>::transpose`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.transpose )
- [`UnsafeCell::get_mut`](https://doc.rust-lang.org/stable/core/cell/struct.UnsafeCell.html#method.get_mut )
- [`UnsafeCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.UnsafeCell.html#method.into_inner )
- [`array::from_mut`](https://doc.rust-lang.org/stable/core/array/fn.from_mut.html )
- [`char::encode_utf8`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.encode_utf8 )
- [`{float}::classify`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.classify )
- [`{float}::is_finite`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_finite )
- [`{float}::is_infinite`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_infinite )
- [`{float}::is_nan`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_nan )
- [`{float}::is_normal`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_normal )
- [`{float}::is_sign_negative`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_sign_negative )
- [`{float}::is_sign_positive`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_sign_positive )
- [`{float}::is_subnormal`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_subnormal )
- [`{float}::from_bits`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_bits )
- [`{float}::from_be_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_be_bytes )
- [`{float}::from_le_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_le_bytes )
- [`{float}::from_ne_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_ne_bytes )
- [`{float}::to_bits`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_bits )
- [`{float}::to_be_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_be_bytes )
- [`{float}::to_le_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_le_bytes )
- [`{float}::to_ne_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_ne_bytes )
- [`mem::replace`](https://doc.rust-lang.org/stable/core/mem/fn.replace.html )
- [`ptr::replace`](https://doc.rust-lang.org/stable/core/ptr/fn.replace.html )
- [`ptr::slice_from_raw_parts_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.slice_from_raw_parts_mut.html )
- [`ptr::write`](https://doc.rust-lang.org/stable/core/ptr/fn.write.html )
- [`ptr::write_unaligned`](https://doc.rust-lang.org/stable/core/ptr/fn.write_unaligned.html )
- [`<*const _>::copy_to`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to )
- [`<*const _>::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to_nonoverlapping )
- [`<*mut _>::copy_from`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_from )
- [`<*mut _>::copy_from_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_from_nonoverlapping )
- [`<*mut _>::copy_to`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to-1 )
- [`<*mut _>::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to_nonoverlapping-1 )
- [`<*mut _>::write`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write )
- [`<*mut _>::write_bytes`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write_bytes )
- [`<*mut _>::write_unaligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write_unaligned )
- [`slice::from_mut`](https://doc.rust-lang.org/stable/core/slice/fn.from_mut.html )
- [`slice::from_raw_parts_mut`](https://doc.rust-lang.org/stable/core/slice/fn.from_raw_parts_mut.html )
- [`<[_]>::first_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_mut )
- [`<[_]>::last_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_mut )
- [`<[_]>::first_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_chunk_mut )
- [`<[_]>::last_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_chunk_mut )
- [`<[_]>::split_at_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut )
- [`<[_]>::split_at_mut_checked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_checked )
- [`<[_]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked )
- [`<[_]>::split_first_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_mut )
- [`<[_]>::split_last_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_mut )
- [`<[_]>::split_first_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_chunk_mut )
- [`<[_]>::split_last_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_chunk_mut )
- [`str::as_bytes_mut`](https://doc.rust-lang.org/stable/core/primitive.str.html#method.as_bytes_mut )
- [`str::as_mut_ptr`](https://doc.rust-lang.org/stable/core/primitive.str.html#method.as_mut_ptr )
- [`str::from_utf8_unchecked_mut`](https://doc.rust-lang.org/stable/core/str/fn.from_utf8\_unchecked_mut.html )
<a id="1.83.0-Cargo"></a>
## Cargo
- [Introduced a new `CARGO_MANIFEST_PATH` environment variable, similar to `CARGO_MANIFEST_DIR` but pointing directly to the manifest file.](https://redirect.github.com/rust-lang/cargo/pull/14404/ )
- [Added `package.autolib` to the manifest, allowing `[lib]` auto-discovery to be disabled.](https://redirect.github.com/rust-lang/cargo/pull/14591/ )
- [Declare support level for each crate in Cargo's Charter / crate docs.](https://redirect.github.com/rust-lang/cargo/pull/14600/ )
- [Declare new Intentional Artifacts as 'small' changes.](https://redirect.github.com/rust-lang/cargo/pull/14599/ )
<a id="1.83-Rustdoc"></a>
## Rustdoc
- [The sidebar / hamburger menu table of contents now includes the `# headers` from the main item's doc comment](https://redirect.github.com/rust-lang/rust/pull/120736 ). This is similar to a third-party feature provided by the rustdoc-search-enhancements browser extension.
<a id="1.83.0-Compatibility-Notes"></a>
## Compatibility Notes
- [Warn against function pointers using unsupported ABI strings.](https://redirect.github.com/rust-lang/rust/pull/128784 )
- [Check well-formedness of the source type's signature in fn pointer casts.](https://redirect.github.com/rust-lang/rust/pull/129021 ) This partly closes a soundness hole that comes when casting a function item to function pointer
- [Use equality instead of subtyping when resolving type dependent paths.](https://redirect.github.com/rust-lang/rust/pull/129073 )
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass `MACOSX_DEPLOYMENT_TARGET` or fix your `#[link]` attributes to point to the correct frameworks. See [#​129369](https://redirect.github.com/rust-lang/rust/pull/129369 ).
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previous did not have any effect.](https://redirect.github.com/rust-lang/rust/pull/129422 )
- The future incompatibility lint `deprecated_cfg_attr_crate_type_name` [has been made into a hard error](https://redirect.github.com/rust-lang/rust/pull/129670 ). It was used to deny usage of `#![crate_type]` and `#![crate_name]` attributes in `#![cfg_attr]`, which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion.
Users can use `--crate-type` instead of `#![cfg_attr(..., crate_type = "...")]` and `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]` when running `rustc`/`cargo rustc` on the command line.
Use of those two attributes outside of `#![cfg_attr]` continue to be fully supported.
- Until now, paths into the sysroot were always prefixed with `/rustc/$hash` in diagnostics, codegen, backtrace, e.g.
thread 'main' panicked at 'hello world', map-panic.rs:2:50
stack backtrace:
0: std::panicking::begin_panic
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:616:12
1: map_panic::main::{{closure}}
at ./map-panic.rs:2:50
2: core::option::Option<T>::map
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29
3: map_panic::main
at ./map-panic.rs:2:30
4: core::ops::function::FnOnce::call_once
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[RFC 3127 said](https://rust-lang.github.io/rfcs/3127-trim-paths.html#changing-handling-of-sysroot-path-in-rustc )
> We want to change this behaviour such that, when `rust-src` source files can be discovered, the virtual path is discarded and therefore the local path will be embedded, unless there is a `--remap-path-prefix` that causes this local path to be remapped in the usual way.
[#​129687](https://redirect.github.com/rust-lang/rust/pull/129687 ) implements this behaviour, when `rust-src` is present at compile time, `rustc` replaces `/rustc/$hash` with a real path into the local `rust-src` component with best effort.
To sanitize this, users must explicitly supply `--remap-path-prefix=<path to rust-src>=foo` or not have the `rust-src` component installed.
- The allow-by-default `missing_docs` lint used to disable itself when invoked through `rustc --test`/`cargo test`, resulting in `#[expect(missing_docs)]` emitting false positives due to the expectation being wrongly unfulfilled. This behavior [has now been removed](https://redirect.github.com/rust-lang/rust/pull/130025 ), which allows `#[expect(missing_docs)]` to be fulfilled in all scenarios, but will also report new `missing_docs` diagnostics for publicly reachable `#[cfg(test)]` items, [integration test](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#integration-tests ) crate-level documentation, and publicly reachable items in integration tests.
- [The `armv8r-none-eabihf` target now uses the Armv8-R required set of floating-point features.](https://redirect.github.com/rust-lang/rust/pull/130295 )
- [Fix a soundness bug where rustc wouldn't detect unconstrained higher-ranked lifetimes in a `dyn Trait`'s associated types that occur due to supertraits.](https://redirect.github.com/rust-lang/rust/pull/130367 )
- [Update the minimum external LLVM version to 18.](https://redirect.github.com/rust-lang/rust/pull/130487 )
- [Remove `aarch64-fuchsia` and `x86_64-fuchsia` target aliases in favor of `aarch64-unknown-fuchsia` and `x86_64-unknown-fuchsia` respectively.](https://redirect.github.com/rust-lang/rust/pull/130657 )
- [The ABI-level exception class of a Rust panic is now encoded with native-endian bytes, so it is legible in hex dumps.](https://redirect.github.com/rust-lang/rust/pull/130897 )
- [Visual Studio 2013 is no longer supported for MSVC targets.](https://redirect.github.com/rust-lang/rust/pull/131070 )
- [The sysroot no longer contains the `std` dynamic library in its top-level `lib/` dir.](https://redirect.github.com/rust-lang/rust/pull/131188 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2024-11-29 07:25:36 +00:00
Boshen
62a8c5eb59
chore(minifier): temporary remove try_fold_if_block_one and try_fold_if_one_child ( #7536 )
...
They are not idempotent.
2024-11-29 05:05:07 +00:00
Boshen
d942a8d41a
chore: Rust v1.83.0 changes ( #7535 )
...
This PR does not upgrade rustc. Only changes are applied.
We cannot upgrade to the lastet Rust version yet due to wasm-bindgen
breaking some generated types.
THere's also some elided lifetimes in `**/generated/**`, which requires
modification to ast tools.
2024-11-29 11:59:45 +08:00
overlookmotel
defaf4bf2b
feat(data_structures): add SparseStack::last_mut method ( #7528 )
...
Add `SparseStack::last_mut` method, as companion to `SparseStack::last`.
2024-11-28 16:39:34 +00:00
overlookmotel
d5aaee732e
refactor(transformer/class-properties): remove defunct comments ( #7527 )
...
These comments are out of date / repeated elsewhere.
2024-11-28 16:30:46 +00:00
overlookmotel
6655345bb9
perf(linter): use FxDashMap for module cache ( #7522 )
...
Same as #7521 . Use `FxDashMap` instead of plain `DashMap` for module cache.
2024-11-28 12:32:43 +00:00
overlookmotel
4a98230f07
perf(syntax): use FxDashMap for exported bindings ( #7525 )
...
Same as #7521 . Use `FxDashMap` instead of plain `DashMap` for hash map storing exported bindings.
2024-11-28 12:15:11 +00:00
overlookmotel
f847d0f161
refactor(linter): call str::ends_with with array not slice ( #7526 )
...
Arrays are more performant than slices where it's possible to use them. Caught by newly enabled lint rule in Rust 1.82.0 in #6649 .
2024-11-28 12:08:13 +00:00
overlookmotel
d21448bf65
refactor(semantic, transformer): simplify FxIndexMap type aliases ( #7524 )
...
Pure refactor. Simplify `FxIndexMap` type aliases by using `rustc_hash`'s `FxBuildHasher`, instead of longhand `BuildHasherDefault<FxHasher>`.
2024-11-28 12:01:17 +00:00
overlookmotel
55f3636ecf
perf(language_server): use FxDashMap for diagnostics reports map ( #7523 )
...
Same as #7521 . Use `FxDashMap` instead of plain `DashMap` for hash map storing diagnostics.
2024-11-28 11:52:13 +00:00
overlookmotel
169b8bfa5c
refactor(linter, syntax): introduce type alias FxDashMap ( #7520 )
...
Pure refactor. Introduce a type alias `FxDashMap<K, V>` for `DashMap<K, V, FxBuildHasher>`. This makes the code using it clearer.
2024-11-28 11:45:14 +00:00
overlookmotel
7ebe8c20e8
perf(transformer): use FxDashMap for browser query cache ( #7521 )
...
Use `FxDashMap` instead of plain `DashMap` for browser query cache.
Inspired by https://github.com/rolldown/rolldown/pull/2971 .
2024-11-28 11:39:14 +00:00
Boshen
896ff860f9
fix(minifier): do not fold if statement block with lexical declaration ( #7519 )
2024-11-28 10:37:41 +00:00
Boshen
625a5bad02
refactor(minifier): improve ast passes ( #7518 )
2024-11-28 09:33:31 +00:00
Nicholas Rayburn
32f860d238
feat(linter): Add support for ignorePatterns property within config file ( #7092 )
...
This could probably use some tests, but I'm not really sure what exactly
should be tested.
Will leave a review with a few comments on things that might need a
different approach.
Closes #7032 .
2024-11-28 17:32:44 +08:00
Boshen
cc078d6e77
fix(linter): add missing error message prefix to eslint/no-const-assign
2024-11-28 15:31:03 +08:00
Boshen
f955ba2fae
feat(wasm): add transformer target API ( #7513 )
2024-11-28 03:45:59 +00:00
IWANABETHATGUY
a23ce152af
feat(oxc_transformer): replace_global_define for assignmentTarget ( #7505 )
...
related esbuild test:
d34e79e2a9/internal/bundler_tests/bundler_default_test.go (L5430-L5497)
2024-11-28 10:33:44 +08:00
overlookmotel
4d157c583b
docs(traverse): document soundness hole ( #7515 )
...
Document the remaining (small) soundness hole in `Traverse`.
2024-11-28 10:30:53 +08:00
overlookmotel
f2f31a8d7a
fix(traverse)!: remove unsound APIs ( #7514 )
...
It's essential to `oxc_traverse`'s safety scheme that the user cannot create a `TraverseAncestry`, because they could then substitute it for the one stored in `TraverseCtx`, and cause a buffer underrun when an ancestor gets popped off stack which should never be empty - but it is because user has sneakily swapped it for another one.
Not being able to create a `TraverseAncestry` also requires that user cannot obtain an owned `TraverseCtx` either, because you can obtain an owned `TraverseAncestry` from an owned `TraverseCtx`.
Therefore, it's unsound for `TraverseCtx::new` to be public.
However, it is useful in minifier to be able to re-use the same `TraverseCtx` over and over, which requires having an owned `TraverseCtx`.
To support this use case, introduce `ReusableTraverseCtx`. It is an opaque wrapper around `TraverseCtx`, which prevents accessing the `TraverseCtx` inside it. It's safe for user to own a `ReusableTraverseCtx`, because there's nothing they can do with it except for using it to traverse via `traverse_mut_with_ctx`, which ensures the safety invariants are upheld.
At some point, we'll hopefully be able to reduce the number of passes in the minifier, and so remove the need for `ReusableTraverseCtx`.But in the meantime, this keeps `Traverse`'s API safe from unsound abuse.
Note: Strictly speaking, there is still room to abuse the API and produce UB by initiating a 2nd traversal of a different AST in an `Traverse` visitor, and then `mem::swap` the 2 x `&mut TraverseCtx`s. But this is a completely bizarre thing to do, and would basically require you to write malicious code specifically designed to cause UB, so it's not a real risk in practice. We'd need branded lifetimes to close that hole too.
So this PR doesn't 100% ensure safety in a formal sense, but it at least makes it very hard to trigger UB *by accident*, which was the risk before.
2024-11-28 10:30:53 +08:00
Nicholas Rayburn
99ecc687ba
feat(language_server): Add code actions to disable rules for the current line or entire file ( #6968 )
...
This definitely needs some cleanup by somebody more familiar with Rust,
but I think it contains most of the important pieces. I'll leave a
review with the different pieces that I know need cleanup.
Ref #6966 .
2024-11-28 10:30:53 +08:00
Boshen
2077ff9269
refactor(linter): remove once_cell ( #7510 )
2024-11-28 10:30:52 +08:00
Dunqing
3539f56cac
feat(transformer/class-properties): support for transforming TaggedTemplateExpresssion ( #7504 )
...
```js
"object.#prop`xyz`" -> "_classPrivateFieldGet(_prop, object).bind(object)`xyz`"
"object.obj.#prop`xyz`" -> "_classPrivateFieldGet(_prop, _object$obj = object.obj).bind(_object$obj)`xyz`"
```
2024-11-27 12:15:31 +00:00
Dunqing
968863bef3
refactor(transformer/class-properties): move transform logic of callee of CallExpression to transform_private_field_callee ( #7503 )
...
This transform logic is also can be used to `tag` of `TaggedTemplateExpression`, so let's move it to a separate function.
2024-11-27 12:08:10 +00:00
overlookmotel
5261547c25
refactor(transformer/class-properties): remove a branch from transform_call_expression_impl ( #7507 )
...
Small optimization. `transform_call_expression_impl` does not require the `Expression::CallExpression`, only the `CallExpression` itself. So pass that into the function, instead of having to unwrap it (which is an unnecessary branch).
2024-11-27 11:24:10 +00:00
overlookmotel
1c4b29c100
refactor(transformer/class-properties): correct comments ( #7506 )
...
Correct comments. I did too much mindless copy-and-paste.
2024-11-27 11:11:39 +00:00
camc314
053bc081fb
feat(linter): implement typescript/no-unused-expressions ( #7498 )
2024-11-27 10:28:41 +00:00
camc314
60b28fc23a
feat(linter): implement typescript/consistent-generic-constructors ( #7497 )
2024-11-27 09:21:08 +00:00
camc314
bd0693bcd0
feat(linter): allow lint rules with the same name ( #7496 )
...
Apologies @Boshen for the stupidly large diff.
I've done the following:
- `RuleEnum`'s members are now prefixed with the plugin name. e.g. `NoDebugger` has become `EslintNoDebugger`
- updated tester.rs to accept the rule's NAME, CATEGORY to allow us to test rules with the same name (diff category)
- updates `declare_all_lint_rules` satisfy the first above change.
2024-11-27 04:25:05 +00:00
Dunqing
fed8327441
test(semantic): add a test for UpdateExpression ( #7495 )
...
related: https://github.com/oxc-project/oxc/pull/7388#issuecomment-2496044394
2024-11-27 02:00:52 +00:00
Dunqing
4b0720aabb
test(semantic): re-organize snapshot-based tests ( #7494 )
...
Reorignize tests by splitting tests to js, ts, and jsx folders
2024-11-27 02:00:50 +00:00
Dunqing
ef62b9dacc
refactor(transformer/react-refresh): use generate_uid_in_current_hoist_scope to add hoisted binding ( #7492 )
2024-11-26 16:12:11 +00:00