Commit graph

7515 commits

Author SHA1 Message Date
renovate[bot]
11e598ecb1
chore(deps): update rust crates (#8186)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [console](https://redirect.github.com/console-rs/console) |
workspace.dependencies | patch | `0.15.8` -> `0.15.10` |
| [env_logger](https://redirect.github.com/rust-cli/env_logger) |
workspace.dependencies | patch | `0.11.5` -> `0.11.6` |
| [fast-glob](https://redirect.github.com/shulaoda/fast-glob) |
workspace.dependencies | patch | `0.4.0` -> `0.4.3` |
| [glob](https://redirect.github.com/rust-lang/glob) |
workspace.dependencies | patch | `0.3.1` -> `0.3.2` |
|
[oxc-browserslist](https://redirect.github.com/oxc-project/oxc-browserslist)
| workspace.dependencies | patch | `1.1.0` -> `1.1.1` |
| [oxc_resolver](https://redirect.github.com/oxc-project/oxc-resolver) |
workspace.dependencies | patch | `3.0.1` -> `3.0.3` |
| [oxc_sourcemap](https://redirect.github.com/oxc-project/oxc-sourcemap)
| workspace.dependencies | patch | `1.0.5` -> `1.0.6` |
| [quote](https://redirect.github.com/dtolnay/quote) |
workspace.dependencies | patch | `1.0.37` -> `1.0.38` |
| [serde](https://serde.rs)
([source](https://redirect.github.com/serde-rs/serde)) |
workspace.dependencies | patch | `1.0.216` -> `1.0.217` |
| [serde_json](https://redirect.github.com/serde-rs/json) |
workspace.dependencies | patch | `1.0.133` -> `1.0.134` |
| [syn](https://redirect.github.com/dtolnay/syn) |
workspace.dependencies | patch | `2.0.90` -> `2.0.93` |

---

### Release Notes

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

###
[`v0.15.10`](https://redirect.github.com/console-rs/console/releases/tag/0.15.10)

[Compare
Source](https://redirect.github.com/console-rs/console/compare/0.15.9...0.15.10)

#### What's Changed

- Remove MSRV badge from README by
[@&#8203;djc](https://redirect.github.com/djc) in
[https://github.com/console-rs/console/pull/228](https://redirect.github.com/console-rs/console/pull/228)

###
[`v0.15.9`](https://redirect.github.com/console-rs/console/releases/tag/0.15.9)

[Compare
Source](https://redirect.github.com/console-rs/console/compare/0.15.8...0.15.9)

#### What's Changed

- Update dependencies by [@&#8203;djc](https://redirect.github.com/djc)
in
[https://github.com/console-rs/console/pull/227](https://redirect.github.com/console-rs/console/pull/227)

</details>

<details>
<summary>rust-cli/env_logger (env_logger)</summary>

###
[`v0.11.6`](https://redirect.github.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0116---2024-12-20)

[Compare
Source](https://redirect.github.com/rust-cli/env_logger/compare/v0.11.5...v0.11.6)

##### Features

-   Opt-in file and line rendering

</details>

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

###
[`v0.3.2`](https://redirect.github.com/rust-lang/glob/blob/HEAD/CHANGELOG.md#032---2024-12-28)

[Compare
Source](https://redirect.github.com/rust-lang/glob/compare/0.3.1...v0.3.2)

</details>

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

###
[`v1.1.1`](https://redirect.github.com/oxc-project/oxc-browserslist/blob/HEAD/CHANGELOG.md#111---2024-12-14)

[Compare
Source](https://redirect.github.com/oxc-project/oxc-browserslist/compare/oxc-browserslist-v1.1.0...oxc-browserslist-v1.1.1)

##### Other

-   codegen
-   dprint
-   Update README.md
-   *(deps)* update rust crates
-   *(deps)* update rust crates
- *(deps)* update dependency rust to v1.83.0
([#&#8203;78](https://redirect.github.com/oxc-project/oxc-browserslist/issues/78))
-   *(deps)* update rust crates
-   *(deps)* update rust crates to v1.0.215
-   *(deps)* update rust crate thiserror to v2.0.3
-   *(deps)* update rust crate thiserror to v2
-   *(deps)* update rust crates to v1.0.93
-   `cargo autoinherit`
-   *(deps)* update rust crate criterion2 to v2

</details>

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

###
[`v3.0.3`](https://redirect.github.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#303---2024-12-14)

[Compare
Source](https://redirect.github.com/oxc-project/oxc-resolver/compare/oxc_resolver-v3.0.2...oxc_resolver-v3.0.3)

##### <!-- 1 -->Bug Fixes

- try browsers field and alias before resolving directory in
node_modules
([#&#8203;349](https://redirect.github.com/oxc-project/oxc-resolver/issues/349))

###
[`v3.0.2`](https://redirect.github.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#302---2024-12-13)

[Compare
Source](https://redirect.github.com/oxc-project/oxc-resolver/compare/oxc_resolver-v3.0.1...oxc_resolver-v3.0.2)

##### <!-- 1 -->Bug Fixes

- special case for aliasing `@/`
([#&#8203;348](https://redirect.github.com/oxc-project/oxc-resolver/issues/348))
- normalize resolved result on Windows for root
([#&#8203;345](https://redirect.github.com/oxc-project/oxc-resolver/issues/345))

##### <!-- 4 -->Refactor

- replace UnsafeCell with RefCell
([#&#8203;346](https://redirect.github.com/oxc-project/oxc-resolver/issues/346))

</details>

<details>
<summary>oxc-project/oxc-sourcemap (oxc_sourcemap)</summary>

###
[`v1.0.6`](https://redirect.github.com/oxc-project/oxc-sourcemap/blob/HEAD/CHANGELOG.md#106---2024-12-15)

[Compare
Source](https://redirect.github.com/oxc-project/oxc-sourcemap/compare/v1.0.5...v1.0.6)

##### Fixed

- handle non existing token position in visualizer
([#&#8203;14](https://redirect.github.com/oxc-project/oxc-sourcemap/issues/14))

</details>

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

###
[`v1.0.38`](https://redirect.github.com/dtolnay/quote/releases/tag/1.0.38)

[Compare
Source](https://redirect.github.com/dtolnay/quote/compare/1.0.37...1.0.38)

- Support interpolating arrays inside of arrays using a repetition
([#&#8203;286](https://redirect.github.com/dtolnay/quote/issues/286))

</details>

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

###
[`v1.0.217`](https://redirect.github.com/serde-rs/serde/releases/tag/v1.0.217)

[Compare
Source](https://redirect.github.com/serde-rs/serde/compare/v1.0.216...v1.0.217)

- Support serializing externally tagged unit variant inside flattened
field
([#&#8203;2786](https://redirect.github.com/serde-rs/serde/issues/2786),
thanks [@&#8203;Mingun](https://redirect.github.com/Mingun))

</details>

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

###
[`v1.0.134`](https://redirect.github.com/serde-rs/json/releases/tag/v1.0.134)

[Compare
Source](https://redirect.github.com/serde-rs/json/compare/v1.0.133...v1.0.134)

- Add `RawValue` associated constants for literal `null`, `true`,
`false`
([#&#8203;1221](https://redirect.github.com/serde-rs/json/issues/1221),
thanks [@&#8203;bheylin](https://redirect.github.com/bheylin))

</details>

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

###
[`v2.0.93`](https://redirect.github.com/dtolnay/syn/releases/tag/2.0.93)

[Compare
Source](https://redirect.github.com/dtolnay/syn/compare/2.0.92...2.0.93)

- Fix expression parsing edge cases: `x as T <<= y`
([#&#8203;1804](https://redirect.github.com/dtolnay/syn/issues/1804)),
`break as T`
([#&#8203;1805](https://redirect.github.com/dtolnay/syn/issues/1805)),
`match x { _ if .. => {} }`
([#&#8203;1807](https://redirect.github.com/dtolnay/syn/issues/1807))
- Fix expression printing edge cases: `|| -> T 'a: {}`
([#&#8203;1806](https://redirect.github.com/dtolnay/syn/issues/1806)),
`if break x {}`
([#&#8203;1808](https://redirect.github.com/dtolnay/syn/issues/1808),
[#&#8203;1810](https://redirect.github.com/dtolnay/syn/issues/1810))

###
[`v2.0.92`](https://redirect.github.com/dtolnay/syn/releases/tag/2.0.92)

[Compare
Source](https://redirect.github.com/dtolnay/syn/compare/2.0.91...2.0.92)

- Fix parenthesization of jumps inside ranges
([#&#8203;1798](https://redirect.github.com/dtolnay/syn/issues/1798))

###
[`v2.0.91`](https://redirect.github.com/dtolnay/syn/releases/tag/2.0.91)

[Compare
Source](https://redirect.github.com/dtolnay/syn/compare/2.0.90...2.0.91)

- Support parsing `Vec<Arm>` using `parse_quote!`
([#&#8203;1796](https://redirect.github.com/dtolnay/syn/issues/1796),
[#&#8203;1797](https://redirect.github.com/dtolnay/syn/issues/1797))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 11am on monday" in timezone
Asia/Shanghai, Automerge - "before 11am on monday" in timezone
Asia/Shanghai.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

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

---

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

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-12-30 15:25:17 +08:00
Pavel Smirnov
0794bee907
fix(editor/vscode): set minimum supported ver. to ^1.93.0 (#8182)
Hi,

I'm using Cursor which is based on VSCode `1.93` at the moment of this
PR. And i've faced with an issue when i can't install latest version of
oxc vscode plugin - by default plugin marketplace offers me `v0.0.1` and
via `Install Specific Version` i can install only `v0.10.3` while latest
is `v0.15.3`. No idea when Cursor will update its version.
There's no issue with VSCode, only Cursor.

After downgrading minimum version, Cursor allowed me to install plugin
that i compiled by myself, everything seem to be working.

Not sure about how is usually contributions made here so correct me if i
miss something
2024-12-30 15:22:54 +08:00
Anson Heung
47cea9a52d
feat(linter): implement eslint/no-extra-label (#8181)
Implements
[eslint/no-extra-label](https://eslint.org/docs/latest/rules/no-extra-label).

---------

Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-12-29 18:16:24 +00:00
Anson Heung
ef76e288ca
feat(linter): implement eslint/no-multi-assign (#8158)
Implements [eslint/no-multi-assign](https://eslint.org/docs/latest/rules/no-multi-assign)
rule.
2024-12-29 17:15:12 +00:00
Tyler Earls
384858b9ed
feat(linter): implement jsx-a11y/no-noninteractive-tabindex (#8167)
This PR implements the
[jsx-a11y/no-noninteractive-tabindex](91e39b45ad/docs/rules/no-noninteractive-tabindex.md)
rule.

I set the default values as the ones that are in the recommended config.

I used this [html spec
section](https://html.spec.whatwg.org/multipage/dom.html#interactive-content)
to source the interactive elements.

The interactive roles came from [this article in the MDN
docs](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#2._widget_roles).
2024-12-29 17:14:37 +00:00
Yuichiro Yamashita
afc21a6071
feat(linter): implement eslint/vars-on-top (#8157)
implement: https://eslint.org/docs/latest/rules/vars-on-top
2024-12-29 17:13:45 +00:00
Yuichiro Yamashita
a2adc4e832
chore(linter): move no-negated-condition to eslint (#8149)
Moves `unicorn/no-negated-condition` to `eslint/no-negated-condition`

Maps `unicorn/no-negated-condition`to `eslint/no-negated-condition`

docs: https://eslint.org/docs/latest/rules/no-negated-condition
2024-12-29 17:12:51 +00:00
Yuichiro Yamashita
f3050d4f31
fix(linter): exclude svelte files from no_unused_vars rule (#8170) 2024-12-29 17:10:33 +00:00
Boshen
cfb51f2551 refactor(minifier): fuse ast passes (#8184) 2024-12-29 14:57:20 +00:00
Boshen
bf9cafea90
refactor(minifier): clean up peephole_substitute_alternate_syntax a little bit 2024-12-29 20:50:53 +08:00
Boshen
8149e34bf0 feat(minifier): optional catch binding when es target >= es2019 (#8180) 2024-12-29 12:27:33 +00:00
Boshen
41ddf60ab0 feat(minfier): add CompressOptions::target (#8179) 2024-12-29 12:27:32 +00:00
Boshen
ad146bbb90 feat(codegen): print real newline when \n is inside template literals (#8178) 2024-12-29 12:20:47 +00:00
sapphi-red
75d5f17dbd
fix(minifier): minify string PropertyKey (#8177)
#8169 added `if self.in_fixed_loop` in `try_compress_property_key`. Because `exit_property_key` was not called for `PeepholeOptimizations`, `try_compress_property_key` was never called.

refs #8147
2024-12-29 07:49:42 +00:00
sapphi-red
1fa53413e0
test(minifier): port tests from ConvertToDottedPropertiesTest (#8175) 2024-12-29 07:19:13 +00:00
sapphi-red
fc43ec530e
feat(minifier): fold string.length / array.length (#8172) 2024-12-29 07:14:13 +00:00
Boshen
29dc0dc070 feat(minifier): change foo['bar'] -> foo.bar (#8169) 2024-12-29 04:09:42 +00:00
翠 / green
3c5718d68b
feat(minifier): fold typeof foo == undefined into foo == undefined when possible (#8160) 2024-12-29 11:49:57 +08:00
Alexander S.
faf7464733
fix(linter): disable rule react/rules-of-hook by file extension (#8168) 2024-12-28 18:52:10 +00:00
Alexander S.
d8d2ec6257
perf(linter): run rules which require typescript syntax only when source type is actually typescript (#8166) 2024-12-28 17:03:11 +00:00
翠 / green
9d62284202
chore(tasks): print diff for minify idempotency assertion (#8161)
Made the assertion error output more easier to understand.

Example output:

![image](https://github.com/user-attachments/assets/445910fb-b389-4884-b4c5-70a095bc523f)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-29 00:55:45 +08:00
翠 / green
f3a36e1dbf
feat(minifier): fold typeof foo != "undefined" into typeof foo < "u" (#8159) 2024-12-29 00:50:56 +08:00
Yuichiro Yamashita
65796c47a1
feat(linter): implement eslint/prefer-rest-params (#8155)
implement: https://eslint.org/docs/latest/rules/prefer-rest-params
2024-12-28 16:42:01 +00:00
Alexander S.
1171e00a3c
fix(linter): disable react/rules-of-hooks for vue and svelte files (#8165)
because of https://github.com/oxc-project/oxc/issues/8003

I used the FrameworkFlags in hope they are only active in `.vue` and
`.svelte` files.
2024-12-28 16:34:58 +00:00
camc314
1b9a5bae2e fix(linter): false positiver in private member expr in oxc/const-comparison (#8164)
fixes https://github.com/oxc-project/oxc/issues/8163
2024-12-28 13:49:10 +00:00
Boshen
37c9959611 feat(minifier): normalize Infinity into f64::Infinity (#8148) 2024-12-28 06:05:04 +00:00
Yuichiro Yamashita
5234d964fb
feat(linter): implement eslint/no-nested-ternary (#8150)
implement: https://eslint.org/docs/latest/rules/no-nested-ternary

---------

Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-12-27 23:44:44 +00:00
Anson Heung
1c5db72986
feat(linter): implement eslint/no-labels (#8131)
Implements [eslint/no-labels](https://eslint.org/docs/latest/rules/no-labels) rule.

Part of #479
2024-12-27 15:30:14 +00:00
Boshen
8fb71f518f feat(minifier): minify string PropertyKey (#8147) 2024-12-27 15:09:41 +00:00
camc314
79af10070d fix(semantic): reference flags not correctly resolved when after an export stmt (#8134)
fixes https://github.com/oxc-project/oxc/issues/7879#issuecomment-2562574889

TLDR is curently here:

cdd121bfa4/crates/oxc_semantic/src/builder.rs (L2130-L2135)

`self.current_reference_flags.is_empty()` is not empty, which causes the current ref flags to be used (this is incorrect, we should be using a fresh version of reference flags). Buy setting ref flags to `None` on exit export node, this issue is avoided

`export` **BEFORE** the reference ( incorrect reference flags)

https://playground.oxc.rs/#eNpVjjuOwzAMRK8isElj7A/YxtttkVOkkR3aECCJBskkdgzdPZISG0ilGc3DcFbooQUXJmI1q/m3bJIZmII5fHx2lg9/p4hzTXWZsCL3N+RekB3qvRUxRyKDs2I8S61cEzRA0K7Al1geWaLaGVrlCzbgXdRNS08T7mYJHfnNKdsoA3GAdrBeMDUwWRbk3Jh1adn0jtYPUMsj5hOA8vP1/QuZ6OmMI5Yx2QQX3eCebLBx9K8FlYvK5I+ebiW9InckOX4uSOkBCrdvkw==

`export` **AFTER** the reference ( correct reference flags)

https://playground.oxc.rs/#eNpVjj2uwjAQhK9ibZMmen/Sa0JHwSlonLCJLNm70a6BhMh3xzEEQeUZz6fZWaCDBlwYWaJZzN6KSaYXDqb6+m6tVLsjHQmnknfeqpoDs8EpIp208Et6Q+I8Yum5ffTcqh3UwNAsIGdaH50p2gmaKGeswTuKm9aOR3yZObTsNxfFkvYsAZreesVUw2hFUXJj1mvLpl9o+YBoZcB8AlD/fn7/IRMdn3DAdUw2wZHr3YMNlgb/XFA4isL+4Pm6pheUljXHjwUp3QEtmnBd

this PR fixes this issue by resetting the reference flags after exising an export stmt
2024-12-27 14:20:17 +00:00
翠 / green
74572de625
fix(ecmascript): incorrect to_int_32 value for Infinity (#8144)
https://tc39.es/ecma262/#sec-toint32
Infinity should return `0` when passed to `ToInt32` abstract operation.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-27 21:48:25 +08:00
翠 / green
6615e1ea93
feat(minifier): constant fold instanceof (#8142) 2024-12-27 21:45:31 +08:00
Boshen
75264ed7d6 refactor(minifier): clean up try_optimize_block (#8139) 2024-12-27 06:46:21 +00:00
Boshen
2b2a37347c feat(minifier): minimize a + 'b' + 'c' -> a + 'bc' (#8137) 2024-12-27 05:46:51 +00:00
Boshen
213364a400 feat(minifier): minimize if (x) if (y) z -> if (x && y) z (#8136) 2024-12-27 02:44:47 +00:00
Boshen
ad61e70186 fix(codegen): print if else without block with proper indentation (#8135) 2024-12-27 00:39:52 +00:00
Boshen
6b51e6dff1 feat(minifier): minimize if(foo) bar else baz -> foo ? bar : baz (#8133) 2024-12-26 16:21:34 +00:00
Boshen
f615bfa773 feat(minifier): minimize if (x) return; return 1 -> return x ? void 0 : 1 (#8130) 2024-12-26 15:36:25 +00:00
Yuichiro Yamashita
04c7d38287
chore(semantic): use assert_eq! instead of assert! (crates/oxc_semantic/src/scope.rs) (#8128)
related to https://github.com/oxc-project/oxc/pull/8124
2024-12-26 22:14:33 +08:00
Yuichiro Yamashita
eb0f57f40f
chore(semantic): use assert_eq! instead of assert! (crates/oxc_semantic/src/lib.rs) (#8127)
related to https://github.com/oxc-project/oxc/pull/8124
2024-12-26 13:54:21 +00:00
Yuichiro Yamashita
e676fdfd83
chore(tasks): use assert_eq! instead of assert! (tasks/minsize/src/lib.rs) (#8129)
related to https://github.com/oxc-project/oxc/pull/8124
2024-12-26 13:54:05 +00:00
Yuichiro Yamashita
093ddd6f4d
chore(ast): use assert_eq! instead of assert! (crates/oxc_ast/src/lib.rs) (#8125)
related to https://github.com/oxc-project/oxc/pull/8124
2024-12-26 13:52:55 +00:00
Yuichiro Yamashita
777e13c534
chore(linter): use assert_eq! instead of assert! (#8124)
This ensures that both the expected and actual values are printed in the
log when the test fails.
2024-12-26 20:21:01 +08:00
Boshen
f0b1ee5a06 feat(minifier): minimize if(!x) foo() -> x || foo() (#8122) 2024-12-26 09:42:34 +00:00
Boshen
f8200a8882 feat(minifier): minimize if(foo) bar -> foo && bar (#8121) 2024-12-26 09:01:38 +00:00
Boshen
72d996709e feat(minifier): add Normalize ast pass (#8120) 2024-12-26 07:02:45 +00:00
Boshen
fef0b25fd3 feat(minifier): collapse var into for loop initializer (#8119)
`var a = 0; for(;a<0;a++) {}` => `for(var a = 0;a<0;a++) {}`
2024-12-26 05:22:02 +00:00
Boshen
c22062bab3 refactor(minifier): cleanup peephole_minimize_conditions (#8114) 2024-12-25 15:47:42 +00:00
Boshen
2331ea85d9 feat(minifier): typeof foo === 'number' => typeof foo == 'number' (#8112) 2024-12-25 14:52:58 +00:00
Boshen
e594c3988d refactor(minifier): clean up peephole_substitute_alternate_syntax.rs (#8111) 2024-12-25 13:54:51 +00:00