Cameron
7da9a39b5d
fix(rulegen): update lint rule template ( #7502 )
2024-11-27 17:40:38 +08:00
camc314
60b28fc23a
feat(linter): implement typescript/consistent-generic-constructors ( #7497 )
2024-11-27 09:21:08 +00:00
leaysgur
32c7db0ec6
chore(tasks): Update prettier_conformance task ( #7500 )
...
- Update Prettier version: `3.3.3` > `3.4.1`
- Add more ignored tests
- Add `jsx` tests
- Remove unused `runner.rs`
- Refactoring
2024-11-27 08:40:43 +00:00
camc314
bd0693bcd0
feat(linter): allow lint rules with the same name ( #7496 )
...
Apologies @Boshen for the stupidly large diff.
I've done the following:
- `RuleEnum`'s members are now prefixed with the plugin name. e.g. `NoDebugger` has become `EslintNoDebugger`
- updated tester.rs to accept the rule's NAME, CATEGORY to allow us to test rules with the same name (diff category)
- updates `declare_all_lint_rules` satisfy the first above change.
2024-11-27 04:25:05 +00:00
overlookmotel
bd2ce025c3
test(transformer): fix fixtures updating script ( #7499 )
...
Script to update fixtures for class properties transform was failing to transform fixtures where output is `output.mjs` (instead of `output.js`). This PR fixes that.
2024-11-27 02:38:00 +00:00
Dunqing
fed8327441
test(semantic): add a test for UpdateExpression ( #7495 )
...
related: https://github.com/oxc-project/oxc/pull/7388#issuecomment-2496044394
2024-11-27 02:00:52 +00:00
Dunqing
4b0720aabb
test(semantic): re-organize snapshot-based tests ( #7494 )
...
Reorignize tests by splitting tests to js, ts, and jsx folders
2024-11-27 02:00:50 +00:00
Dunqing
ef62b9dacc
refactor(transformer/react-refresh): use generate_uid_in_current_hoist_scope to add hoisted binding ( #7492 )
2024-11-26 16:12:11 +00:00
overlookmotel
488029ea24
test(transformer/async-to-generator): failing test for nested supers ( #7314 )
...
Failing test for async-to-generator transform.
When exiting a function which has `super` bindings, need to restore previous state of `super_methods`. It probably needs to be a stack. But not sure if `renamed_arguments_symbol_ids` needs to be a stack too? I don't really understand this transform, so am not attempting to fix myself.
[Babel REPL](https://babeljs.io/repl#?browsers=ie%2011&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=MYewdgzgLgBCCuUCmAnGBeGBvAUDGAbgIYA28SAXDAAwA0eMREAnmMDALZJQAWIAJgAoAlNgb4RGAHwwI8AA6oAdMTJIA3DnExQkWAEswYVBjH5zhUuSp1t-Jq3ZdeAybgsXJ6GXMUoVVhp2MAC-2iGa2l4-Csqq5Jr4YRE4QA&debug=false&forceAllTransforms=false&modules=commonjs&shippedProposals=false&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=&prettier=true&targets=&version=7.26.2&externalPlugins=%40babel%2Fplugin-external-helpers%407.25.9%2C%40babel%2Fplugin-transform-async-to-generator%407.25.9&assumptions=%7B%7D )
2024-11-26 15:54:07 +00:00
overlookmotel
f3850eb53b
fix(semantic): correctly resolve binding for return type of functions ( #6388 )
...
Fixes #6387 .
2024-11-26 15:43:35 +00:00
Boshen
b0e1c03284
feat(ast)!: add StringLiteral::raw field ( #7393 )
...
part of #7254
2024-11-26 23:33:56 +08:00
7086cmd
97af341cac
feat(minifier): minify alternated one child if block ( #7231 )
2024-11-26 15:00:16 +00:00
camc314
2ac9f963df
feat(linter): typescript/no-inferrable-types ( #7438 )
2024-11-26 14:49:31 +00:00
Ethan Goh
ac0d25c426
feat(minifier): minify one child if statement expression ( #7230 )
2024-11-26 22:48:27 +08:00
Boshen
c133693e5c
perf(minifier): fuse ast passes ( #7493 )
2024-11-26 14:30:04 +00:00
Dunqing
58a125ff88
fix(transformer/async-to-generator): correct the SymbolFlags of function id in module ( #7470 )
2024-11-26 11:59:22 +00:00
Dunqing
37842c166d
fix(transformer/object-rest-spread): generate catch variable binding with correct SymbolFlags ( #7469 )
2024-11-26 11:59:21 +00:00
overlookmotel
199076bd14
fix(transformer/class-properties): transform private property accesses in static prop initializers ( #7483 )
...
Transform private property accesses in static prop initializers. e.g.:
Input:
```js
class C {
static #x = 123;
static y = this.#x;
}
```
Transformed:
```js
class C {}
var _x = { _: 123 };
babelHelpers.defineProperty(C, "y", babelHelpers.assertClassBrand(C, C, _x)._);
```
`this.#x` has been transformed to `babelHelpers.assertClassBrand(C, C, _x)._`.
2024-11-26 11:36:09 +00:00
overlookmotel
5ca6eea77e
perf(transformer/class-properties): inline visitor methods ( #7485 )
...
Inline visitor methods in class properties transform.
2024-11-26 11:36:09 +00:00
7086cmd
24189f28ad
feat(ecma): implement array join method ( #6936 )
2024-11-26 11:28:07 +00:00
Dunqing
9c9deaeffe
feat(traverse): add generate_uid_in_current_hoist_scope method ( #7423 )
...
Add an API to handle variable hoisting.
2024-11-26 11:21:36 +00:00
Boshen
4f23689e79
chore(CODEOWNERS): add @leaysgur to oxc_prettier and oxc_regular_expression
2024-11-26 19:19:56 +08:00
leaysgur
3a1ef6a230
refactor(prettier): Refactor IR related macros ( #7491 )
...
- Remove `format!` macro
- Rename string related macros, `&'static`: `text!` and `'a`: `dynamic_text!`
- Apply `wrap!` macro instead of manually using `enter|leave_node`
- Introduce `/ir` directory and move `Doc`, `impl Display`, `DocBuilder`, etc.
I'm not yet determined how to, how deep to use macro, but this is first stepping stone... 🥌
2024-11-26 09:31:30 +00:00
tbashiyy
8d89fdc886
feat(linter): add eslint/prefer-spread ( #7112 )
...
In this PR,
- move existing `unicorn:prefer-spread` to `eslint:prefer-spread`.
- combine 2 rules from `eslint:prefer-spread` and
`unicorn:prefer-spread`
([This is already talked in
discord](https://discord.com/channels/1079625926024900739/1080712072012238858/1299981398064496652 ))
---------
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-26 17:30:38 +08:00
Boshen
cd7f62b311
chore(Cargo.toml): remove incremental = true because it uses too much disk space
2024-11-26 16:04:56 +08:00
Boshen
17c0dd8fb2
fix(linter): fix jsx_no_script_url doc failed to build
...
"Element is missing end tag."
2024-11-26 16:03:14 +08:00
oxc-bot
861ae1581a
release(oxlint): v0.13.2 ( #7489 )
2024-11-26 15:25:31 +08:00
oxc-bot
00a7372eaf
release(crates): v0.38.0 ( #7490 )
2024-11-26 14:38:47 +08:00
Boshen
45ef3eb2be
chore(transformer): disable class properties transform from the target API ( #7487 )
2024-11-26 06:10:35 +00:00
Boshen
713e210012
chore(transformor): disable class properties transform ( #7486 )
...
The plugin is not ready.
2024-11-26 03:47:46 +00:00
Alexander S.
571d7e2419
fix(language_server): calculate correct column when Unicode chars ( #7484 )
...
Before:

After:

Closes #3625
2024-11-26 10:44:13 +08:00
Guillaume Piedigrossi
87c893fb49
feat(linter): add the eslint/no_duplicate_imports rule ( #7309 )
2024-11-25 20:56:29 +00:00
overlookmotel
e5d49db360
refactor(transformer/class-properties): placeholder method for transforming private field assignment patterns ( #7482 )
...
Add a no-op placeholder method for transforming private fields as `AssignmentPattern`s. e.g. `[object.#prop] = []`.
Implementation will be added later.
2024-11-25 20:10:07 +00:00
overlookmotel
97de0b7be1
fix(transformer/class-properties): transform this in static prop initializers ( #7481 )
...
Convert `this` in static property initializers to reference to class name.
`class C { static prop = this; }` -> `class C {}; C.prop = C;`
2024-11-25 20:10:05 +00:00
overlookmotel
d2745df3bc
fix(transformer/class-properties): stop searching for super() in TSModuleBlocks ( #7480 )
...
Fix edge case in class static properties transform. When transforming `super()` in class constructor, stop searching when hit a `TSModuleBlock`. `TSModuleBlock` is essentially a function, so `super()` there is invalid.
2024-11-25 20:10:03 +00:00
overlookmotel
2a5954ae71
docs(transformer/class-properties): document transform options ( #7478 )
...
Add docs for the `loose` option / `set_public_class_fields` assumption.
2024-11-25 17:17:28 +00:00
overlookmotel
abb0e0e08e
refactor(transformer/class-properties): rename var ( #7477 )
...
Pure refactor. Name var more descriptively.
2024-11-25 16:45:21 +00:00
renovate
17fb7e5303
chore(deps): update rust crates ( #7467 )
...
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [allocator-api2](https://redirect.github.com/zakarumych/allocator-api2 ) | workspace.dependencies | patch | `0.2.18` -> `0.2.20` |
| [flate2](https://redirect.github.com/rust-lang/flate2-rs ) | workspace.dependencies | patch | `1.0.34` -> `1.0.35` |
| [itoa](https://redirect.github.com/dtolnay/itoa ) | workspace.dependencies | patch | `1.0.11` -> `1.0.13` |
| [oxc_resolver](https://redirect.github.com/oxc-project/oxc-resolver ) | workspace.dependencies | minor | `2.0.0` -> `2.1.1` |
| [proc-macro2](https://redirect.github.com/dtolnay/proc-macro2 ) | workspace.dependencies | patch | `1.0.89` -> `1.0.92` |
| [serde](https://serde.rs ) ([source](https://redirect.github.com/serde-rs/serde )) | workspace.dependencies | patch | `1.0.214` -> `1.0.215` |
| [serde_json](https://redirect.github.com/serde-rs/json ) | workspace.dependencies | patch | `1.0.132` -> `1.0.133` |
| [tempfile](https://stebalien.com/projects/tempfile-rs/ ) ([source](https://redirect.github.com/Stebalien/tempfile )) | workspace.dependencies | minor | `3.13.0` -> `3.14.0` |
| [tokio](https://tokio.rs ) ([source](https://redirect.github.com/tokio-rs/tokio )) | workspace.dependencies | patch | `1.41.0` -> `1.41.1` |
| [url](https://redirect.github.com/servo/rust-url ) | workspace.dependencies | patch | `2.5.3` -> `2.5.4` |
---
### Release Notes
<details>
<summary>rust-lang/flate2-rs (flate2)</summary>
### [`v1.0.35`](https://redirect.github.com/rust-lang/flate2-rs/releases/tag/1.0.35 ): - security update to zlib-rs
[Compare Source](https://redirect.github.com/rust-lang/flate2-rs/compare/1.0.34...1.0.35 )
#### What's Changed
- Upgrade actions/upload-artifact by [@​jdno](https://redirect.github.com/jdno ) in [https://github.com/rust-lang/flate2-rs/pull/438 ](https://redirect.github.com/rust-lang/flate2-rs/pull/438 )
- upgrade zlib-rs to version `0.4.0` by [@​folkertdev](https://redirect.github.com/folkertdev ) in [https://github.com/rust-lang/flate2-rs/pull/439 ](https://redirect.github.com/rust-lang/flate2-rs/pull/439 )
#### New Contributors
- [@​jdno](https://redirect.github.com/jdno ) made their first contribution in [https://github.com/rust-lang/flate2-rs/pull/438 ](https://redirect.github.com/rust-lang/flate2-rs/pull/438 )
**Full Changelog**: https://github.com/rust-lang/flate2-rs/compare/1.0.34...1.0.35
</details>
<details>
<summary>dtolnay/itoa (itoa)</summary>
### [`v1.0.13`](https://redirect.github.com/dtolnay/itoa/releases/tag/1.0.13 )
[Compare Source](https://redirect.github.com/dtolnay/itoa/compare/1.0.12...1.0.13 )
- Code cleanup ([#​48](https://redirect.github.com/dtolnay/itoa/issues/48 ), [#​49](https://redirect.github.com/dtolnay/itoa/issues/49 ), [#​50](https://redirect.github.com/dtolnay/itoa/issues/50 ), [#​51](https://redirect.github.com/dtolnay/itoa/issues/51 ), [#​52](https://redirect.github.com/dtolnay/itoa/issues/52 ), [#​53](https://redirect.github.com/dtolnay/itoa/issues/53 ), [#​54](https://redirect.github.com/dtolnay/itoa/issues/54 ), [#​55](https://redirect.github.com/dtolnay/itoa/issues/55 ))
### [`v1.0.12`](https://redirect.github.com/dtolnay/itoa/releases/tag/1.0.12 )
[Compare Source](https://redirect.github.com/dtolnay/itoa/compare/1.0.11...1.0.12 )
- Add itoa::Integer::MAX_STR_LEN associated constant ([#​45](https://redirect.github.com/dtolnay/itoa/issues/45 ), thanks [@​SUPERCILEX](https://redirect.github.com/SUPERCILEX ))
</details>
<details>
<summary>oxc-project/oxc-resolver (oxc_resolver)</summary>
### [`v2.1.1`](https://redirect.github.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#211---2024-11-22 )
[Compare Source](https://redirect.github.com/oxc-project/oxc-resolver/compare/oxc_resolver-v2.1.0...oxc_resolver-v2.1.1 )
##### Performance
- reduce hash while resolving package.json ([#​319](https://redirect.github.com/oxc-project/oxc-resolver/pull/319 ))
- reduce memory allocation while normalizing package path ([#​318](https://redirect.github.com/oxc-project/oxc-resolver/pull/318 ))
- reduce memory allocation while resolving package.json ([#​317](https://redirect.github.com/oxc-project/oxc-resolver/pull/317 ))
- use `path.as_os_str().hash()` instead of `path.hash()` ([#​316](https://redirect.github.com/oxc-project/oxc-resolver/pull/316 ))
- reduce memory allocation by using a thread_local path for path methods ([#​315](https://redirect.github.com/oxc-project/oxc-resolver/pull/315 ))
##### Other
- remove the deprecated simdutf8 aarch64\_neon feature
- mention extension must start with a `.` in `with_extension` ([#​313](https://redirect.github.com/oxc-project/oxc-resolver/pull/313 ))
### [`v2.1.0`](https://redirect.github.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#210---2024-11-20 )
[Compare Source](https://redirect.github.com/oxc-project/oxc-resolver/compare/oxc_resolver-v2.0.1...oxc_resolver-v2.1.0 )
##### Added
- add `Resolver::resolve_tsconfig` API ([#​312](https://redirect.github.com/oxc-project/oxc-resolver/pull/312 ))
##### Fixed
- don't panic when resolving `/` with `roots` ([#​310](https://redirect.github.com/oxc-project/oxc-resolver/pull/310 ))
- use same UNC path normalization logic with libuv ([#​306](https://redirect.github.com/oxc-project/oxc-resolver/pull/306 ))
##### Other
- *(deps)* update rust crates to v1.0.215
- fix symlink test init on windows ([#​307](https://redirect.github.com/oxc-project/oxc-resolver/pull/307 ))
### [`v2.0.1`](https://redirect.github.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#201---2024-11-08 )
[Compare Source](https://redirect.github.com/oxc-project/oxc-resolver/compare/oxc_resolver-v2.0.0...oxc_resolver-v2.0.1 )
##### Other
- `cargo upgrade` && `pnpm upgrade`
- bring back the symlink optimization ([#​298](https://redirect.github.com/oxc-project/oxc-resolver/pull/298 ))
- *(deps)* update rust crate criterion2 to v2
</details>
<details>
<summary>dtolnay/proc-macro2 (proc-macro2)</summary>
### [`v1.0.92`](https://redirect.github.com/dtolnay/proc-macro2/releases/tag/1.0.92 )
[Compare Source](https://redirect.github.com/dtolnay/proc-macro2/compare/1.0.91...1.0.92 )
- Improve compiler/fallback mismatch panic message ([#​487](https://redirect.github.com/dtolnay/proc-macro2/issues/487 ))
### [`v1.0.91`](https://redirect.github.com/dtolnay/proc-macro2/releases/tag/1.0.91 )
[Compare Source](https://redirect.github.com/dtolnay/proc-macro2/compare/1.0.90...1.0.91 )
- Fix panic *"compiler/fallback mismatch 949"* when using TokenStream::from_str from inside a proc macro to parse a string containing doc comment ([#​484](https://redirect.github.com/dtolnay/proc-macro2/issues/484 ))
### [`v1.0.90`](https://redirect.github.com/dtolnay/proc-macro2/releases/tag/1.0.90 )
[Compare Source](https://redirect.github.com/dtolnay/proc-macro2/compare/1.0.89...1.0.90 )
- Improve error recovery in TokenStream's and Literal's FromStr implementations to work around [https://github.com/rust-lang/rust/issues/58736 ](https://redirect.github.com/rust-lang/rust/issues/58736 ) such that rustc does not poison compilation on codepaths that should be recoverable errors ([#​477](https://redirect.github.com/dtolnay/proc-macro2/issues/477 ), [#​478](https://redirect.github.com/dtolnay/proc-macro2/issues/478 ), [#​479](https://redirect.github.com/dtolnay/proc-macro2/issues/479 ), [#​480](https://redirect.github.com/dtolnay/proc-macro2/issues/480 ), [#​481](https://redirect.github.com/dtolnay/proc-macro2/issues/481 ), [#​482](https://redirect.github.com/dtolnay/proc-macro2/issues/482 ))
</details>
<details>
<summary>serde-rs/serde (serde)</summary>
### [`v1.0.215`](https://redirect.github.com/serde-rs/serde/releases/tag/v1.0.215 )
[Compare Source](https://redirect.github.com/serde-rs/serde/compare/v1.0.214...v1.0.215 )
- Produce warning when multiple fields or variants have the same deserialization name ([#​2855](https://redirect.github.com/serde-rs/serde/issues/2855 ), [#​2856](https://redirect.github.com/serde-rs/serde/issues/2856 ), [#​2857](https://redirect.github.com/serde-rs/serde/issues/2857 ))
</details>
<details>
<summary>serde-rs/json (serde_json)</summary>
### [`v1.0.133`](https://redirect.github.com/serde-rs/json/releases/tag/v1.0.133 )
[Compare Source](https://redirect.github.com/serde-rs/json/compare/v1.0.132...v1.0.133 )
- Implement From<\[T; N]> for serde_json::Value ([#​1215](https://redirect.github.com/serde-rs/json/issues/1215 ))
</details>
<details>
<summary>Stebalien/tempfile (tempfile)</summary>
### [`v3.14.0`](https://redirect.github.com/Stebalien/tempfile/blob/HEAD/CHANGELOG.md#3140 )
[Compare Source](https://redirect.github.com/Stebalien/tempfile/compare/v3.13.0...v3.14.0 )
- Make the wasip2 target work (requires tempfile's "nightly" feature to be enabled). [#​305](https://redirect.github.com/Stebalien/tempfile/pull/305 ).
- Allow older windows-sys versions [#​304](https://redirect.github.com/Stebalien/tempfile/pull/304 ).
</details>
<details>
<summary>tokio-rs/tokio (tokio)</summary>
### [`v1.41.1`](https://redirect.github.com/tokio-rs/tokio/releases/tag/tokio-1.41.1 ): Tokio v1.41.1
[Compare Source](https://redirect.github.com/tokio-rs/tokio/compare/tokio-1.41.0...tokio-1.41.1 )
### 1.41.1 (Nov 7th, 2024)
##### Fixed
- metrics: fix bug with wrong number of buckets for the histogram ([#​6957])
- net: display `net` requirement for `net::UdpSocket` in docs ([#​6938])
- net: fix typo in `TcpStream` internal comment ([#​6944])
[#​6957]: https://redirect.github.com/tokio-rs/tokio/pull/6957
[#​6938]: https://redirect.github.com/tokio-rs/tokio/pull/6938
[#​6944]: https://redirect.github.com/tokio-rs/tokio/pull/6944
</details>
<details>
<summary>servo/rust-url (url)</summary>
### [`v2.5.4`](https://redirect.github.com/servo/rust-url/releases/tag/v2.5.4 )
[Compare Source](https://redirect.github.com/servo/rust-url/compare/v2.5.3...v2.5.4 )
##### What's Changed
- Revert "Normalize URL paths: convert /.//p, /..//p, and //p to p ([#​943](https://redirect.github.com/servo/rust-url/issues/943 ))" by [@​valenting](https://redirect.github.com/valenting ) in [https://github.com/servo/rust-url/pull/999 ](https://redirect.github.com/servo/rust-url/pull/999 )
- Updates the MSRV to 1.63 required though the libc v0.2.164 dependency
**Full Changelog**: https://github.com/servo/rust-url/compare/v2.5.3...v2.5.4
</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 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2024-11-25 16:10:34 +00:00
Boshen
ed6a69e2db
chore(coverage): update runtime.snap
2024-11-25 22:36:05 +08:00
overlookmotel
25823c8529
refactor(transformer/class-properties): safer use of GetAddress ( #7474 )
...
Avoid using `Address::from_ptr`, which is error-prone.
2024-11-25 14:25:27 +00:00
overlookmotel
3396b69379
refactor(transformer/exponentiation-operator): correct comment ( #7476 )
...
Follow-on after #7410 . Update comment to reflect the changed logic.
2024-11-25 14:16:22 +00:00
overlookmotel
10ea830651
style(traverse): fix indentation in codegen ( #7475 )
2024-11-25 13:19:19 +00:00
overlookmotel
eb70219821
feat(ast): derive GetAddress on all enum types ( #7472 )
...
Implement `GetAddress` on all AST enums where all variants are boxed. Part of #7339 .
2024-11-25 12:13:44 +00:00
Dunqing
d7d073578d
refactor(semantic): remove SymbolFlags::TypeLiteral ( #7415 )
2024-11-25 11:34:34 +00:00
jordan boyer
79ab8cca0e
feat(lint-unicorn): add rule prefer set has ( #7075 )
...
implementing the rule [prefer set
has](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md )
from unicorn.
I put the fix as dangerous fix because they was no test for the fix on
the unicorn part. I did add some test for this but i'm not sure that i'm
covering everything.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-25 19:33:51 +08:00
overlookmotel
a68a2172d2
refactor(ast_tools): move prelude above derive in Derives ( #7471 )
...
Pure refactor. Prelude is printed first, so it makes sense to define it first.
2024-11-25 11:08:31 +00:00
Jelle van der Waa
7236d14dc8
feat(eslint/jsx_a11y): implement anchor_ambiguous_text ( #5729 )
...
Co-authored-by: Cameron Clark <cameron.clark@hey.com>
2024-11-25 11:07:36 +00:00
overlookmotel
111d722fe1
style(transformer/optional-chaining): code style nit ( #7468 )
2024-11-25 10:51:42 +00:00
Dunqing
e26916ceae
perf(transformer/optional-chaining): mark enter_expression as inline ( #7390 )
2024-11-25 18:31:35 +08:00
overlookmotel
9778298fdb
feat(transformer): class properties transform ( #7011 )
...
Add class properties transform.
Implementation is incomplete. Notable missing parts:
* Scopes are not updated where property initializers move from class body into class constructor / `_super` function.
* Does not handle binding shadowing problems when property initializers move from class body into class constructor.
* `this` and references to class name in static property initializers need to be transformed to point to a temp var.
* Not all usages of private properties are supported (see below).
* Code which is moved to outside of class body is not transformed by other transforms for class declarations (works OK for class expressions). This includes static property initializers, static blocks, and computed property/method keys.
* Only basic checks for whether computed property/method keys may have side effects.
* Numerous other small issues noted in TODO comments through the code.
### Private properties
Currently does not handle the following usages of private properties:
```js
class Class {
#prop;
static #static;
method() {
object?.#prop;
object?.#prop();
[object.#prop] = [1];
({x: object.#prop} = {x: 1});
object.#prop`xyz`;
object?.#static;
object?.#static();
[object.#static] = [1];
({x: object.#static} = {x: 1});
object.#static`xyz`;
}
}
```
2024-11-25 10:24:20 +00:00