Commit graph

2698 commits

Author SHA1 Message Date
overlookmotel
55bbde2888 refactor(ast): move scope from TSModuleBlock to TSModuleDeclaration (#3488)
Closes #3471.

Remove scope from `TSModuleBlock` and add scope to `TSModuleDeclaration` instead.
2024-05-31 17:33:05 +00:00
overlookmotel
9c3d1631a4 refactor(ast): rename function params (#3487)
Rename function params from `_kind` to `kind`. This has no practical effect but makes Rust Analyser give nicer param name hints when using these APIs.
2024-05-31 12:34:48 +00:00
overlookmotel
286b5ed3d7 refactor(ast): remove defunct hashing of Span (#3486)
`Span` has a no-op `Hash` impl.

ea53267956/crates/oxc_span/src/span.rs (L50-L54)

So remove pointless `self.span.hash(state)` operations from `Hash` impls for AST nodes.
2024-05-31 12:25:05 +00:00
Dunqing
ea53267956 fix(ast): UsingDeclaration is not a typescript syntax (#3482) 2024-05-31 11:15:37 +00:00
Dunqing
9dc58d582d refactor(transformer/typescript): use a memory-safe implementation instead (#3481)
The previous implementation causes memory double free, but I don't know why.
2024-05-31 11:15:35 +00:00
Dunqing
25e5bdda3c fix(transformer/typescript) if this statement is typescript syntax, replace it with a BlockStatement (#3480) 2024-05-31 07:24:47 +00:00
overlookmotel
84feceb118 refactor(transformer): explicit skip TS statements in TS namespace transform (#3479)
No substantive change. This should just be slightly more efficient as we've already handled most of the other variants earlier in the match.
2024-05-31 05:52:14 +00:00
overlookmotel
7f7b5ea9e8 refactor(transformer): shorter code in TS namespace transform (#3478)
Small refactor to shorten code.
2024-05-31 05:39:50 +00:00
overlookmotel
7e7b4526ba refactor(transformer): panic on illegal cases in TS namespace transform (#3477)
Panic on function or class declaration without `id`. This should be impossible.
2024-05-31 05:39:46 +00:00
overlookmotel
8e089a9f2d refactor(transformer): rename var (#3476)
Just rename a variable.
2024-05-31 05:34:56 +00:00
overlookmotel
0f69ffda5f refactor(transformer): shorten code in TS namespace transform (#3468)
Refactor to shorten code.
2024-05-30 21:56:31 +00:00
overlookmotel
deef86aff2 refactor(transformer): remove unreachable code from TS namespace transform (#3475)
As discussed in https://github.com/oxc-project/oxc/pull/3468#discussion_r1619782711, `export {x}` is not legal inside a TS namespace. So remove the code which handles this impossible case.
2024-05-30 21:56:30 +00:00
Dunqing
574629e5de feat(tasks/coverage): turn on idempotency testing for transformer (#3470) 2024-05-30 22:15:32 +08:00
Dunqing
350cd9158a
fix(parser): should parser error when function declaration has no name (#3461)
https://oxc-project.github.io/oxc/playground/?code=3YCAAICNgICAgICAgICzncl%2FKeF7k4Y7upgY2l43c79%2FYxaAgA%3D%3D
2024-05-30 19:58:50 +08:00
Dunqing
baed1ca645 fix(transformer/jsx-source): add filename statement only after inserting the source object (#3469) 2024-05-30 11:36:14 +00:00
谭光志
4c17bc6f53
feat(linter): eslint/no-constructor-return (#3321) 2024-05-30 09:06:17 +00:00
IWANABETHATGUY
0cdb45a1ff
feat(oxc_codegen): preserve annotate comment (#3465)
1. Copy tests from
efa3dd2d8e/internal/bundler_tests/bundler_dce_test.go (L3833-L3971)
2. Add option to preserve annotate comment like `/* #__NO_SIDE_EFFECTS__
*/` and `/* #__PURE__ */`
2024-05-30 15:25:23 +08:00
overlookmotel
15734f5c4b
chore(parser): code comment for cold trampoline function (#3467)
Add a comment to explain the "cold trampoline function" used in lexer.
2024-05-30 01:11:00 +01:00
Dunqing
b4fd1ad31c fix(transformer/typescript): variable declarations are not created when a function has a binding with the same name (#3460) 2024-05-29 23:00:22 +00:00
Dunqing
1a50b86281 refactor(typescript/namespace): reuse TSModuleBlock's scope id (#3459) 2024-05-29 23:00:15 +00:00
overlookmotel
90b0f6da81
fix(transformer): use UIDs for React imports (#3431)
Use UIDs for local var names for React JSX imports e.g. `_jsx` in
`import { jsx as _jsx } from "react/jsx-runtime";`.
2024-05-29 18:32:10 +08:00
rzvxa
b1887782ac fix(linter/eslint): fix require-await false positives in ForOfStatement. (#3457)
closes #3456
2024-05-28 17:58:31 +00:00
Wang Wenzhe
e275659cdc
feat(linter): add oxc/no-rest-spread-properties rule (#3432)
People open this rule may have some specific purpose, I am deliberating
about whether to add a custom message.
2024-05-28 15:04:17 +00:00
Wang Wenzhe
0d2c977c11
feat(linter): add oxc/no-const-enum rule (#3435) 2024-05-28 22:50:54 +08:00
Dunqing
92df98b005 feat(transformer/typescript): report error that do not allow namespaces (#3448) 2024-05-28 13:38:01 +00:00
Dunqing
a6b073a47c feat(transformer/typescript): report error for namespace exporting non-const (#3447) 2024-05-28 13:38:00 +00:00
Dunqing
150255c704 feat(transformer/typescript): if within a block scope, use let to declare enum name (#3446) 2024-05-28 13:37:58 +00:00
Dunqing
e80552c797 feat(transformer/typescript): if binding exists, variable declarations are not created for namespace name (#3445) 2024-05-28 13:37:57 +00:00
Dunqing
cf41513d28
fix(parser): parse const extends in arrow functions correctly (#3450)
close: #3443
2024-05-28 21:34:52 +08:00
Wang Wenzhe
085f91761c
feat(linter): add oxc/no-async-await rule (#3438) 2024-05-28 21:31:56 +08:00
cinchen
ded59bc35b
feat(linter): eslint-plugin-jest/require-top-level-describe (#3439)
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/require-top-level-describe.ts)

---------

Co-authored-by: wenzhe <mysteryven@gmail.com>
2024-05-28 21:23:16 +08:00
cinchen
edaa555620
feat(linter): eslint-plugin-jest/prefer-hooks-on-top (#3437)
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/prefer-hooks-on-top.ts)
2024-05-28 20:42:14 +08:00
Boshen
570b234a70
chore(transformers): switch crate browserslist-rs to oxc-browserslist 2024-05-28 10:49:49 +08:00
Jelle van der Waa
b589fd612f
feat(linter/eslint): Implement no-div-regex (#3442)
Rule Detail:
[link](https://eslint.org/docs/latest/rules/no-div-regex)
2024-05-28 09:13:11 +08:00
overlookmotel
6a322c9c96
chore(traverse): code comments - edit comment to outline a better way to generate UIDs (#3434)
Edit comment to outline a better way to generate UIDs.
2024-05-27 22:52:46 +08:00
Dunqing
9c58231c62
refactor(semantic): use a simpler way to resolve reference for ReferenceFlag::Type (#3430) 2024-05-27 22:43:52 +08:00
Dunqing
816a782254
feat(transformer): support targets option of preset-env (#3371)
The implementation of the `targets` options was copied from
[swc](https://github.com/swc-project/swc/tree/main/crates/preset_env_base),
which resulted in some added dependencies in transformer.
Currently, it has supported enabling plugins by `targets`
2024-05-27 10:33:40 +08:00
renovate[bot]
ea0d57f944
chore(deps): lock file maintenance rust crates (#3422)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|  |  | lockFileMaintenance | All locks refreshed |
| [insta](https://insta.rs/)
([source](https://togithub.com/mitsuhiko/insta)) |
workspace.dependencies | minor | `1.38.0` -> `1.39.0` |
| [itertools](https://togithub.com/rust-itertools/itertools) |
workspace.dependencies | minor | `0.12.1` -> `0.13.0` |
| [mimalloc](https://togithub.com/purpleprotocol/mimalloc_rust) |
workspace.dependencies | patch | `0.1.41` -> `0.1.42` |
| [napi-derive](https://togithub.com/napi-rs/napi-rs) |
workspace.dependencies | patch | `2.16.4` -> `2.16.5` |
| [ouroboros](https://togithub.com/someguynamedjosh/ouroboros) |
workspace.dependencies | patch | `0.18.3` -> `0.18.4` |
| [proc-macro2](https://togithub.com/dtolnay/proc-macro2) |
workspace.dependencies | patch | `1.0.82` -> `1.0.84` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | workspace.dependencies
| patch | `1.0.201` -> `1.0.203` |
| [trybuild](https://togithub.com/dtolnay/trybuild) |
workspace.dependencies | patch | `1.0.95` -> `1.0.96` |

🔧 This Pull Request updates lock files to use the latest dependency
versions.

---

### Release Notes

<details>
<summary>mitsuhiko/insta (insta)</summary>

###
[`v1.39.0`](https://togithub.com/mitsuhiko/insta/blob/HEAD/CHANGELOG.md#1390)

[Compare
Source](https://togithub.com/mitsuhiko/insta/compare/1.38.0...1.39.0)

- Fixed a bug in `require_full_match`.
[#&#8203;485](https://togithub.com/mitsuhiko/insta/issues/485)

- Fixed a bug that caused snapshot and module names to sometimes be
inaccurate.
[#&#8203;483](https://togithub.com/mitsuhiko/insta/issues/483)

- Insta will no longer error when removing snapshots that were already
removed. [#&#8203;484](https://togithub.com/mitsuhiko/insta/issues/484)

- Added support for trailing commas in inline snapshots.
[#&#8203;472](https://togithub.com/mitsuhiko/insta/issues/472)

- Don't pass `--color` in all cases to `libtest` any more to work around
limitations
with custom test harnesses.
[#&#8203;491](https://togithub.com/mitsuhiko/insta/issues/491)

</details>

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

###
[`v0.13.0`](https://togithub.com/rust-itertools/itertools/blob/HEAD/CHANGELOG.md#0130)

[Compare
Source](https://togithub.com/rust-itertools/itertools/compare/v0.12.1...v0.13.0)

##### Breaking

- Removed implementation of `DoubleEndedIterator` for `ConsTuples`
([#&#8203;853](https://togithub.com/rust-itertools/itertools/issues/853))
- Made `MultiProduct` fused and fixed on an empty iterator
([#&#8203;835](https://togithub.com/rust-itertools/itertools/issues/835),
[#&#8203;834](https://togithub.com/rust-itertools/itertools/issues/834))
- Changed `iproduct!` to return tuples for maxi one iterator too
([#&#8203;870](https://togithub.com/rust-itertools/itertools/issues/870))
- Changed `PutBack::put_back` to return the old value
([#&#8203;880](https://togithub.com/rust-itertools/itertools/issues/880))
- Removed deprecated `repeat_call, Itertools::{foreach, step,
map_results, fold_results}`
([#&#8203;878](https://togithub.com/rust-itertools/itertools/issues/878))
- Removed `TakeWhileInclusive::new`
([#&#8203;912](https://togithub.com/rust-itertools/itertools/issues/912))

##### Added

- Added `Itertools::{smallest_by, smallest_by_key, largest, largest_by,
largest_by_key}`
([#&#8203;654](https://togithub.com/rust-itertools/itertools/issues/654),
[#&#8203;885](https://togithub.com/rust-itertools/itertools/issues/885))
- Added `Itertools::tail`
([#&#8203;899](https://togithub.com/rust-itertools/itertools/issues/899))
- Implemented `DoubleEndedIterator` for `ProcessResults`
([#&#8203;910](https://togithub.com/rust-itertools/itertools/issues/910))
- Implemented `Debug` for `FormatWith`
([#&#8203;931](https://togithub.com/rust-itertools/itertools/issues/931))
- Added `Itertools::get`
([#&#8203;891](https://togithub.com/rust-itertools/itertools/issues/891))

##### Changed

- Deprecated `Itertools::group_by` (renamed `chunk_by`)
([#&#8203;866](https://togithub.com/rust-itertools/itertools/issues/866),
[#&#8203;879](https://togithub.com/rust-itertools/itertools/issues/879))
- Deprecated `unfold` (use `std::iter::from_fn` instead)
([#&#8203;871](https://togithub.com/rust-itertools/itertools/issues/871))
- Optimized `GroupingMapBy`
([#&#8203;873](https://togithub.com/rust-itertools/itertools/issues/873),
[#&#8203;876](https://togithub.com/rust-itertools/itertools/issues/876))
- Relaxed `Fn` bounds to `FnMut` in `diff_with,
Itertools::into_group_map_by`
([#&#8203;886](https://togithub.com/rust-itertools/itertools/issues/886))
- Relaxed `Debug/Clone` bounds for `MapInto`
([#&#8203;889](https://togithub.com/rust-itertools/itertools/issues/889))
- Documented the `use_alloc` feature
([#&#8203;887](https://togithub.com/rust-itertools/itertools/issues/887))
- Optimized `Itertools::set_from`
([#&#8203;888](https://togithub.com/rust-itertools/itertools/issues/888))
- Removed badges in `README.md`
([#&#8203;890](https://togithub.com/rust-itertools/itertools/issues/890))
- Added "no-std" categories in `Cargo.toml`
([#&#8203;894](https://togithub.com/rust-itertools/itertools/issues/894))
- Fixed `Itertools::k_smallest` on short unfused iterators
([#&#8203;900](https://togithub.com/rust-itertools/itertools/issues/900))
- Deprecated `Itertools::tree_fold1` (renamed `tree_reduce`)
([#&#8203;895](https://togithub.com/rust-itertools/itertools/issues/895))
- Deprecated `GroupingMap::fold_first` (renamed `reduce`)
([#&#8203;902](https://togithub.com/rust-itertools/itertools/issues/902))
- Fixed `Itertools::k_smallest(0)` to consume the iterator, optimized
`Itertools::k_smallest(1)`
([#&#8203;909](https://togithub.com/rust-itertools/itertools/issues/909))
- Specialized `Combinations::nth`
([#&#8203;914](https://togithub.com/rust-itertools/itertools/issues/914))
- Specialized `MergeBy::fold`
([#&#8203;920](https://togithub.com/rust-itertools/itertools/issues/920))
- Specialized `CombinationsWithReplacement::nth`
([#&#8203;923](https://togithub.com/rust-itertools/itertools/issues/923))
- Specialized `FlattenOk::{fold, rfold}`
([#&#8203;927](https://togithub.com/rust-itertools/itertools/issues/927))
- Specialized `Powerset::nth`
([#&#8203;924](https://togithub.com/rust-itertools/itertools/issues/924))
- Documentation fixes
([#&#8203;882](https://togithub.com/rust-itertools/itertools/issues/882),
[#&#8203;936](https://togithub.com/rust-itertools/itertools/issues/936))
- Fixed `assert_equal` for iterators longer than `i32::MAX`
([#&#8203;932](https://togithub.com/rust-itertools/itertools/issues/932))
- Updated the `must_use` message of non-lazy `KMergeBy` and
`TupleCombinations`
([#&#8203;939](https://togithub.com/rust-itertools/itertools/issues/939))

##### Notable Internal Changes

- Tested iterator laziness
([#&#8203;792](https://togithub.com/rust-itertools/itertools/issues/792))
- Created `CONTRIBUTING.md`
([#&#8203;767](https://togithub.com/rust-itertools/itertools/issues/767))

</details>

<details>
<summary>purpleprotocol/mimalloc_rust (mimalloc)</summary>

###
[`v0.1.42`](https://togithub.com/purpleprotocol/mimalloc_rust/releases/tag/v0.1.42):
Version 0.1.42

[Compare
Source](https://togithub.com/purpleprotocol/mimalloc_rust/compare/v0.1.41...v0.1.42)

##### Changes

-   MiMalloc `v2.1.6`
- Expose `usable_size` and `version`. Credits
[@&#8203;nathaniel-daniel](https://togithub.com/nathaniel-daniel).
- Link with libatomic on armv6-linux. Credits
[@&#8203;notorca](https://togithub.com/notorca).
- Add no_thp option for Linux/Android. Credits
[@&#8203;devnexen](https://togithub.com/devnexen).

</details>

<details>
<summary>napi-rs/napi-rs (napi-derive)</summary>

###
[`v2.16.5`](https://togithub.com/napi-rs/napi-rs/compare/napi-derive@2.16.4...napi-derive@2.16.5)

[Compare
Source](https://togithub.com/napi-rs/napi-rs/compare/napi-derive@2.16.4...napi-derive@2.16.5)

</details>

<details>
<summary>dtolnay/proc-macro2 (proc-macro2)</summary>

###
[`v1.0.84`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.84)

[Compare
Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.83...1.0.84)

- Documentation improvements
([#&#8203;455](https://togithub.com/dtolnay/proc-macro2/issues/455),
thanks
[@&#8203;CensoredUsername](https://togithub.com/CensoredUsername))

###
[`v1.0.83`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.83)

[Compare
Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.82...1.0.83)

- Optimize the representation of `Ident`
([#&#8203;462](https://togithub.com/dtolnay/proc-macro2/issues/462))

</details>

<details>
<summary>serde-rs/serde (serde)</summary>

###
[`v1.0.203`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.203)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.202...v1.0.203)

- Documentation improvements
([#&#8203;2747](https://togithub.com/serde-rs/serde/issues/2747))

###
[`v1.0.202`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.202)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.201...v1.0.202)

- Provide public access to RenameAllRules in serde_derive_internals
([#&#8203;2743](https://togithub.com/serde-rs/serde/issues/2743))

</details>

<details>
<summary>dtolnay/trybuild (trybuild)</summary>

###
[`v1.0.96`](https://togithub.com/dtolnay/trybuild/releases/tag/1.0.96)

[Compare
Source](https://togithub.com/dtolnay/trybuild/compare/1.0.95...1.0.96)

- Support Windows builds that have OUT_DIR prefixed with `\\?\`
([#&#8203;271](https://togithub.com/dtolnay/trybuild/issues/271))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjguMTAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4zNjguMTAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-27 01:48:50 +00:00
Don Isaac
679495c3ec
feat(atom): get &str from Atom<'a> with lifetime of 'a (#3420)
Change `Atom<'a>::as_str(&self) -> &str` to `Atom<'a>::as_str(&self) ->
&'a str`.

This API is more ergonomic for external `oxc` consumers relying on
`&str` data collected while traversing an AST.

I also enhanced some nearby doc comments and implemented some
`From<...>` traits while I was at it.
2024-05-27 09:05:33 +08:00
Dunqing
241e8d1899
feat(transformer/typescript): if the binding exists, the identifier reference is not renamed (#3387)
Related:
https://github.com/oxc-project/oxc/discussions/3251#discussioncomment-9528247
2024-05-27 01:00:04 +00:00
overlookmotel
d4371e8f95
fix(transformer): use UIDs in TS namespace transforms (#3395)
Use the `TraverseCtx::generate_uid` method introduced in #3395 to fix
some of the TS namespace test cases.

But... I honestly have no idea what I'm doing here!

I am running up against a combination of 3 different areas where I know
very little:

1. I am unfamiliar with `Semantic`.
2. I am unfamiliar with Oxc's conventions for writing transforms.
3. I don't "speak" Typescript!

This PR should not be merged as is. I'm pretty sure it's wrong. I've
done it mostly just to test out `generate_uid`.

In particular:

1. Is `SymbolFlags::FunctionScopedVariable` the right flags to use in
all cases here?
2. `generate_uid` creates a symbol, and registers a binding for it in
the scope tree. So if there are any branches in this logic where `name`
doesn't actually get used after `generate_uid` is called, then it's not
right.
3. Identifiers which are added to AST should also have corresponding
`ReferenceId`s created for them (but I imagine this is also missing in
many other places in the transformer).

On point 2: We could split up `generate_uid` into 2 functions. One
function would find a valid UID name *but not register a binding for
it*. If you want to actually use that name, you'd call a 2nd function to
generate the binding. Would that be a better API?

Could someone help me out to progress this please?

(Sorry my lack of knowledge is a bit useless here. I will learn all
these things in time, but just trying to be honest about where I'm at
right now. I'm sure I could figure it out myself, but it would take me
hours, whereas others will probably look at it and know what to do in
about 5 mins.)
2024-05-27 08:53:13 +08:00
Boshen
19bb1c02f2 fix(website): hack schemars to render code snippet in markdown (#3417) 2024-05-26 10:36:53 +00:00
mysteryven
5e06298ec2 fix(linter): memorize visited block id in neighbors_filtered_by_edge_weight (#3407)
closes: #3396

we visit the same node too many times, I picked some result from run require-render-return rule on [timeserieseexploere.js](https://github.com/elastic/kibana/blob/main/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js)

```bash
    NodeIndex(64): 368640,
    NodeIndex(67): 737280,
    NodeIndex(70): 2949120,
    NodeIndex(73): 5971968,
    NodeIndex(76): 11943936,
    NodeIndex(43): 184320,
    NodeIndex(71): 2985984,
    NodeIndex(65): 368640,
    NodeIndex(68): 1474560,
    NodeIndex(74): 5971968,
    NodeIndex(77): 23887872,
    NodeIndex(44): 184320,
    NodeIndex(41): 73728,
    NodeIndex(35): 36864,
    NodeIndex(66): 737280,
    NodeIndex(69): 1474560,
    NodeIndex(72): 2985984,
    NodeIndex(75): 11943936,
```
2024-05-26 08:11:48 +00:00
Boshen
1ad17eaee1 refactor(macros): remove the redundant trie builder (#3415) 2024-05-26 08:00:05 +00:00
Boshen
de75fb2942 refactor: compile less test binaries to speed up CI (#3414)
The semantic crate currently compiles 5 binaries for integration test, this PR merges them into one.
2024-05-26 07:21:44 +00:00
Boshen
21505e885c refactor(cli): move crates/oxc_cli to apps/oxlint (#3413)
We need to split the cli crate up to reduce dependencies,
the current cli crate is pulling in `oxc_prettier`, which is redundant
for the linter.
2024-05-26 05:00:30 +00:00
Boshen
4149d22aa3 chore(cli): remove the regex feature from tracing_subscriber (#3412) 2024-05-26 04:46:25 +00:00
Cameron
a61eef34a6
feat(linter) eslint-plugin-unicorn no magic array flat depth (#3411) 2024-05-26 12:16:24 +08:00
Todor Andonov
14ef4df349
feat(lint/eslint): implement require-await (#3406)
Implements https://eslint.org/docs/latest/rules/require-await.

Related to https://github.com/oxc-project/oxc/issues/479.

---------

Co-authored-by: wenzhe <mysteryven@gmail.com>
2024-05-26 08:57:33 +08:00
Jelle van der Waa
147864cfeb
feat(linter/eslint): Implement no-useless-concat (#3363)
Rule Detail:
[link](https://eslint.org/docs/latest/rules/no-useless-concat)

---

I haven't implemented one condition with the multiline string test case
and honestly I don't really understand why it is allowed? And also not
sure how I would implement that in oxlint.

Another issue is that maybe the output isn't great, the underlining
matches the whole BinaryExpression, for example:
```
+   ╭─[no_useless_concat.tsx:1:1]
+ 1 │ foo + `a` + `b`
+   · ───────────────
```

So maybe instead the diagnostic should get two spans passed, for each
Expression::StringLiteral or Expression::TemplateLiteral, that would
also allow the help text to show that it can be written as `"ab"`.

But an automatic fixxer would be more helpful I reckon :)

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-26 01:52:33 +08:00