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
overlookmotel
f3850eb53b
fix(semantic): correctly resolve binding for return type of functions ( #6388 )
...
Fixes #6387 .
2024-11-26 15:43:35 +00:00
Boshen
b0e1c03284
feat(ast)!: add StringLiteral::raw field ( #7393 )
...
part of #7254
2024-11-26 23:33:56 +08:00
7086cmd
97af341cac
feat(minifier): minify alternated one child if block ( #7231 )
2024-11-26 15:00:16 +00:00
camc314
2ac9f963df
feat(linter): typescript/no-inferrable-types ( #7438 )
2024-11-26 14:49:31 +00:00
Ethan Goh
ac0d25c426
feat(minifier): minify one child if statement expression ( #7230 )
2024-11-26 22:48:27 +08:00
Boshen
c133693e5c
perf(minifier): fuse ast passes ( #7493 )
2024-11-26 14:30:04 +00:00
Dunqing
58a125ff88
fix(transformer/async-to-generator): correct the SymbolFlags of function id in module ( #7470 )
2024-11-26 11:59:22 +00:00
Dunqing
37842c166d
fix(transformer/object-rest-spread): generate catch variable binding with correct SymbolFlags ( #7469 )
2024-11-26 11:59:21 +00:00
overlookmotel
199076bd14
fix(transformer/class-properties): transform private property accesses in static prop initializers ( #7483 )
...
Transform private property accesses in static prop initializers. e.g.:
Input:
```js
class C {
static #x = 123;
static y = this.#x;
}
```
Transformed:
```js
class C {}
var _x = { _: 123 };
babelHelpers.defineProperty(C, "y", babelHelpers.assertClassBrand(C, C, _x)._);
```
`this.#x` has been transformed to `babelHelpers.assertClassBrand(C, C, _x)._`.
2024-11-26 11:36:09 +00:00
overlookmotel
5ca6eea77e
perf(transformer/class-properties): inline visitor methods ( #7485 )
...
Inline visitor methods in class properties transform.
2024-11-26 11:36:09 +00:00
7086cmd
24189f28ad
feat(ecma): implement array join method ( #6936 )
2024-11-26 11:28:07 +00:00
Dunqing
9c9deaeffe
feat(traverse): add generate_uid_in_current_hoist_scope method ( #7423 )
...
Add an API to handle variable hoisting.
2024-11-26 11:21:36 +00:00
leaysgur
3a1ef6a230
refactor(prettier): Refactor IR related macros ( #7491 )
...
- Remove `format!` macro
- Rename string related macros, `&'static`: `text!` and `'a`: `dynamic_text!`
- Apply `wrap!` macro instead of manually using `enter|leave_node`
- Introduce `/ir` directory and move `Doc`, `impl Display`, `DocBuilder`, etc.
I'm not yet determined how to, how deep to use macro, but this is first stepping stone... 🥌
2024-11-26 09:31:30 +00:00
tbashiyy
8d89fdc886
feat(linter): add eslint/prefer-spread ( #7112 )
...
In this PR,
- move existing `unicorn:prefer-spread` to `eslint:prefer-spread`.
- combine 2 rules from `eslint:prefer-spread` and
`unicorn:prefer-spread`
([This is already talked in
discord](https://discord.com/channels/1079625926024900739/1080712072012238858/1299981398064496652 ))
---------
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-26 17:30:38 +08:00
Boshen
17c0dd8fb2
fix(linter): fix jsx_no_script_url doc failed to build
...
"Element is missing end tag."
2024-11-26 16:03:14 +08:00
oxc-bot
861ae1581a
release(oxlint): v0.13.2 ( #7489 )
2024-11-26 15:25:31 +08:00
oxc-bot
00a7372eaf
release(crates): v0.38.0 ( #7490 )
2024-11-26 14:38:47 +08:00
Boshen
45ef3eb2be
chore(transformer): disable class properties transform from the target API ( #7487 )
2024-11-26 06:10:35 +00:00
Boshen
713e210012
chore(transformor): disable class properties transform ( #7486 )
...
The plugin is not ready.
2024-11-26 03:47:46 +00:00
Alexander S.
571d7e2419
fix(language_server): calculate correct column when Unicode chars ( #7484 )
...
Before:

After:

Closes #3625
2024-11-26 10:44:13 +08:00
Guillaume Piedigrossi
87c893fb49
feat(linter): add the eslint/no_duplicate_imports rule ( #7309 )
2024-11-25 20:56:29 +00:00
overlookmotel
e5d49db360
refactor(transformer/class-properties): placeholder method for transforming private field assignment patterns ( #7482 )
...
Add a no-op placeholder method for transforming private fields as `AssignmentPattern`s. e.g. `[object.#prop] = []`.
Implementation will be added later.
2024-11-25 20:10:07 +00:00
overlookmotel
97de0b7be1
fix(transformer/class-properties): transform this in static prop initializers ( #7481 )
...
Convert `this` in static property initializers to reference to class name.
`class C { static prop = this; }` -> `class C {}; C.prop = C;`
2024-11-25 20:10:05 +00:00
overlookmotel
d2745df3bc
fix(transformer/class-properties): stop searching for super() in TSModuleBlocks ( #7480 )
...
Fix edge case in class static properties transform. When transforming `super()` in class constructor, stop searching when hit a `TSModuleBlock`. `TSModuleBlock` is essentially a function, so `super()` there is invalid.
2024-11-25 20:10:03 +00:00
overlookmotel
2a5954ae71
docs(transformer/class-properties): document transform options ( #7478 )
...
Add docs for the `loose` option / `set_public_class_fields` assumption.
2024-11-25 17:17:28 +00:00
overlookmotel
abb0e0e08e
refactor(transformer/class-properties): rename var ( #7477 )
...
Pure refactor. Name var more descriptively.
2024-11-25 16:45:21 +00:00
overlookmotel
25823c8529
refactor(transformer/class-properties): safer use of GetAddress ( #7474 )
...
Avoid using `Address::from_ptr`, which is error-prone.
2024-11-25 14:25:27 +00:00
overlookmotel
3396b69379
refactor(transformer/exponentiation-operator): correct comment ( #7476 )
...
Follow-on after #7410 . Update comment to reflect the changed logic.
2024-11-25 14:16:22 +00:00
overlookmotel
10ea830651
style(traverse): fix indentation in codegen ( #7475 )
2024-11-25 13:19:19 +00:00
overlookmotel
eb70219821
feat(ast): derive GetAddress on all enum types ( #7472 )
...
Implement `GetAddress` on all AST enums where all variants are boxed. Part of #7339 .
2024-11-25 12:13:44 +00:00
Dunqing
d7d073578d
refactor(semantic): remove SymbolFlags::TypeLiteral ( #7415 )
2024-11-25 11:34:34 +00:00
jordan boyer
79ab8cca0e
feat(lint-unicorn): add rule prefer set has ( #7075 )
...
implementing the rule [prefer set
has](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md )
from unicorn.
I put the fix as dangerous fix because they was no test for the fix on
the unicorn part. I did add some test for this but i'm not sure that i'm
covering everything.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-25 19:33:51 +08:00
Jelle van der Waa
7236d14dc8
feat(eslint/jsx_a11y): implement anchor_ambiguous_text ( #5729 )
...
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-25 11:07:36 +00:00
overlookmotel
111d722fe1
style(transformer/optional-chaining): code style nit ( #7468 )
2024-11-25 10:51:42 +00:00
Dunqing
e26916ceae
perf(transformer/optional-chaining): mark enter_expression as inline ( #7390 )
2024-11-25 18:31:35 +08:00
overlookmotel
9778298fdb
feat(transformer): class properties transform ( #7011 )
...
Add class properties transform.
Implementation is incomplete. Notable missing parts:
* Scopes are not updated where property initializers move from class body into class constructor / `_super` function.
* Does not handle binding shadowing problems when property initializers move from class body into class constructor.
* `this` and references to class name in static property initializers need to be transformed to point to a temp var.
* Not all usages of private properties are supported (see below).
* Code which is moved to outside of class body is not transformed by other transforms for class declarations (works OK for class expressions). This includes static property initializers, static blocks, and computed property/method keys.
* Only basic checks for whether computed property/method keys may have side effects.
* Numerous other small issues noted in TODO comments through the code.
### Private properties
Currently does not handle the following usages of private properties:
```js
class Class {
#prop;
static #static;
method() {
object?.#prop;
object?.#prop();
[object.#prop] = [1];
({x: object.#prop} = {x: 1});
object.#prop`xyz`;
object?.#static;
object?.#static();
[object.#static] = [1];
({x: object.#static} = {x: 1});
object.#static`xyz`;
}
}
```
2024-11-25 10:24:20 +00:00
Boshen
3169bc61d1
ci: clean up wasm type check ( #7466 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-25 17:56:17 +08:00
Brian Liu
0b9da38a9e
feat(linter): implement unicorn/prefer-negative-index ( #6920 )
...
[unicorn/prefer-negative-index](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v56.0.0/docs/rules/prefer-negative-index.md )
---------
Co-authored-by: Brian Liu <brian@redflagsdating.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-25 09:25:15 +00:00
Radu Baston
f0643c4484
feat(linter): implement jsx-no-script-url ( #6995 )
...
https://github.com/oxc-project/oxc/issues/1022
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-25 16:49:27 +08:00
Boshen
5d65656517
refactor(oxc_index)!: move to own repo github.com/oxc-project/oxc-index-vec ( #7464 )
...
closes #7454
2024-11-25 08:36:44 +00:00
dalaoshu
db6558f33c
fix(linter): false positive in eslint/prefer-object-has-own ( #7463 )
...
closes #7450
2024-11-25 16:32:48 +08:00
Alexander S.
a3ecbde369
fix(language_server): do not tell clients about codeActionProvider when they do not support codeActionLiteralSupport ( #7445 )
...
VSCode output:
```
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
```
See also eslint implementation
b33437b5ad/server/src/eslintServer.ts (L221-L225)
2024-11-25 14:30:02 +08:00
Alexander S.
25d9ed9b10
fix(language_server): revalidate files when configPath has changed ( #7447 )
...
closes #7446

---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-25 14:29:26 +08:00
Dunqing
88ddce4fa6
chore(isolated-declarations): remove outdated panic comment ( #7462 )
2024-11-25 05:28:09 +00:00
Dunqing
0ff94fa620
refactor(isolated-declarations): use CloneIn instead of ast.copy ( #7459 )
2024-11-25 04:56:17 +00:00
IWANABETHATGUY
e9f9e8242a
feat(oxc_transformer): replace_global_define ThisExpression ( #7443 )
...
Test from d34e79e2a9/internal/bundler_tests/bundler_default_test.go (L5195-L5260) ,
esbuild snapshot:
d34e79e2a9/internal/bundler_tests/snapshots/snapshots_default.txt (L1081-L1108)
2024-11-25 04:13:52 +00:00
IWANABETHATGUY
87978499a3
feat(oxc_transformer): replace_global_define destructuring assignment optimization ( #7449 )
...
1. Closed #7382
Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
2024-11-24 23:24:32 +08:00
Hiroshi Ogawa
d5df615264
fix(oxc_codegen): don't emit empty span mapping ( #7448 )
2024-11-24 17:04:52 +08:00
Alexander S.
84fcc43cf5
docs(language_server): add readme ( #7429 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-24 12:31:23 +08:00
Naoya Yoshizawa
00060ca0f1
feat(linter): Implement eslint/no-object-constructor ( #7345 )
...
A test case for `new Object()` has been commented out:
This is due to the test configuration specifying `globals: { Object:
"off" }`.
This approach follows the example set by the no_new_wrappers rule.
[Reference
Code](bf839c1dfa/crates/oxc_linter/src/rules/eslint/no_new_wrappers.rs (L88) )
---------
Co-authored-by: no-yan <63000297+no-yan@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-23 19:17:51 +00:00
Boshen
59e7e4674f
feat(napi/transform): add TransformOptions::target API ( #7426 )
2024-11-23 15:46:33 +00:00
oxc-bot
88d17b96e3
release(oxlint): v0.13.1 ( #7441 )
...
## [0.13.1] - 2024-11-23
### Features
- 4ad26b9 linter: Add `no-promise-in-callback` (#7307 ) (no-yan)
- 9558087 oxlint: Auto detect config file in CLI (#7348 ) (Alexander S.)
### Bug Fixes
- 8507464 linter: Hanging when source has syntax/is flow (#7432 )
(Cameron)
- e88cf1b linter: Make `overrides` globs relative to config path (#7407 )
(camchenry)
- 9002e97 linter: Add proper support for findIndex and findLastIndex for
`unicorn/prefer-array-some` (#7405 ) (Dmitry Zakharov)
### Documentation
- 6730e3e linter: Add more examples for `unicorn/prefer-array-some`
(#7411 ) (Dmitry Zakharov)
### Refactor
- 6c0d31b linter: Remove useless `const` declaration (#7430 ) (Song Gao)
- c8adc46 linter/no-unused-vars: Improve implementation to remove using
SymbolFlags::Export (#7412 ) (Dunqing)
- c90537f linter/only-used-in-recursion: Improve implementation to
remove using SymbolFlags::Export (#7413 ) (Dunqing)
### Testing
- 779f479 editor: Check if workspace configuration is updated (#7403 )
(Alexander S.)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-23 23:46:16 +08:00
IWANABETHATGUY
4bb1dca673
feat(oxc_transformer): ReplaceGlobalDefines for ChainExpr ( #7433 )
2024-11-23 15:21:30 +00:00
Cameron
8507464d5a
fix(linter): hanging when source has syntax/is flow ( #7432 )
...
Closes #7406
See
https://github.com/oxc-project/oxc/issues/7406#issuecomment-2494981152
for why this is happening
not sure whether there's a better solve for this/
2024-11-23 23:20:19 +08:00
Cameron
c6d790b287
fix(language-server): fix panic by building scope tree child ids ( #7440 )
...
closes #7434
i couldn't test this. but what's happening is semaitc is being build
without scope child ids. When exhaustive_deps tries to access it its an
empty vec - hence the panic
2024-11-23 23:19:11 +08:00
dalaoshu
d8c093126d
feat(oxc_transformer): use better diagnostic message for ReplaceGlobalDefinesPlugin ( #7439 )
...
When I was handling plugin-related diagnostics in `rolldown`, I
encountered this issue.
If there is a define key like `a.6.b`, the error message states that
<code>\`a.6.b\` is not an identifier</code>. However, it should actually
be that <code>\`6\` is not an identifier</code>.
2024-11-23 23:18:36 +08:00
overlookmotel
63f4d6c24a
docs(ast_tools): reformat docs for #[ast] proc macro ( #7437 )
2024-11-23 14:26:53 +00:00
overlookmotel
bc0e8bc721
docs(ast_tools): update and reformat docs for #[ast] proc macro ( #7436 )
...
Docs for `#[ast]` macro were out of date.
2024-11-23 14:09:07 +00:00
overlookmotel
cf0b3bcf1c
refactor(ast_tools): remove tsify helper attr from Ast derive macro ( #7435 )
...
We no longer use this attr.
2024-11-23 14:09:05 +00:00
IWANABETHATGUY
21614f23b6
feat(oxc_transformer): ReplaceGlobalDefinesPlugin for ComputedMemberExpr ( #7431 )
...
support replace `test['foo']` like `ComputedMemberExpr`, since they are static either,
e.g.:
https://hyrious.me/esbuild-repl/?version=0.23.0&b=e%00entry.js%00console.log%28a%5B%27b%27%5D.c%29&b=%00file.js%00&b=%00file2.js%00&o=%7B%0A++treeShaking%3A+true%2C%0A%0AglobalName%3A+%22global%22%2C%0A%22bundle%22%3A+false%2C%0Aformat%3A+%22esm%22%2C%0Adefine%3A+%7B%0A++%22a.b.c%22%3A+%22foo%22%0A%7D%0A%7D
2024-11-23 10:26:43 +00:00
overlookmotel
6fd0fcb4ff
refactor(transformer/object-rest-spread): avoid multiple symbol lookups ( #7420 )
...
`IdentifierReference::is_global_reference` and `MaybeBoundIdentifier::from_identifier_reference` both look up the symbol for the identifier. Do this lookup only once, rather than twice.
2024-11-23 05:00:30 +00:00
Song Gao
6c0d31b165
refactor(linter): remove useless const declaration ( #7430 )
...
Remove uesless const declaration, since they need to access flags, so
they should never be evaluated in compiling time.
Or does this keyword have some other functions I missed?
2024-11-23 11:58:44 +08:00
Dunqing
4d6bd07afe
fix(transformer/async-generator-functions): correct all binding scope id ( #7425 )
...
Fixed a bunch of semantic errors by removing moving binding logic 😢 . This plugin constructs a complex `for-await` replacement so that I wrongly move to an incorrect scope.
2024-11-22 16:29:00 +00:00
Boshen
bb2c0c219b
refactor(transformer)!: return String as error instead of OxcDiagnostic ( #7424 )
2024-11-22 16:22:49 +00:00
camchenry
e88cf1bfd6
fix(linter): make overrides globs relative to config path ( #7407 )
...
- fixes https://github.com/oxc-project/oxc/issues/7365
currently, we are matching globs on the absolute path to the file, which means that in order to properly match, all globs would need to start with `**/`. this is not consistent with the behavior in ESLint, which is defined here: https://eslint.org/docs/v8.x/use/configure/configuration-files#how-do-overrides-work
> **The patterns are applied against the file path relative to the directory of the config file.** For example, if your config file has the path `/Users/john/workspace/any-project/.eslintrc.js` and the file you want to lint has the path `/Users/john/workspace/any-project/lib/util.js`, then the pattern provided in `.eslintrc.js` is executed against the relative path `lib/util.js`.
This PR adds the ability to store the path to the configuration file along with the configuration data, so that we can later use it to resolve the relative paths of the files in the overrides section.
I'm not exactly sure if this will still make sense with nested configuration files, but I think it makes sense to store a path to each configuration file, alongside where the overrides are stored.
2024-11-22 14:37:45 +00:00
overlookmotel
52784d2aea
refactor(transformer/optional-chaining): avoid multiple symbol lookups ( #7421 )
...
`IdentifierReference::is_global_reference` and `MaybeBoundIdentifier::from_identifier_reference` both look up the symbol for the identifier. Do this lookup only once, rather than twice.
2024-11-22 13:36:34 +00:00
overlookmotel
971c91a2e8
feat(traverse): add methods to BoundIdentifier + MaybeBoundIdentifier to create SimpleAssignmentTargets ( #7418 )
...
We had methods to create `AssignmentTarget`s. Add methods to create `SimpleAssignmentTarget`s too.
2024-11-22 12:31:29 +00:00
overlookmotel
eb39a50a2e
refactor(transformer/logic-assignment): shorten code ( #7419 )
...
Use `create_spanned_read_expression` instead of `create_spanned_expression`, as it's shorter than specifying `ReferenceFlags` manually.
2024-11-22 11:42:03 +00:00
overlookmotel
be5f843a12
docs(traverse): fix docs for BoundIdentifier + MaybeBoundIdentifier ( #7417 )
2024-11-22 10:58:34 +00:00
Dunqing
27b2268a6c
refactor(semantic)!: remove SymbolFlags::Export ( #7414 )
...
close : #7338
close : #7344
The `SymbolFlags::Export` is Initially used to solve `ExportSpecifier` that is not `IdentifierReference` that causes we cannot determine whether a Binding is not used everywhere by `Semantic`.
Since #3820 this problem is solved, so we don't need `SymbolFlags::Export` no longer. Also, removing this can help us easier to pass the `Semantic` check in `Transformer`
2024-11-22 09:17:37 +00:00
Dunqing
c90537f1f0
refactor(linter/only-used-in-recursion): improve implementation to remove using SymbolFlags::Export ( #7413 )
...
part of #7414
2024-11-22 09:17:36 +00:00
Dunqing
c8adc46a08
refactor(linter/no-unused-vars): improve implementation to remove using SymbolFlags::Export ( #7412 )
...
part of #7414
2024-11-22 09:17:35 +00:00
Dunqing
7ff9f13973
fix(transformer): correct all ReferenceFlags ( #7410 )
2024-11-22 09:10:55 +00:00
Dunqing
6f0fe38bff
fix(semantic)!: correct all ReferenceFlags::Write according to the spec ( #7388 )
...
close #7323
According to the specification re-design the JavaScript-part ReferenceFlags inferring approach.
* https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-postfix-increment-operator-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-runtime-semantics-restdestructuringassignmentevaluation
* ... See references of https://tc39.es/ecma262/#sec-putvalue
### Changes
1. The left-hand of `AssignmentExpression` is always `ReferenceFlags::Write`
```js
let a = 0;
console.log(a = 0);
^ Write only
```
2. The `argument` of `UpdateExpression` is always `ReferenceFlags::Read | Write`
```js
let a = 0;
a++;
^ Read and Write
```
This change might cause some trouble for `Minfier` to remove this code, because ‘a’ is not used elsewhere. I have taken a look at `esbuild` and `Terser`. Only the `Terser` can remove this code.
2024-11-22 06:08:30 +00:00
Dmitry Zakharov
6730e3effe
docs(linter): add more examples for unicorn/prefer-array-some ( #7411 )
2024-11-22 14:06:46 +08:00
no-yan
4ad26b952f
feat(linter): add no-promise-in-callback ( #7307 )
...
related: #4655
This PR implements a rule to detect Promises inside error-first
callbacks, preventing the mixed usage of callbacks and Promises.
Example of problematic code:
```javascript
a(function(err) { doThing().then(a) });
^^^^^^^^^^^^^^
```
[Original
implementation](266ddbb030/rules/no-promise-in-callback.js )
2024-11-22 10:21:26 +08:00
Dmitry Zakharov
9002e97e12
fix(linter): add proper support for findIndex and findLastIndex for unicorn/prefer-array-some ( #7405 )
...
closes #7404
2024-11-22 10:12:13 +08:00
oxc-bot
0918e520cf
release(crates): v0.37.0 ( #7399 )
2024-11-21 22:27:55 +08:00
oxc-bot
4b5a176630
release(oxlint): v0.13.0 ( #7398 )
...
## [0.13.0] - 2024-11-21
- 7bf970a linter: [**BREAKING**] Remove tree_shaking plugin (#7372 )
(Boshen)
- 7f8747d linter: Implement `react/no-array-index-key` (#6960 )
(BitterGourd)
### Features
- be152c0 linter: Add `typescript/no-require-imports` rule (#7315 )
(Dmitry Zakharov)
- 849489e linter: Add suggestion for no-console (#4312 ) (DonIsaac)
- 8cebdc8 linter: Allow appending plugins in override (#7379 )
(camchenry)
- 8cfea3c oxc_cfg: Add implicit return instruction (#5568 )
(IWANABETHATGUY)
- e6922df parser: Fix incorrect AST for `x?.f<T>()` (#7387 ) (Boshen)
### Bug Fixes
- e91c287 linter: Fix panic in react/no-array-index-key (#7395 ) (Boshen)
- a32f5a7 linter/no-array-index-key: Compile error due to it uses a
renamed API (#7391 ) (Dunqing)
- 666b6c1 parser: Add missing `ChainExpression` in optional
`TSInstantiationExpression` (#7371 ) (Boshen)
### Documentation
- df143ca linter: Add docs for config settings (#4827 ) (DonIsaac)
- ad44cfa linter: Import/first options (#7381 ) (Zak)
### Refactor
- c34d649 linter: Use `scope_id` etc methods (#7394 ) (overlookmotel)
- 466f395 vscode: Split `ConfigService` and `Config` (#7376 ) (Alexander
S.)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-21 22:21:32 +08:00
Boshen
e91c2878d8
fix(linter): fix panic in react/no-array-index-key ( #7395 )
2024-11-21 13:35:21 +00:00
overlookmotel
c34d649176
refactor(linter): use scope_id etc methods ( #7394 )
...
Utilize the methods added in #7127 in `oxc_linter`.
2024-11-21 12:29:57 +00:00
Boshen
224775c056
feat(transformer): transform object rest spread ( #7003 )
...
https://babel.dev/docs/babel-plugin-transform-object-rest-spread
2024-11-21 11:33:26 +00:00
overlookmotel
b3d5802ef1
docs(syntax): more comments for ReferenceFlags ( #7392 )
...
Add more docs to `ReferenceFlags`, mainly to include the runtime test in https://github.com/oxc-project/oxc/issues/5165#issuecomment-2488333549 .
2024-11-21 11:20:28 +00:00
Dunqing
a32f5a73d3
fix(linter/no-array-index-key): compile error due to it uses a renamed API ( #7391 )
...
Fix: https://github.com/oxc-project/oxc/pull/6960#issuecomment-2490754348
2024-11-21 10:46:21 +00:00
BitterGourd
7f8747dd6a
feat(linter): implement react/no-array-index-key ( #6960 )
...
Implement not recommended rule `no-array-index-key` (#1022 )
2024-11-21 10:29:40 +00:00
IWANABETHATGUY
8cfea3c5b6
feat(oxc_cfg): add implicit return instruction ( #5568 )
...
1. Adding a new InstructionKind `ImplicitReturn`
2. Adding a new `ImplicitReturn` instruction for each function body,
just like biome

2024-11-21 16:18:51 +08:00
Dmitry Zakharov
be152c01c5
feat(linter): add typescript/no-require-imports rule ( #7315 )
2024-11-21 16:15:49 +08:00
DonIsaac
df143ca7bb
docs(linter): add docs for config settings ( #4827 )
2024-11-21 08:08:30 +00:00
DonIsaac
849489e8b4
feat(linter): add suggestion for no-console ( #4312 )
...
Part of #4179
2024-11-21 07:46:29 +00:00
Hiroshi Ogawa
3d66929fa2
fix(sourcemap): improve source map visualizer ( #7386 )
...
- Related https://github.com/rolldown/rolldown/issues/2737
Probably this is still an approximation of what
https://github.com/evanw/source-map-visualization does, but I tried to
get some ideas from it.
For comparison, I added an example from their site
https://evanw.github.io/source-map-visualization/ as a snapshot in
`crates/oxc_sourcemap/tests/fixtures/esbuild/visualizer.snap`. I'll
mention a few notable changes in the comments.
Snapshot change in rolldown repo can be found in
- https://github.com/rolldown/rolldown/pull/2829
2024-11-21 14:35:56 +08:00
Boshen
e6922df3bb
feat(parser): fix incorrect AST for x?.f<T>() ( #7387 )
2024-11-21 06:10:48 +00:00
Boshen
885e37f8eb
feat(transformer): Optional Chaining ( #6990 )
...
close : #6958
2024-11-21 03:12:18 +00:00
camchenry
8cebdc8129
feat(linter): allow appending plugins in override ( #7379 )
...
follow up to https://github.com/oxc-project/oxc/issues/6896
for improved compatibility with ESLint, this tries to match the behavior of plugin overrides so that plugins can be enabled for certain paths. this does not allow disabling plugins.
2024-11-21 01:46:28 +00:00
Zak
ad44cfa840
docs(linter): import/first options ( #7381 )
...
Fix the docs for
[import-first](https://oxc.rs/docs/guide/usage/linter/rules/import/first.html#import-first )
which mentions the option `"absolute-import"` rather than
`"absolute-first"`
2024-11-21 09:46:12 +08:00
Boshen
f059b0e655
fix(ast)!: add missing ChainExpression from TSNonNullExpression ( #7377 )
...
closes #7375
* `foo?.bar!`
* `foo?.[bar]!`
`TSNonNullExpression` was not wrapped inside `ChainExpression`.
2024-11-20 15:54:28 +00:00
Boshen
878189c407
feat(parser,linter)!: add ParserReturn::is_flow_language; linter ignore flow error ( #7373 )
...
closes #7123
2024-11-20 12:50:24 +00:00
Boshen
666b6c104c
fix(parser): add missing ChainExpression in optional TSInstantiationExpression ( #7371 )
2024-11-20 11:51:55 +00:00
Boshen
7bf970a4b6
refactor(linter)!: remove tree_shaking plugin ( #7372 )
...
This rule has been in `nursery` for a long time and I don't see it
coming out of `nursery` in the foreseeable future.
closes #7031
clsoes #7057
2024-11-20 11:46:29 +00:00
Boshen
6a98ef1a0c
feat(transformer): add CompilerAssumptions to TransformContext ( #7369 )
2024-11-20 09:27:29 +00:00
Boshen
9b9d02078c
docs(semantic): document the meaning of ReferenceFlags::Read and Write ( #7368 )
...
closes #5165
2024-11-20 09:18:25 +00:00