Boshen
c523ccb7ef
feat(codegen): better whitespace minification for import / export statements ( #7650 )
...
part of #7638
2024-12-04 19:24:03 +00:00
Dunqing
c793d71a78
feat(transformer/class-properties): transform ChainExpression ( #7575 )
...
Fully support transforming ChainExpression in class properties. Our implementation has some differences in execution order compared to Babel, but we have passed all execution-related tests.
2024-12-04 16:52:57 +00:00
tbashiyy
bd9d38a9a0
feat(linter): Implement eslint:yoda ( #7559 )
...
In this PR, implement
[eslint:yoda](https://eslint.org/docs/latest/rules/yoda )
ref: https://github.com/oxc-project/oxc/issues/479
2024-12-04 15:58:21 +00:00
Boshen
690fc54cdb
ci(deny.yml): check for deny.toml
2024-12-04 23:41:31 +08:00
Boshen
8c0b0ee2bd
fix(parser): better diagnostic for invalid for await syntax ( #7649 )
2024-12-04 15:18:29 +00:00
Boshen
1de2842f8e
feat(napi/parser): return EcmaScriptModule::hasModuleSyntax ( #7647 )
2024-12-04 13:00:47 +00:00
Boshen
36d14932ff
refactor(parser): use ModuleRecord::has_module_syntax for setting sourceType ( #7646 )
2024-12-04 12:52:21 +00:00
Boshen
d503a84d57
perf(parser): reorder parse_statement match conditions ( #7645 )
...
For performance reasons, match orders are:
1. plain if check
2. check current token
3. peek token
2024-12-04 12:31:48 +00:00
Boshen
e923e4ee46
perf(parser): inline all token kind checks ( #7644 )
2024-12-04 12:23:51 +00:00
oxc-bot
fee2143f4c
release(crates): v0.39.0 ( #7643 )
2024-12-04 19:43:22 +08:00
IWANABETHATGUY
64f92e9cb4
fix(oxc_transform): oxc dot define is postfix of some MemberExpr ( #7640 )
...
Closed https://github.com/oxc-project/oxc/issues/7598
2024-12-04 19:18:19 +08:00
Yuji Sugiura
0ce7ce7ff4
refactor(prettier): Revive doc macro ( #7639 )
...
As @Boshen advised, reintroduced the macro.
https://github.com/oxc-project/oxc/pull/7639/files#diff-18e08d6e3a6853a2ae1a973ab1615ee04ed585638eef92c8c1e49f7814f6193f
It feels addictive...! 🤩
2024-12-04 16:58:00 +08:00
Boshen
e787e9d41a
fix(codegen): print parentheses correctly for ClassHeritage ( #7637 )
...
closes #7631
2024-12-04 06:43:32 +00:00
Boshen
d2767bea62
feat(semantic): syntax error for delete object?.#a ( #7636 )
...
closes #7603
2024-12-04 05:33:05 +00:00
Boshen
1486849ec2
fix(semantic): syntax error for undeclared private field access ( #7635 )
...
closes #7582
2024-12-04 05:33:04 +00:00
camc314
a14e76aade
feat(linter): report identical logical expressions in const-comparisons ( #7630 )
2024-12-04 03:10:17 +00:00
camc314
afe1e9b929
feat(linter): enhance const-comparisons for more cases ( #7628 )
2024-12-04 02:59:56 +00:00
camc314
b445654fbd
refactor(linter): use get_inner_expression in const-comparisons ( #7627 )
2024-12-04 02:59:55 +00:00
overlookmotel
3b1e63ecab
perf(transformer/jsx): no string comparisons generating pragma expression ( #7620 )
...
#7553 introduced support for some unusual JSX pragmas e.g. `this.foo` and `import.meta.foo`. We want to support these to pass tests, but they're very unlikely to be used in practice.
Identify these strange patterns when parsing the pragma (which happens only once per file), and encode them as an enum. The removes expensive string comparisons from `Pragma::create_expression` (which is called for every JSX element), and keeps the path for common cases fast.
2024-12-04 02:47:28 +00:00
overlookmotel
8ad52be359
refactor(transformer/jsx): Pragma::parse take a &str ( #7619 )
...
`Pragma::parse` take an `Option<&str>` instead of `Option<&String>`. Passing `&String`s to functions is an odd pattern.
2024-12-04 02:47:27 +00:00
overlookmotel
2158c3851b
test(transformer/jsx): move tests setup into a macro ( #7618 )
...
Follow up after #7553 . Move tests setup for JSX pragmas into a macro to prevent tests having access to an owned `TraverseCtx`, for safety.
2024-12-04 02:47:26 +00:00
renovate
25bffa59e5
chore(deps): update crate-ci/typos action to v1.28.2 ( #7617 )
...
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [crate-ci/typos](https://redirect.github.com/crate-ci/typos ) | action | minor | `v1.27.3` -> `v1.28.2` |
---
### Release Notes
<details>
<summary>crate-ci/typos (crate-ci/typos)</summary>
### [`v1.28.2`](https://redirect.github.com/crate-ci/typos/compare/v1.28.1...v1.28.2 )
[Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.28.1...v1.28.2 )
### [`v1.28.1`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.28.1 )
[Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.28.0...v1.28.1 )
#### \[1.28.1] - 2024-11-26
##### Fixes
- Add back in `lock` file types accidentally removed in 1.28 (`go.sum`, `requirements.txt`)
### [`v1.28.0`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.28.0 )
[Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.27.3...v1.28.0 )
#### \[1.28.0] - 2024-11-25
##### Features
- Updated the dictionary with the [November 2024](https://redirect.github.com/crate-ci/typos/issues/1139 ) changes
- Add many new types and file extensions to the `--type-list`, including ada, alire, bat, candid, carp, cml, devicetree, dita, dockercompose, grpbuild, graphql, hare, lean, meson, prolog, raku, reasonml, rescript, solidity, svelte, usd, v, wgsl
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, 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 was generated by [Mend Renovate](https://mend.io/renovate/ ). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS40Mi40IiwidXBkYXRlZEluVmVyIjoiMzkuNDIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2024-12-04 02:39:28 +00:00
camc314
fcc2546f9f
fix(linter): move no-unused-expressions from TS to eslint ( #7624 )
2024-12-04 02:26:47 +00:00
Alexander S.
29db060c78
fix(linter): detect typescript eslint alias rules ( #7622 )
...
closes #7233
2024-12-04 10:16:00 +08:00
Boshen
771c698a81
feat(oxc): remove oxc_napi crate ( #7634 )
...
napi has a limitation, it cannot feature gate type exposure.
closes #7623
2024-12-04 10:07:32 +08:00
camc314
e824501a21
fix(linter): false positive in exhaustive-deps ( #7626 )
2024-12-04 01:58:25 +00:00
camc314
8a68ef4c3b
fix(linter): update reporting spans for exhaustive-deps ( #7625 )
2024-12-04 01:58:23 +00:00
camc314
543df6e3a8
fix(linter): fix false positives in exhaustive-deps ( #7615 )
...
part of https://github.com/oxc-project/oxc/issues/7246
2024-12-03 23:54:22 +00:00
Boshen
9b803d95d0
chore: bump deps ( #7616 )
2024-12-04 07:51:53 +08:00
Boshen
b4f3812c4a
refactor(oxc_napi): remove source_map - moved to its crate ( #7614 )
2024-12-03 14:42:34 +00:00
Boshen
adee0d1876
chore(npm/oxc-parser): update README
2024-12-03 22:37:49 +08:00
Boshen
4eb87eadbf
feat(linter): RulesOfHooks from nursery to correctness ( #7607 )
2024-12-03 14:15:43 +00:00
Boshen
bd977cf742
feat(oxc): add oxc_napi crate ( #7612 )
2024-12-03 14:02:47 +00:00
IWANABETHATGUY
6af8659624
fix(oxc_transformer): correct generate ThisExpr and import.meta in jsx pragma ( #7553 )
2024-12-03 13:54:15 +00:00
camc314
6dd71c6d05
test(linter): port eslint tests to no-unused-expressions ( #7611 )
2024-12-03 13:15:49 +00:00
overlookmotel
eb825edee2
fix(transformer/class-properties): replace references to class name with temp var in static prop initializers ( #7610 )
...
Similar to #7516 . Fix class properties transform to replace references to class name in static prop initializers with temp var.
Input:
```js
class C {
static getSelf = () => C;
}
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Output:
```js
var _C;
class C {}
_C = C;
_defineProperty(C, "getSelf", () => _C);
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Previously, temp var wasn't used so code was `_defineProperty(C, "getSelf", () => C);`. `C` is altered later by `C = 123`, so `C2.getSelf()` returned `123`, instead of reference to the class.
2024-12-03 12:43:21 +00:00
overlookmotel
7d1c12e5e2
refactor(transformer/class-properties): rename misleadingly-named method ( #7609 )
...
This method replaces `this` with class temp var, not reference to class name. Name the method accordingly, and update comments.
2024-12-03 12:43:21 +00:00
overlookmotel
206de912dc
feat(semantic): add SymbolTable::add_resolved_reference method ( #7608 )
...
Add `SymbolTable::add_resolved_reference` method to add a reference for a symbol.
2024-12-03 12:43:20 +00:00
camc314
e80214c74f
fix(linter): fix false positives in rules-of-hooks ( #7606 )
...
closes https://github.com/oxc-project/oxc/issues/7572
should remove all false positives from this rule
2024-12-03 12:19:00 +00:00
Boshen
40792b4440
feat(napi/parser): change parse API to accept mandatory filename and optional lang ( #7605 )
2024-12-03 12:09:48 +00:00
Boshen
348d4f451a
feat(sourcemap): move oxc_sourcemap to github.com/oxc-project/oxc-sourcemap ( #7604 )
...
It's mostly stable so we can v1.0.0 it.
And we will create cyclic dependency with StringWizard soon.
2024-12-03 11:59:43 +00:00
Boshen
7c62a33a06
feat(napi/parser): return esm info ( #7602 )
...
The parser now returns import / export statement information, which can be used for parser plugins.
2024-12-03 11:21:54 +00:00
Yuji Sugiura
521df425de
refactor(prettier): Unified method of Doc generation ( #7600 )
...
Before:
- `Doc::Xxx()` + `XXX.with_xxx()`
- `macro!()`
- `p.xxx()`
After:
- `p.xxx()` with `p_vec!` macro
2024-12-03 17:27:55 +08:00
翠 / green
58643529d1
feat(napi/transform): add TransformerOptions::assumptions ( #7601 )
...
so that I can use `setPublicClassFields` for #6735 when it's ready.
2024-12-03 17:25:18 +08:00
overlookmotel
802233d151
refactor(transformer/class-properties): remove pointless method ( #7592 )
...
#7516 removed the need for a special method to handle `export default class {}`. Delete it.
2024-12-03 07:46:05 +00:00
overlookmotel
0eadd9f6de
fix(transformer/class-properties): create temp var for class where required ( #7516 )
...
Fix class properties transform to create a temp var for class when it's required.
Input:
```js
class C {
static getSelf = () => this;
}
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Output:
```js
var _C;
class C {}
_C = C;
_defineProperty(C, "getSelf", () => _C);
const C2 = C;
C = 123;
assert(C2.getSelf() === C);
```
Previously, temp var wasn't used so code was `_defineProperty(C, "getSelf", () => C);`. `C` is altered later by `C = 123`, so `C2.getSelf()` returned `123`, instead of reference to the class.
The logic around when a temp var is required and when it's not, and when/where it's referenced is ridiculously complicated. So add some debug assert mechanisms to double-check the logic.
2024-12-03 07:46:04 +00:00
overlookmotel
a07f278dfd
refactor(transformer/class-properties): PrivatePropsStack type ( #7589 )
...
Pure refactor. Move all logic and types related to storing details of what private properties classes have into a separate file `private_props.rs`. Introduce a type `PrivatePropsStack` to represent the stack of classes.
2024-12-03 07:46:03 +00:00
overlookmotel
370d4b9176
docs(transformer/class-properties): add missing docs ( #7588 )
...
Docs only. Add mention of what `static_prop.rs` does to the main doc comment for the transform.
2024-12-03 07:46:02 +00:00
overlookmotel
7bd6350978
refactor(transformer/class-properties): move creating temp var out of main loop ( #7587 )
...
Small optimization. Move code out of the loop which determines if class property transform has nothing to do and can bail out early. This also clears the way for correcting the logic around when temp vars are/aren't created in #7516 .
2024-12-03 07:46:01 +00:00
overlookmotel
ebd11fb5e9
refactor(transformer/class-properties): exit transform_class faster if nothing to do ( #7586 )
...
Small optimization. Class properties transform doesn't have to do anything if the class has no properties, which will often be the case. Exit sooner in this case.
2024-12-03 07:46:00 +00:00