Commit graph

4203 commits

Author SHA1 Message Date
Yvan Zhu
51eb8fe46c
Update README.md (#4102)
fix typo
2024-07-08 10:51:29 +08:00
DonIsaac
17292491b4 fix(linter): incorrect fix in no-single-promise-in-promise-methods rule; (#4094)
Closes #4093
2024-07-08 02:34:19 +00:00
renovate[bot]
57d821b93c
chore(deps): update npm packages (#4092)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pnpm](https://pnpm.io) ([source](https://togithub.com/pnpm/pnpm)) |
[`9.4.0` -> `9.5.0`](https://renovatebot.com/diffs/npm/pnpm/9.4.0/9.5.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/pnpm/9.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/pnpm/9.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/pnpm/9.4.0/9.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/pnpm/9.4.0/9.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [wasm-pack](https://togithub.com/rustwasm/wasm-pack) | [`^0.12.1` ->
`^0.13.0`](https://renovatebot.com/diffs/npm/wasm-pack/0.12.1/0.13.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/wasm-pack/0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/wasm-pack/0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/wasm-pack/0.12.1/0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/wasm-pack/0.12.1/0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pnpm/pnpm (pnpm)</summary>

###
[`v9.5.0`](https://togithub.com/pnpm/pnpm/compare/v9.5.0-beta.3...v9.5.0)

[Compare Source](https://togithub.com/pnpm/pnpm/compare/v9.4.0...v9.5.0)

</details>

<details>
<summary>rustwasm/wasm-pack (wasm-pack)</summary>

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

[Compare
Source](https://togithub.com/rustwasm/wasm-pack/compare/v0.12.1...v0.13.0)

-   ###  Features

- **Add option to skip optimization with wasm-opt - [sisou],
[pull/1321]**

This feature introduces the `--no-opt` option to wasm-pack, providing a
significant improvement in build efficiency for projects requiring
multiple wasm-pack executions.

        [pull/1321]: https://togithub.com/rustwasm/wasm-pack/pull/1321

        [sisou]: https://togithub.com/sisou

- **Add support geckodriver for linux-aarch64 - [EstebanBorai],
[pull/1371]**

        Introduces support to download Geckodriver in Linux aarch64.

        [pull/1371]: https://togithub.com/rustwasm/wasm-pack/pull/1371

        [EstebanBorai]: https://togithub.com/EstebanBorai

- **Add wasm-opt linux aarch64 condition - [dkristia], [issue/1392],
[pull/1393]**

A linux aarch64 build for wasm-opt exists in the newest binaryen
versions.

[issue/1392]: https://togithub.com/rustwasm/wasm-pack/issues/1392

        [pull/1393]: https://togithub.com/rustwasm/wasm-pack/pull/1393

        [dkristia]: https://togithub.com/dkristia

-   ### 🤕 Fixes

- **Fix passing relative paths to cargo - [dfaust], [issue/704],
[issue/1156], [issue/1252], [pull/1331]**

When building a crate located in a sub-directory, relative paths, passed
as extra options to cargo (like `--target-dir`), are now handled
correctly.

        [issue/704]: https://togithub.com/rustwasm/wasm-pack/issues/704

[issue/1156]: https://togithub.com/rustwasm/wasm-pack/issues/1156

[issue/1252]: https://togithub.com/rustwasm/wasm-pack/issues/1252

        [pull/1331]: https://togithub.com/rustwasm/wasm-pack/pull/1331

        [dfaust]: https://togithub.com/dfaust

- **Rewrite wasm_target to use target-libdir - [daidoji], [issue/1342],
[pull/1343]**

Rewritten wasm_target to use target libdir from the rustc tool rather
than looking through sysroot. This is to accomodate non-rustup
installations.

[issue/1342]: https://togithub.com/rustwasm/wasm-pack/issues/1342

        [pull/1343]: https://togithub.com/rustwasm/wasm-pack/pull/1343

        [daidoji]: https://togithub.com/daidoji

- **Declare ES module in package.json - [gthb], [issue/1039],
[pull/1061]**

In bundler mode, generate package.json with "type": "module" and use the
"main" attribute instead of the "module" attribute.

This change makes the built ES module palatable to Node.js (when run
with --experimental-vm-modules --experimental-wasm-modules),
while it remains also palatable to webpack as illustrated in
[webpack/webpack#14313](https://togithub.com/webpack/webpack/issues/14313)
(where the pkg subfolder is generated with wasm-pack built with this
change).
This resolves the headache of using a wasm-pack-built package in a
library that one needs to both run directly in Node and include in a
webpack build.

[issue/1039]: https://togithub.com/rustwasm/wasm-pack/issues/1039

        [pull/1061]: https://togithub.com/rustwasm/wasm-pack/pull/1061

        [gthb]: https://togithub.com/gthb

- **Use new chromdriver endpoint and fix CI - [Myriad-Dreamin],
[kade-robertson], [issue/1315], [issue/1390], [pull/1325], [pull/1391]**

[issue/1315]: https://togithub.com/rustwasm/wasm-pack/issues/1315

[issue/1390]: https://togithub.com/rustwasm/wasm-pack/issues/1390

        [pull/1325]: https://togithub.com/rustwasm/wasm-pack/pull/1325

        [pull/1391]: https://togithub.com/rustwasm/wasm-pack/pull/1391

        [Myriad-Dreamin]: https://togithub.com/Myriad-Dreamin

        [kade-robertson]: https://togithub.com/kade-robertson

- **Add mingw support to npm package - [nathaniel-daniel], [issue/1354],
[issue/1359], [pull/1363]**

        Fixes the NPM package's platform detection for mingw.

[issue/1354]: https://togithub.com/rustwasm/wasm-pack/issues/1354

[issue/1359]: https://togithub.com/rustwasm/wasm-pack/issues/1359

        [pull/1363]: https://togithub.com/rustwasm/wasm-pack/pull/1363

        [nathaniel-daniel]: https://togithub.com/nathaniel-daniel

- **pkg-dir option for pack and publish commands - [danielronnkvist],
[issue/1369], [pull/1370]**

To be able to use these commands when the output directory option to the
build command isn't the default pkg.

[issue/1369]: https://togithub.com/rustwasm/wasm-pack/issues/1369

        [pull/1370]: https://togithub.com/rustwasm/wasm-pack/pull/1370

        [danielronnkvist]: https://togithub.com/danielronnkvist

- **Optimize out-dir display - [ahaoboy], [issue/1395], [pull/1396]**

        Optimize out-dir display.

        from:

`[INFO]: 📦 Your wasm pkg is ready to publish at
/root/code/fib-wasm/fib-rs/../fib-wasm/wasm.`

        to:

`[INFO]: 📦 Your wasm pkg is ready to publish at
/root/code/fib-wasm/fib-wasm/wasm.`

[issue/1395]: https://togithub.com/rustwasm/wasm-pack/issues/1395

        [pull/1396]: https://togithub.com/rustwasm/wasm-pack/pull/1396

        [ahaoboy]: https://togithub.com/ahaoboy

-   ### 🛠️ Maintenance
- **Fix error and warnings in install script - [lucashorward],
[issue/1159], [issue/1217], [issue/1283], [pull/1320]**

[issue/1159]: https://togithub.com/rustwasm/wasm-pack/issues/1159

[issue/1217]: https://togithub.com/rustwasm/wasm-pack/issues/1217

[issue/1283]: https://togithub.com/rustwasm/wasm-pack/issues/1283

        [pull/1320]: https://togithub.com/rustwasm/wasm-pack/pull/1320

        [lucashorward]: https://togithub.com/lucashorward

- **Bump follow-redirects from 1.14.9 to 1.15.6 in /npm - [dependabot],
[pull/1375]**

        [pull/1375]: https://togithub.com/rustwasm/wasm-pack/pull/1375

- **Bump rustls-webpki from 0.100.1 to 0.100.2 - [dependabot],
[pull/1323]**

        [pull/1341]: https://togithub.com/rustwasm/wasm-pack/pull/1341

- **Bump rustix from 0.37.20 to 0.37.25 - [dependabot], [pull/1341]**

        [pull/1323]: https://togithub.com/rustwasm/wasm-pack/pull/1323

        [dependabot]: https://togithub.com/apps/dependabot

- **Bump rustls from 0.21.9 to 0.21.11 - [dependabot], [pull/1385]**

        [pull/1385]: https://togithub.com/rustwasm/wasm-pack/pull/1385

        [dependabot]: https://togithub.com/apps/dependabot

- **Bump tar from 6.1.11 to 6.2.1 in /npm - [dependabot], [pull/1379]**

        [pull/1379]: https://togithub.com/rustwasm/wasm-pack/pull/1379

        [dependabot]: https://togithub.com/apps/dependabot

-   ### 📖 Documentation

    -   **Fix typo in README - [Lionelf329], \[pull/1368]**

        [pull/1268]: https://togithub.com/rustwasm/wasm-pack/pull/1368

        [Lionelf329]: https://togithub.com/Lionelf329

- **Add a description of build --target deno - [puxiao], [pull/1344]**

        [pull/1344]: https://togithub.com/rustwasm/wasm-pack/pull/1344

        [puxiao]: https://togithub.com/puxiao

    -   **Document deno in build target - [sigmaSd], [pull/1348]**

        [pull/1348]: https://togithub.com/rustwasm/wasm-pack/pull/1348

        [sigmaSd]: https://togithub.com/sigmaSd

- **Fix local navigation backing one step too far in docs - [SamuSoft],
[pull/1387]**

        [pull/1387]: https://togithub.com/rustwasm/wasm-pack/pull/1387

        [SamuSoft]: https://togithub.com/SamuSoft

- **Add --target web to quick start build command - [josephrocca],
[pull/1367]**

        [pull/1367]: https://togithub.com/rustwasm/wasm-pack/pull/1367

        [josephrocca]: https://togithub.com/josephrocca

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am 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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuOSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-07 18:33:47 +00:00
renovate[bot]
4a49e4cc96
chore(deps): update crate-ci/typos action to v1.23.1 (#4089)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [crate-ci/typos](https://togithub.com/crate-ci/typos) | action | minor
| `v1.22.9` -> `v1.23.1` |

---

### Release Notes

<details>
<summary>crate-ci/typos (crate-ci/typos)</summary>

###
[`v1.23.1`](https://togithub.com/crate-ci/typos/releases/tag/v1.23.1)

[Compare
Source](https://togithub.com/crate-ci/typos/compare/v1.23.0...v1.23.1)

#### \[1.23.1] - 2024-07-05

##### Fixes

- Add missing [June
2024](https://togithub.com/crate-ci/typos/issues/1024) changes

###
[`v1.23.0`](https://togithub.com/crate-ci/typos/releases/tag/v1.23.0)

[Compare
Source](https://togithub.com/crate-ci/typos/compare/v1.22.9...v1.23.0)

#### \[1.23.0] - 2024-07-05

##### Fixes

- Updated the dictionary with the [June
2024](https://togithub.com/crate-ci/typos/issues/1024) changes

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am 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.

🔕 **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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuOSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-07 18:26:02 +00:00
renovate[bot]
ec14168900
chore(deps): update rust crates (#4086)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [oxc-browserslist](https://togithub.com/oxc-project/oxc-browserslist)
| workspace.dependencies | patch | `1.0.1` -> `1.0.2` |
| [oxc_resolver](https://togithub.com/oxc-project/oxc-resolver) |
workspace.dependencies | patch | `1.9.2` -> `1.9.3` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | workspace.dependencies
| patch | `1.0.203` -> `1.0.204` |
| [serde_json](https://togithub.com/serde-rs/json) |
workspace.dependencies | patch | `1.0.119` -> `1.0.120` |
| [trybuild](https://togithub.com/dtolnay/trybuild) |
workspace.dependencies | patch | `1.0.96` -> `1.0.97` |

---

### Release Notes

<details>
<summary>oxc-project/oxc-browserslist (oxc-browserslist)</summary>

###
[`v1.0.2`](https://togithub.com/oxc-project/oxc-browserslist/blob/HEAD/CHANGELOG.md#102---2024-07-01)

[Compare
Source](https://togithub.com/oxc-project/oxc-browserslist/compare/oxc-browserslist-v1.0.1...oxc-browserslist-v1.0.2)

##### Other

- *(deps)* update npm packages
([#&#8203;52](https://togithub.com/oxc-project/oxc-browserslist/pull/52))

</details>

<details>
<summary>oxc-project/oxc-resolver (oxc_resolver)</summary>

###
[`v1.9.3`](https://togithub.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#193---2024-07-03)

[Compare
Source](https://togithub.com/oxc-project/oxc-resolver/compare/oxc_resolver-v1.9.2...oxc_resolver-v1.9.3)

##### Fixed

- tsconfig project reference it self should throw error
([#&#8203;211](https://togithub.com/oxc-project/oxc-resolver/pull/211))

##### Other

- *(napi)* make napi binary smaller with minimal tracing features
([#&#8203;213](https://togithub.com/oxc-project/oxc-resolver/pull/213))
- *(napi)* remove tokio
([#&#8203;212](https://togithub.com/oxc-project/oxc-resolver/pull/212))
- *(deps)* update rust crate dashmap to v6
([#&#8203;209](https://togithub.com/oxc-project/oxc-resolver/pull/209))

</details>

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

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

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

- Apply #\[diagnostic::on_unimplemented] attribute on Rust 1.78+ to
suggest adding serde derive or enabling a "serde" feature flag in
dependencies
([#&#8203;2767](https://togithub.com/serde-rs/serde/issues/2767), thanks
[@&#8203;weiznich](https://togithub.com/weiznich))

</details>

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

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

[Compare
Source](https://togithub.com/serde-rs/json/compare/v1.0.119...v1.0.120)

- Correctly specify required version of `indexmap` dependency
([#&#8203;1152](https://togithub.com/serde-rs/json/issues/1152), thanks
[@&#8203;cforycki](https://togithub.com/cforycki))

</details>

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

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

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

- Normalize number of types listed in *"the following other types
implement trait"* diagnostics
([#&#8203;277](https://togithub.com/dtolnay/trybuild/issues/277))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am 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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuOSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-07 17:13:34 +00:00
michaelm
f8d77e4d7a
fix(isolated_declarations): Infer type of template literal expressions as string (#4068)
In a "non-`const`" context, a template literal string can just be
inferred a `string`. This is consistent with TypeScript's behavior.

Co-authored-by: MichaelMitchell-at <=>
2024-07-08 00:41:33 +08:00
Boshen
5472b7c990
fix(codegen): 256 indentations level is not enough for codegen 2024-07-08 00:25:37 +08:00
Dunqing
7ed27b75f9
perf(isolated-declarations): use FxHashSet instead of Vec to speed up the contain (#4074) 2024-07-08 00:16:25 +08:00
Boshen
6e5447e5d5
chore(coverage): add test for huge binary expression and nested if statements (#4084)
relates https://github.com/oxc-project/backlog/issues/58
2024-07-08 00:15:26 +08:00
Boshen
eb379188da
ci: fix version not set in release_oxlint.yml 2024-07-07 20:12:42 +08:00
github-actions[bot]
0c7f3eecc6
Release oxlint v0.5.3 (#4082)
## [0.5.3] - 2024-07-07

### Features

- 1681b11 linter: Eslint-plugin-jest/consistent-test-it (#4053)
(cinchen)
- 6876490 linter: Add rule no-undefined (#4041) (jordan boyer)
- bf04dee linter: Implement unicorn/no-negation-in-equality-check
(#4034) (Nissim Chekroun)
- aa45604 linter/eslint: Implement no-multi-str (#4038) (Jelle van der
Waa)

### Bug Fixes

- 7b2dc3b linter: Fix panic in import/namespace (#4080) (Boshen)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-07 19:31:03 +08:00
Boshen
0ba375899c
chore(tasks/benchmark): add isolated_declarations bench 2024-07-07 19:22:49 +08:00
Boshen
0ec12cf38d
chore(linter): change no-negation-in-equality-check to pedantic 2024-07-07 19:19:09 +08:00
Boshen
94bac93550
ci: pin cargo-shear to v1 2024-07-07 19:09:00 +08:00
Boshen
7b2dc3b92b fix(linter): fix panic in import/namespace (#4080) 2024-07-07 11:04:20 +00:00
Dunqing
54b3b6c0da
chore(benchmark): add isolated declarations (#4078) 2024-07-07 17:14:48 +08:00
mysteryven
4414774d7d chore(tasks/rulegen): generate options for fix cases (#4076)
Our fixer support rule option, and we need to generate `options` for them.

328445b4ca/crates/oxc_linter/src/tester.rs (L238)

cc @eryue0220
2024-07-07 03:01:55 +00:00
github-actions[bot]
51d56d37ff
Release crates v0.17.1 (#4075)
## [0.17.1] - 2024-07-06

### Bug Fixes

- aa585d3 ast_codegen, ast: Visit `ExpressionArrayElement` as
`Expression`. (#4061) (rzvxa)
- 564a75a codegen: Missing TypeParameters in TSConstructSignature
(#4063) (michaelm)
- adee728 isolated_declarations: Don't report an error for parameters if
they are ObjectPattern or ArrayPattern with an explicit type (#4065)
(michaelm)
- 1b8f208 isolated_declarations: Correct emit for private static methods
(#4064) (michaelm)
- 719fb96 minifier: Omit dce `undefined` which can be a shadowed
variable (#4073) (Boshen)
- 150f4d9 napi/transform: Display error with spanned messages (Boshen)

### Performance

- 7fe2a2f parser: Do not copy comments (#4067) (overlookmotel)

### Refactor

- 8fa98e0 ast: Inline trivial functions and shorten code (#4066)
(overlookmotel)
- 65aee19 isolated-declarations: Reorganize scope tree (#4070) (Luca
Bruno)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-07 01:29:52 +08:00
Boshen
719fb9672b
fix(minifier): omit dce undefined which can be a shadowed variable (#4073)
```
 // Shadowed `undefined` as a variable should not be erased.
    test(
        "function foo(undefined) { if (!undefined) { } }",
        "function foo(undefined){if(!undefined){}}",
    );
```

I'm not using the cheap `ident.reference_id.get().is_some()` here yet
because I don't know what I'm doing - how should minifier consume
`Semantic`?
2024-07-07 01:25:54 +08:00
michaelm
adee7280d7
fix(isolated_declarations): Don't report an error for parameters if they are ObjectPattern or ArrayPattern with an explicit type (#4065)
The logic in https://github.com/oxc-project/oxc/pull/3810 was slightly
off as demonstrated by the snapshot test.

Co-authored-by: MichaelMitchell-at <=>
2024-07-06 22:58:07 +08:00
Luca Bruno
65aee19098
refactor(isolated-declarations): reorganize scope tree (#4070)
This reorganizes scope fields into levels which atomically follow the
enter/leave pattern. It avoids tracking the same lenght and capacity
separately for each property, and does not need to grow multiple vectors
while traversing.
2024-07-06 22:53:00 +08:00
Jelle van der Waa
aa45604bd3
feat(linter/eslint): Implement no-multi-str (#4038)
Rule Detail:
[link](https://eslint.org/docs/latest/rules/no-multi-str)

---------

Co-authored-by: wenzhe <mysteryven@gmail.com>
2024-07-06 22:12:10 +08:00
overlookmotel
7fe2a2f681 perf(parser): do not copy comments (#4067)
Follow-on from #4045. `.from_iter()` copies the `Vec` of comments into another `Vec` before converting to a boxed slice. This copy is unnecessary - just convert direct.
2024-07-06 09:56:41 +00:00
overlookmotel
8fa98e03ae refactor(ast): inline trivial functions and shorten code (#4066)
Follow on from #4045. Mark trivial functions related to `Trivias` as `#[inline]` and remove a couple of unnecessary `matches!` macro calls.
2024-07-06 09:56:36 +00:00
michaelm
564a75ab37
fix(codegen): missing TypeParameters in TSConstructSignature (#4063) 2024-07-06 13:59:49 +08:00
michaelm
1b8f208572
fix(isolated_declarations): correct emit for private static methods (#4064) 2024-07-06 12:30:13 +08:00
cinchen
1681b11adb
feat(linter): eslint-plugin-jest/consistent-test-it (#4053)
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/consistent-test-it.ts)
2024-07-06 11:03:14 +08:00
rzvxa
aa585d31e1
fix(ast_codegen, ast): visit ExpressionArrayElement as Expression. (#4061)
hotfix for #4060

I just added an edge case, We can come back to it later on and make it a
standard in our codegen.

The diff is big because it causes the code to reorder, The edge case
generated code doesn't follow the order in which they are defined in the
source of truth(eg `js.rs`)
2024-07-06 00:29:36 +08:00
Boshen
cdd4ee5dff
ci: cargo-shear v1 2024-07-05 23:46:15 +08:00
Boshen
150f4d90fc
fix(napi/transform): display error with spanned messages 2024-07-05 23:41:39 +08:00
Boshen
74aae108da
chore(minifier): add dce example 2024-07-05 16:23:51 +08:00
github-actions[bot]
224f5ef2cc
Release crates v0.17.0 (#4059)
## [0.17.0] - 2024-07-05

- e32b4bc ast: [**BREAKING**] Store trivia comments in a sorted slice
(#4045) (Luca Bruno)

- 1df6ac0 ast: [**BREAKING**] Rename `visit_enum_memeber` to
`visit_ts_enum_member`. (#4000) (rzvxa)

- 4a0eaa0 ast: [**BREAKING**] Rename `visit_enum` to
`visit_ts_enum_declaration`. (#3998) (rzvxa)

- c98d8aa ast: [**BREAKING**] Rename `visit_arrow_expression` to
`visit_arrow_function_expression`. (#3995) (rzvxa)

### Features

- 1854a52 ast_codegen: Introduce the `#[span]` hint. (#4012) (rzvxa)
- 7538af1 ast_codegen: Add visit generator (#3954) (rzvxa)
- 7768d23 isolated-declarations: Support optional class methods (#4035)
(Egor Blinov)
- 0da9dfb minifier: Add constant folding to remove dead code (#4058)
(Boshen)

### Bug Fixes

- aaac2d8 codegen: Preserve parentheses from AST instead calculating
from operator precedence (#4055) (Boshen)
- 5e5b1b1 codegen: Correct accessibility emit for class
formal-parameters/methods/properties (#4042) (Egor Blinov)
- 7844734 codegen: Missing const keyword in TSTypeParamter (#4022)
(Dunqing)
- 6254a41 codegen: Missing TypeParamters in TSCallSignature (#4021)
(Dunqing)
- 3d29e9c isolated-declarations: Eliminate imports incorrectly when they
are used in `TSInferType` (#4043) (Dunqing)
- 02ea19a isolated-declarations: Should emit `export {}` when only
having `ImportDeclaration` (#4026) (Dunqing)
- 7c915f4 isolated-declarations: Binding elements with export should
report an error (#4025) (Dunqing)
- 05a047c isolated-declarations: Method following an abstract method
gets dropped (#4024) (Dunqing)
- c043bec isolated_declarations: Add mapped-type constraint to the scope
(#4037) (Egor Blinov)
- b007553 isolated_declarations: Fix readonly specifier on class
constructor params (#4030) (Egor Blinov)
- da62839 isolated_declarations: Inferring literal types for readonly
class fileds (#4027) (Egor Blinov)

### Refactor

- b51f75b ast_codegen: No longer outputs discard variable for empty
visitors. (#4008) (rzvxa)
- edb557c minifier: Add a folder struct for constant folding (#4057)
(Boshen)
- 243c9f3 parser: Use function instead of trait to parse list with rest
element (#4028) (Boshen)
- 1dacb1f parser: Use function instead of trait to parse delimited lists
(#4014) (Boshen)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-05 15:46:50 +08:00
Boshen
0da9dfbf09
feat(minifier): add constant folding to remove dead code (#4058) 2024-07-05 15:44:01 +08:00
Boshen
edb557c02b
refactor(minifier): add a folder struct for constant folding (#4057) 2024-07-05 15:11:08 +08:00
Boshen
aaac2d8775
fix(codegen): preserve parentheses from AST instead calculating from operator precedence (#4055)
…operator precedence

Calculating from operator precedence is currently unsafe and will result
incorrect semantics.
2024-07-05 14:01:17 +08:00
jordan boyer
6876490baa
feat(linter): add rule no-undefined (#4041)
Implementing rule https://eslint.org/docs/latest/rules/no-undefined

This is my first time contributing here, I wanted to started with a
simple rule before contributing more.

related to #479
2024-07-04 23:50:46 -04:00
Nissim Chekroun
bf04dee861
feat(linter): implement unicorn/no-negation-in-equality-check (#4034)
Fixes https://github.com/oxc-project/oxc/issues/3869

Hey there, thought I'd give this a try as it's tagged "good first issue"
:) Let me know if there's anything that needs to change, I wasn't sure
about the rule category so left as TODO.
2024-07-04 23:05:47 +08:00
burlinchen
38e7351a91
chore(napi): Refactor async parsing functions to remove tokio dependency (#4049)
Resolves #4044
- Added `use napi::{bindgen_prelude::AsyncTask, Task}` to handle async
tasks without tokio.
- Introduced `ResolveTask` struct implementing `Task` for asynchronous
parsing.
- Replaced `parse_sync` function implementation with `parse_with_return`
to reuse code.
- Refactored `parse_async` to use `AsyncTask` and `ResolveTask` for
async parsing.
- Removed tokio dependency by avoiding `tokio::spawn` and using
`AsyncTask` for async operations.

This refactor enhances code readability and removes the dependency on
tokio, streamlining the async task handling within the napi framework.
2024-07-04 20:31:19 +08:00
Luca Bruno
e32b4bc57c
refactor(ast)!: store trivia comments in a sorted slice (#4045)
This gets rid of `TriviasMap`, introducing `SortedComments` in order to
store trivia comments in a sorted slice.

Closes: https://github.com/oxc-project/backlog/issues/38
2024-07-04 01:57:36 +08:00
Boshen
09cc760475
chore(tasks/benchmark): turn on jsdoc parsing in semantic benchmark 2024-07-04 00:00:52 +08:00
Dunqing
3d29e9cb75 fix(isolated-declarations): eliminate imports incorrectly when they are used in TSInferType (#4043)
close: #4018
2024-07-03 15:32:27 +00:00
Egor Blinov
5e5b1b14a1
fix(codegen): correct accessibility emit for class formal-parameters/methods/properties (#4042) 2024-07-03 17:27:41 +08:00
Egor Blinov
7768d233c6
feat(isolated-declarations): support optional class methods (#4035)
Example class
```
export class A {
  m1?(): void;
  m2(): void {}
}
```

Before the fix:
```
export declare class A {
  m1(): void;
}
```

with the fix:
```
export declare class A {
  m1?(): void;
  m2(): void;
}
```
2024-07-03 09:46:59 +08:00
Egor Blinov
c043bec674
fix(isolated_declarations): add mapped-type constraint to the scope (#4037)
Fixes https://github.com/oxc-project/oxc/issues/4020

Example:
```ts
import {K} from 'foo'
import {T} from 'bar'

export interface I {
    prop: {[key in K]: T}
}
```

Before:
```ts
import {T} from 'bar'
export interface I {
    prop: {[key in K]: T}
}
```

After:
```ts
import {K} from 'foo'
import {T} from 'bar'
export interface I {
    prop: {[key in K]: T}
}
```

TSC:
```ts
import { K } from 'foo';
import { T } from 'bar';
export interface I {
    prop: {
        [key in K]: T;
    };
}

```
2024-07-03 09:45:03 +08:00
Egor Blinov
b007553ebe
fix(isolated_declarations): Fix readonly specifier on class constructor params (#4030) 2024-07-02 23:26:19 +08:00
Egor Blinov
da628399fa
fix(isolated_declarations): inferring literal types for readonly class fileds (#4027) 2024-07-02 23:00:37 +08:00
github-actions[bot]
b66ad0b675
Release oxlint v0.6.0 (#4029)
## [0.6.0] - 2024-07-02

- c98d8aa ast: [**BREAKING**] Rename `visit_arrow_expression` to
`visit_arrow_function_expression`. (#3995) (rzvxa)

### Features

- dc6d45e ast,codegen: Add `TSParenthesizedType` and print type
parentheses correctly (#3979) (Boshen)
- b257d53 linter: Support report
`@typescript-eslint/consistent-type-imports` (#3895) (mysteryven)
- 2114475 linter: Implement @typescript-eslint/no-dynamic-delete (#3971)
(kaykdm)
- 10a3c9a linter/eslint-plugin-react: Implement no-set-state (#3975)
(Jelle van der Waa)

### Bug Fixes

- 432d6d9 linter: Find disabled directives using the message's `Span`.
(#4010) (rzvxa)
- dbbb6fc linter: Global variable check should always check builtin
variables (#3973) (Boshen)

### Performance

- 1eac3d2 semantic: Use `Atom<'a>` for `Reference`s (#3972) (Don Isaac)

### Refactor

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-02 22:07:52 +08:00
Dunqing
02ea19a3b7 fix(isolated-declarations): should emit export {} when only having ImportDeclaration (#4026)
close: #4023
2024-07-02 13:47:30 +00:00
Dunqing
7c915f4665 fix(isolated-declarations): binding elements with export should report an error (#4025)
close: #3976
2024-07-02 13:47:28 +00:00
Dunqing
05a047c17d fix(isolated-declarations): method following an abstract method gets dropped (#4024)
close: #4019
2024-07-02 13:47:26 +00:00