Commit graph

3849 commits

Author SHA1 Message Date
github-actions[bot]
6168969f94
Release oxlint v0.4.4 (#3669)
## [0.4.4] - 2024-06-14

### Features

- 8f5655d linter: Add eslint/no-useless-constructor (#3594) (Don Isaac)
- 29c78db linter: Implement
@typescript-eslint/explicit-function-return-type (#3455) (kaykdm)
- 21d3425 linter: Typescript-eslint no-useless-empty-export (#3605)
(keita hino)
- 85c3b83 linter: Eslint-plugin-jest/max-nested-describes (#3585)
(cinchen)
- f6d9ca6 linter: Add `eslint/sort-imports` rule (#3568) (Wang Wenzhe)
- 046ff3f linter/eslint: Add `no_unreachable` rule. (#3238) (rzvxa)
- e32ce00 linter/jsdoc: Implement require-param-name rule (#3636) (Yuji
Sugiura)
- 110661c linter/jsdoc: Implement require-param-description (#3621)
(Yuji Sugiura)
- d6370f1 linter/jsdoc: Implement require-param-type rule (#3601) (Yuji
Sugiura)
- d9c5b33 semantic/cfg: Add `Condition` instruction. (#3567) (Ali
Rezvani)
- f2dfd66 semantic/cfg: Add iteration instructions. (#3566) (rzvxa)

### Bug Fixes

- f0b689d linter: Panic in jsdoc/require-param (#3590) (Don Isaac)
- e148a32 semantic/cfg: Correct unreachability propagation in
try-finally. (#3667) (Ali Rezvani)

### Refactor

- 84304b4 linter: Add a `ctx.module_record()` method (#3637) (Boshen)
- f98f777 linter: Add rule fixer (#3589) (Don Isaac)
- fa11644 linter: Pass `Rc` by value (#3587) (overlookmotel)
- f702fb9 semantic/cfg: Cleanup control flow and it's builder. (#3650)
(rzvxa)
- 5793ff1 transformer: Replace `&’a Trivias` with `Rc<Trivias>` (#3580)
(Dunqing)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-14 15:05:26 +08:00
Boshen
86556cef96
ci: simplify release scripts 2024-06-14 14:42:43 +08:00
Boshen
291eddf689
chore: cliff.toml features_always_bump_minor = false 2024-06-14 14:42:20 +08:00
Dunqing
0578ece6a4
refactor(ast)!: remove ExportDefaultDeclarationKind::TSEnumDeclaration (#3666)
TypeScript doesn't support `export default enum id {}`


https://www.typescriptlang.org/play/?target=2&isolatedDeclarations=true&emitDeclarationOnly=true&isolatedModules=false&ts=5.5.1-rc#code/KYDwDg9gTgLgBAE2AMwIYFcA29gDt0C2cAlgnAN4C+QA

https://github.com/microsoft/TypeScript/issues/3320
2024-06-14 14:40:37 +08:00
Ali Rezvani
e148a32ce3
fix(semantic/cfg): correct unreachability propagation in try-finally. (#3667)
closes #3663


[oxlint-ecosystem-ci](https://github.com/rzvxa/oxlint-ecosystem-ci/actions/runs/9511509383/job/26217870705)

From this:

![Screenshot 2024-06-14
092916](https://github.com/oxc-project/oxc/assets/3788964/9e6a9a01-984a-4a19-8a73-abc3b71fb9c2)

To this:

![Screenshot 2024-06-14
092852](https://github.com/oxc-project/oxc/assets/3788964/46483bc2-a227-4416-b8da-07b11ab96990)

Since try-finally (without a catch) wouldn't join after finalization.
2024-06-14 14:39:20 +08:00
Boshen
c7c22b70eb
chore(linter): fix whitespace in no-useless-constructor 2024-06-14 13:32:32 +08:00
Boshen
d92bb3a0c3
chore(linter): move no-useless-constructor to nursery 2024-06-14 13:21:38 +08:00
Boshen
ce6cacc85a
chore(linter): move no-unreachable to nursery 2024-06-14 13:13:10 +08:00
renovate
c1b34ff011 chore(deps): update dependency rust to v1.79.0 (#3661)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://togithub.com/rust-lang/rust) | minor | `1.78.0` -> `1.79.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.79.0`](https://togithub.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1790-2024-06-13)

[Compare Source](https://togithub.com/rust-lang/rust/compare/1.78.0...1.79.0)

\==========================

<a id="1.79.0-Language"></a>

## Language

-   [Stabilize inline `const {}` expressions.](https://togithub.com/rust-lang/rust/pull/104087/)
-   [Prevent opaque types being instantiated twice with different regions within the same function.](https://togithub.com/rust-lang/rust/pull/116935/)
-   [Stabilize WebAssembly target features that are in phase 4 and 5.](https://togithub.com/rust-lang/rust/pull/117457/)
-   [Add the `redundant_lifetimes` lint to detect lifetimes which are semantically redundant.](https://togithub.com/rust-lang/rust/pull/118391/)
-   [Stabilize the `unnameable_types` lint for public types that can't be named.](https://togithub.com/rust-lang/rust/pull/120144/)
-   [Enable debuginfo in macros, and stabilize `-C collapse-macro-debuginfo` and `#[collapse_debuginfo]`.](https://togithub.com/rust-lang/rust/pull/120845/)
-   [Propagate temporary lifetime extension into `if` and `match` expressions.](https://togithub.com/rust-lang/rust/pull/121346/)
-   [Restrict promotion of `const fn` calls.](https://togithub.com/rust-lang/rust/pull/121557/)
-   [Warn against refining impls of crate-private traits with `refining_impl_trait` lint.](https://togithub.com/rust-lang/rust/pull/121720/)
-   [Stabilize associated type bounds (RFC 2289).](https://togithub.com/rust-lang/rust/pull/122055/)
-   [Stabilize importing `main` from other modules or crates.](https://togithub.com/rust-lang/rust/pull/122060/)
-   [Check return types of function types for well-formedness](https://togithub.com/rust-lang/rust/pull/115538)
-   [Rework `impl Trait` lifetime inference](https://togithub.com/rust-lang/rust/pull/116891/)
-   [Change inductive trait solver cycles to be ambiguous](https://togithub.com/rust-lang/rust/pull/122791)

<a id="1.79.0-Compiler"></a>

## Compiler

-   [Define `-C strip` to only affect binaries, not artifacts like `.pdb`.](https://togithub.com/rust-lang/rust/pull/115120/)
-   [Stabilize `-Crelro-level` for controlling runtime link hardening.](https://togithub.com/rust-lang/rust/pull/121694/)
-   [Stabilize checking of `cfg` names and values at compile-time with `--check-cfg`.](https://togithub.com/rust-lang/rust/pull/123501/)
    *Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release.*
-   [Add `aarch64-apple-visionos` and `aarch64-apple-visionos-sim` tier 3 targets.](https://togithub.com/rust-lang/rust/pull/121419/)
-   [Add `riscv32ima-unknown-none-elf` tier 3 target.](https://togithub.com/rust-lang/rust/pull/122696/)
-   [Promote several Windows targets to tier 2](https://togithub.com/rust-lang/rust/pull/121712): `aarch64-pc-windows-gnullvm`, `i686-pc-windows-gnullvm`, and `x86_64-pc-windows-gnullvm`.

Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.

<a id="1.79.0-Libraries"></a>

## Libraries

-   [Implement `FromIterator` for `(impl Default + Extend, impl Default + Extend)`.](https://togithub.com/rust-lang/rust/pull/107462/)
-   [Implement `{Div,Rem}Assign<NonZero<X>>` on `X`.](https://togithub.com/rust-lang/rust/pull/121952/)
-   [Document overrides of `clone_from()` in core/std.](https://togithub.com/rust-lang/rust/pull/122201/)
-   [Link MSVC default lib in core.](https://togithub.com/rust-lang/rust/pull/122268/)
-   [Caution against using `transmute` between pointers and integers.](https://togithub.com/rust-lang/rust/pull/122379/)
-   [Enable frame pointers for the standard library.](https://togithub.com/rust-lang/rust/pull/122646/)

<a id="1.79.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`{integer}::unchecked_add`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_add)
-   [`{integer}::unchecked_mul`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_mul)
-   [`{integer}::unchecked_sub`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_sub)
-   [`<[T]>::split_at_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_unchecked)
-   [`<[T]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked)
-   [`<[u8]>::utf8_chunks`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.utf8\_chunks)
-   [`str::Utf8Chunks`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunks.html)
-   [`str::Utf8Chunk`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunk.html)
-   [`<*const T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned)
-   [`<*mut T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned-1)
-   [`NonNull::is_aligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_aligned)
-   [`<*const [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len)
-   [`<*mut [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len-1)
-   [`<*const [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty)
-   [`<*mut [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty-1)
-   [`NonNull::<[T]>::is_empty`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_empty)
-   [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes)
-   [`io::Error::downcast`](https://doc.rust-lang.org/stable/std/io/struct.Error.html#method.downcast)
-   [`num::NonZero<T>`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html)
-   [`path::absolute`](https://doc.rust-lang.org/stable/std/path/fn.absolute.html)
-   [`proc_macro::Literal::byte_character`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.byte_character)
-   [`proc_macro::Literal::c_string`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.c_string)

These APIs are now stable in const contexts:

-   [`Atomic*::into_inner`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.into_inner)
-   [`io::Cursor::new`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.new)
-   [`io::Cursor::get_ref`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_ref)
-   [`io::Cursor::position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.position)
-   [`io::empty`](https://doc.rust-lang.org/stable/std/io/fn.empty.html)
-   [`io::repeat`](https://doc.rust-lang.org/stable/std/io/fn.repeat.html)
-   [`io::sink`](https://doc.rust-lang.org/stable/std/io/fn.sink.html)
-   [`panic::Location::caller`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.caller)
-   [`panic::Location::file`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file)
-   [`panic::Location::line`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.line)
-   [`panic::Location::column`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.column)

<a id="1.79.0-Cargo"></a>

## Cargo

-   [Prevent dashes in `lib.name`, always normalizing to `_`.](https://togithub.com/rust-lang/cargo/pull/12783/)
-   [Stabilize MSRV-aware version requirement selection in `cargo add`.](https://togithub.com/rust-lang/cargo/pull/13608/)
-   [Switch to using `gitoxide` by default for listing files.](https://togithub.com/rust-lang/cargo/pull/13696/)
-   [Error on `[project]` in Edition 2024; `cargo fix --edition` will change it to `[package]`.](https://togithub.com/rust-lang/cargo/pull/13747/)

<a id="1.79.0-Rustdoc"></a>

## Rustdoc

-   [Always display stability version even if it's the same as the containing item.](https://togithub.com/rust-lang/rust/pull/118441/)
-   [Show a single search result for items with multiple paths.](https://togithub.com/rust-lang/rust/pull/119912/)
-   [Support typing `/` in docs to begin a search.](https://togithub.com/rust-lang/rust/pull/123355/)

<a id="1.79.0-Misc"></a>

## Misc

<a id="1.79.0-Compatibility-Notes"></a>

## Compatibility Notes

-   [Update the minimum external LLVM to 17.](https://togithub.com/rust-lang/rust/pull/122649/)
-   [`RustcEncodable` and `RustcDecodable` are soft-destabilized, to be removed
    from the prelude in next edition.](https://togithub.com/rust-lang/rust/pull/116016/)
-   [The `wasm_c_abi` future-incompatibility lint will warn about use of the
    non-spec-compliant C ABI.](https://togithub.com/rust-lang/rust/pull/117918/)
    Use `wasm-bindgen v0.2.88` to generate forward-compatible bindings.
-   [Check return types of function types for well-formedness](https://togithub.com/rust-lang/rust/pull/115538)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, 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 has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2024-06-14 02:28:06 +00:00
Boshen
7f8dd24d6a
chore: fix cargo doc 2024-06-14 09:21:14 +08:00
Boshen
c522796ade
feat(coverage): TypeScript transpile runner prototype (#3660) 2024-06-13 22:16:22 +08:00
Boshen
30dc17ea92 refactor(coverage): align to typescript's test harness (#3659)
refactor(coverage): align to typescript's test harness

feat(coverage): transpile_runner prototype
2024-06-13 13:17:46 +00:00
Boshen
022e8e759a refactor(coverage): move test runners to their own modules (#3658) 2024-06-13 11:16:18 +00:00
rzvxa
f702fb91ee refactor(semantic/cfg): cleanup control flow and it's builder. (#3650)
Removed remaining parts of the old CFG implementation and some cleanups here and there.
2024-06-13 09:37:49 +00:00
rzvxa
046ff3fdfb feat(linter/eslint): add no_unreachable rule. (#3238)
closes #621
[no-unreachable](069aa680c7/lib/rules/no-unreachable.js (L196))

[oxlint-echosystem-ci result](https://github.com/rzvxa/oxlint-ecosystem-ci/actions/runs/9406195143/job/25909079029)

This rule is done but since it is running for every possible statement and does quite a bit of work on them to determine whether it is 100% reachable or not; The performance in my opinion is kind of abysmal.

I'll try to work it out, I know Biome does 2 types of checks to simplify the rule for some nodes, However, they have a lot more false negatives than our implementation.

##### Here is one example of those [false negatives](https://biomejs.dev/playground/?code=ZgB1AG4AYwB0AGkAbwBuACAAeAAoACkAIAB7ACAAZABvACAAewAgAGEAKAApADsAIAB9ACAAdwBoAGkAbABlACgAdAByAHUAZQApADsAIABiACgAKQA7ACAAfQA%3D)

-------------

### Update 1:

I've benchmarked this rule using only the simplified reachability checks and it was around 5% faster, To be honest, it isn't much improvement especially considering that we can only use this check for a small portion of nodes and even that is accompanied by newly introduced checks which would lessen the amount of performance gain further.

Most of the performance regression is because of allocations during our depth first search since we have to store both the visited and finished nodes which results in a bunch of rapid-fire allocations back to back. Currently, At the moment I don't have a great idea of how to improve it, We may have to implement our own graph to use arenas underneath.

Given that this rule is the most extensive use case of control flow (It doesn't come with a limited scope similar to property and constructor rules already implemented) this performance drop might be reasonable to some extent.

------------

### Update 2:

I reworked my approach in 2 senses, First I used @Boshen's suggestion inspired by TypeScript and kept some of the reachability information in the basic block structure instead of calculating it on the fly. It is done by propagating the `Unreachable` edge and `Unreachable` instruction throughout subgraphs.

This for sure helped with the performance but the next part is what never failed to amaze me, Going from something near `O(n!)` in the worst-case scenario to `O(n^2)` (in the worst-case scenario). By changing the approach instead of checking the reachability of each statement we do it in 3 paths; First, we do a path on the entire CFG and query all reachable but suspicious cases, and then we do another path on each of these suspicions subgraphs to determine the reachability with higher confidence. Finally, we iterate all of the appropriate nodes and check their reachability status according to the information collected in 2 previous paths.

With these 2 this rule went from `-24%` to `~-2%`.

This performance gain doesn't come for free though; It increases the likelihood of false positives/negatives, But as long as we are passing our `ecosystem-ci` it should be fine. We can always sacrifice some performance to check for edge cases if there are any.

[new oxlint-echosystem-ci result](https://github.com/rzvxa/oxlint-ecosystem-ci/actions/runs/9490791181)
2024-06-13 09:37:45 +00:00
rzvxa
9c31ed9178 feat(semantic/cfg): propagate unreachable edges through subgraphs. (#3648)
From this:

![Screenshot 2024-06-12 230152](https://github.com/oxc-project/oxc/assets/3788964/b489cee8-62ec-4483-9c9b-6e3d9858fec2)

To this:

![Screenshot 2024-06-12 230031](https://github.com/oxc-project/oxc/assets/3788964/674a6e42-5311-4ca6-940b-65d8e3ccc0f4)
2024-06-13 08:34:12 +00:00
Ali Rezvani
d9c5b33394
feat(semantic/cfg): add Condition instruction. (#3567) 2024-06-13 16:17:24 +08:00
rzvxa
f2dfd667df feat(semantic/cfg): add iteration instructions. (#3566) 2024-06-13 07:36:20 +00:00
rzvxa
defef057e1 improvement(semantic/cfg): better control flow for switch statements. (#3547)
There was an issue similar to the one in loops see #3451 to #3453
2024-06-13 07:36:18 +00:00
rzvxa
9b3097147e improvement(semantic/cfg): rework error path. (#3519)
This PR aims to provide a more accurate error/finalization flow, I've nuked the old error path approach and rewrote it with more versatility in mind.

We used to visit the finalizer block twice and create 2 sets of AstNodes/Basic Blocks for them, This was there to differentiate between the error path finalizer and success path one. There is no longer a need for having 2 separate sets of nodes to do this differentiation.

As for the error path now we have 2 kinds of them, Everything is attached to an error block - even if it is not in a try-catch statement - this results in a lot of extra edges to keep track of these "Implicit" error blocks but I believe in future it can help us to track cross block error paths, For example, we can dynamically attach and cache the implicit error block of a function to its call site error path (either implicit or explicit).
2024-06-13 07:36:16 +00:00
Dunqing
59666e0127
fix(transformer): do not rename accessible identifier references (#3623)
close: #3620

In `Babel`, the expected output is:

```ts
var x = 10;
var Foo = function(Foo) {
       Foo[Foo['a'] = 10] = 'a';
       Foo[Foo['b'] = 10] = 'b';
       Foo[Foo['c'] = 30] = 'c';
       return Foo;
}(Foo || {});
```

IMO, `Foo.b + x` is enough, because `x` is not a const variable. The
output same as with `typescript`
2024-06-13 15:26:38 +08:00
Don Isaac
f96b6b18c9
build(website): use typescript (#3653)
Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-13 15:02:32 +08:00
Boshen
1edcd87203
chore: change all usages of static_assertions to dev-dependencies (#3654) 2024-06-13 13:18:53 +08:00
Don Isaac
8f5655dfe6
feat(linter): add eslint/no-useless-constructor (#3594)
Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-13 13:12:18 +08:00
Ali Rezvani
c4f47c985f
docs(README): change the website domain. (#3652) 2024-06-13 13:05:37 +08:00
Yuji Sugiura
70fc69b916
fix(semantic): Add Eq to CtxFlags (#3651)
I've just created example using `oxc_semantic`. 

> https://gist.github.com/leaysgur/bcb748daa665d1615eabda6967366d05

But it could not be compiled due to:

```
error: to use a constant of type `CtxFlags` in a pattern, `CtxFlags` must be annotated with `#[derive(PartialEq, Eq)]`
```

- 0.14.0: 🆖 
- ...
- 0.13.0: 🆖 
- 0.12.5: 🆗 

This change seems to fix this.
2024-06-13 13:04:42 +08:00
Rihards Gravis
dbf7c3aaa2
fix(napi/parser): typescript types for Comment is out of order (#3646)
Fix `oxc-parser` Typescript type definition for `Comment` type where the
`type` and `value` have reversed types in place.
2024-06-13 00:20:26 +08:00
Boshen
14b44062c2
ci: pin typos to a specific version (#3647) 2024-06-13 00:04:46 +08:00
Boshen
c041e9d1a9
chore: bump test262, babel and TypeScript submodules (#3644) 2024-06-12 18:42:32 +08:00
Boshen
a798ff4e89
ci: add actions: write permission to release_crates 2024-06-12 18:00:50 +08:00
github-actions[bot]
95e0571c2e
Release crates v0.14.0 (#3643)
## [0.14.0] - 2024-06-12

### Breaking

* fix(codegen)!: remove the unecessary 4th argument from `Codegen::new`
(#3640)
* feat(ast)!: make `Trivias` clonable by adding `Arc` (#3638)

### Features

- f6d9ca6 linter: Add `eslint/sort-imports` rule (#3568) (Wang Wenzhe)
- 129f91e span: Port over more methods from TextRange (#3592) (Don
Isaac)

### Bug Fixes

- f8f6d33 ast: Correct `visited_node` attr for strict mode of arrow fns
(#3635) (overlookmotel)
- e6ad3fb diagnostics: Do not print ansi color codes in non-TTYs (#3624)
(Boshen)
- d65202d span: Correct doc comments (#3608) (overlookmotel)
- 35e267b transformer: Arrow function transform use UIDs for `_this`
vars (#3634) (overlookmotel)
- 39bdebc transformer: Arrow func transform maintain scope ID (#3633)
(overlookmotel)
- 5cb7e6a transformer: Arrow func transform use correct spans (#3630)
(overlookmotel)
- 0c4ccb4 transformer: Arrow function transform alter `</this>` (#3627)
(overlookmotel)
- 8d237c4 transformer: JSX source calculate correct column when Unicode
chars (#3615) (overlookmotel)
- 9e8f4d6 transformer: Do not add `__source` for generated nodes (#3614)
(overlookmotel)
- 0fb4c35 transformer: Use UID for JSX source filename var (#3612)
(overlookmotel)

### Performance

- 3a59294 transformer: React display name transform reduce Atom
allocations (#3616) (overlookmotel)
- f4c1389 transformer: Create `Vec` with capacity (#3613)
(overlookmotel)

### Refactor

- 0f92521 ast: Replace recursion with loop (#3626) (overlookmotel)
- 08f1010 ast: Make `AstBuilder` `Copy` (#3602) (overlookmotel)
- 84304b4 linter: Add a `ctx.module_record()` method (#3637) (Boshen)
- f98f777 linter: Add rule fixer (#3589) (Don Isaac)
- e90e6a2 minifier: Make `Prepass` `Copy` (#3603) (overlookmotel)
- 7d61832 semantic: Pass `Rc` by value (#3586) (overlookmotel)
- 89bcbd5 transformer: Move `BoundIdentifier` into helpers (#3610)
(overlookmotel)
- 5793ff1 transformer: Replace `&’a Trivias` with `Rc<Trivias>` (#3580)
(Dunqing)
- 509871f transformer: Comment for unimplemented `spec` option in arrow
fns transform (#3618) (overlookmotel)
- 4b2e3a7 transformer: Fix indentation (#3617) (overlookmotel)
- 3467e3d transformer: Remove outdated comment (#3606) (overlookmotel)
- a799225 transformer: Flatten file structure for React transform
(#3604) (overlookmotel)
- 70f31a8 transformer: Reduce branching in JSX transform (#3596)
(overlookmotel)
- 3ae567d transformer: Remove dead code (#3588) (overlookmotel)
- 60cbdec traverse: `generate_uid_in_root_scope` method (#3611)
(overlookmotel)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-12 17:52:41 +08:00
Boshen
8dcab3d3fb
chore: features_always_bump_minor = true for changelog 2024-06-12 17:38:05 +08:00
Boshen
bf19c7c895
chore: relax rustc-hash version 2024-06-12 17:31:24 +08:00
kaykdm
29c78db358
feat(linter): implement @typescript-eslint/explicit-function-return-type (#3455)
Related issue: https://github.com/oxc-project/oxc/issues/2180

original implementation

- code:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/explicit-function-return-type.ts
- test:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts
- doc: https://typescript-eslint.io/rules/explicit-function-return-type/

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-12 16:45:02 +08:00
Boshen
b58d8eb88f fix!(codegen): remove the unecessary 4th argument from Codegen::new (#3640) 2024-06-12 07:58:54 +00:00
Boshen
d77ec9f95a
chore: remove trailing whitespaces for all files; add .editorconfig (#3639) 2024-06-12 15:47:26 +08:00
overlookmotel
35e267ba17 fix(transformer): arrow function transform use UIDs for _this vars (#3634)
Change arrow function transform to use UIDs for `_this` vars, which can't clash with an existing binding.

I believe there are some problems with our current implementation, but have struggled to fix them due to weird interactions with TS transforms. Have added "TODO" comments, so we can return to this and fix them later on, once scopes in TS transforms are correct.

My failed attempt at fixing is on this branch: https://github.com/oxc-project/oxc/tree/transform-arrow-functions
2024-06-12 05:22:46 +00:00
overlookmotel
39bdebc90e fix(transformer): arrow func transform maintain scope ID (#3633)
In arrow function transform, set `scope_id` of new `function () {}` to `scope_id` of arrow function it replaces, and alter scope flags.
2024-06-12 05:22:43 +00:00
Boshen
f6752b482f
feat!(ast): make Trivias clonable by adding Arc (#3638)
This makes `Trivias` cloneable and stops us from using `Rc::new` and
`Rc::clone` everywhere.

`Trivias` is rarely cloned so an `Arc` should suffice.
2024-06-12 13:16:10 +08:00
Boshen
84304b4f8f refactor(linter): add a ctx.module_record() method (#3637) 2024-06-12 04:32:38 +00:00
overlookmotel
5cb7e6ae56 fix(transformer): arrow func transform use correct spans (#3630)
Arrow function transform generate output with correct spans.
2024-06-12 04:10:42 +00:00
keita hino
21d3425db0
feat(linter): typescript-eslint no-useless-empty-export (#3605)
partof: #2180

docs: https://typescript-eslint.io/rules/no-useless-empty-export/
code:
584db29ec4/packages/eslint-plugin/src/rules/no-useless-empty-export.ts
test:
ac397f1817/packages/eslint-plugin/tests/rules/no-useless-empty-export.test.ts

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-12 12:05:38 +08:00
overlookmotel
0c4ccb4906 fix(transformer): arrow function transform alter </this> (#3627)
Arrow function transform transforms `this` in `<this>` (JSX opening element), but was missing out transforming `</this>` (JSX closing element).
2024-06-12 02:59:22 +00:00
Yuji Sugiura
e32ce00bfb
feat(linter/jsdoc): Implement require-param-name rule (#3636)
Part of #1170 

>
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-name.md
2024-06-12 10:55:37 +08:00
overlookmotel
f8f6d33722 fix(ast): correct visited_node attr for strict mode of arrow fns (#3635)
Correct the `#[visited_node]` attr on `ArrowFunctionExpression` to recognise strict mode functions.

This change has no effect at present as `Traverse` codegen currently ignores `strict_if`. But useful for it to be correct for if we codegen `Visit` / `VisitMut` later on (#3392).
2024-06-11 21:57:56 +00:00
Boshen
9698be5479 chore(coverage): ignore eval related code in codegen runtime (#3628)
Properly misconfigured test setup for `eval`, but can't figure out where
2024-06-11 15:23:36 +00:00
overlookmotel
0f925210af
refactor(ast): replace recursion with loop (#3626)
Replace recursion with loop in
`JSXMemberExpression::get_object_identifier`.

Also add a mutable version
`JSXMemberExpression::get_object_identifier_mut`.
2024-06-11 21:56:08 +08:00
cinchen
85c3b83f5f
feat(linter): eslint-plugin-jest/max-nested-describes (#3585)
part of https://github.com/oxc-project/oxc/issues/492

Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/max-nested-describe.ts)
2024-06-11 20:13:31 +08:00
Boshen
1959930ee7
fix(coverage): fix clippy 2024-06-11 17:01:52 +08:00
Boshen
0654400cfa
chore(linter): fix clippy 2024-06-11 16:52:02 +08:00