Commit graph

1023 commits

Author SHA1 Message Date
rzvxa
2e026e1b7f feat(ast_codegen): generate ast_kind.rs. (#3888)
[List of 68 blacklisted items](https://github.com/oxc-project/oxc/pull/3888/files#diff-59cbea4a1444e752992821d3429a5f27bf1027a530977d075ec89aa55995912aR11)
2024-06-25 15:47:04 +00:00
rzvxa
09f4d3c4d3 feat(ast_codegen): add ImplGetSpanGenerator. (#3852)
This one is ready to replace the handwritten module.
2024-06-25 14:39:39 +00:00
rzvxa
f6c4ec44ca feat(tasks/ast_codegen): prototype for codegen AST related code (#3815)
Part of https://github.com/oxc-project/oxc/issues/3819
2024-06-25 13:54:50 +00:00
Boshen
187f0782c1 refactor(parser): improve parsing of parse_function_or_constructor_type (#3892)
part of #3502
2024-06-25 03:43:02 +00:00
mysteryven
328445b4ca feat(linter): support vitest/no-disabled-tests (#3717) 2024-06-24 15:16:32 +00:00
Dunqing
ef82c78a72 fix(parser): trailing comma is not allowed in ParenthesizedExpression (#3885)
close: #3878

The implementation is copied from `SeparatedList`'s `print_list`.
```diff
    fn parse_list(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
        p.expect(self.open())?;

        let mut first = true;

        while !p.at(self.close()) && !p.at(Kind::Eof) {
            if first {
                first = false;
            } else {
                p.expect(self.separator())?;
-                if p.at(self.close()) {
-                    break;
-               }
            }

            self.parse_element(p)?;
        }

        p.expect(self.close())?;
        Ok(())
    }
```
2024-06-24 14:56:32 +00:00
renovate[bot]
0b41303d14
chore(deps): update npm packages (#3871)
[![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.3.0` -> `9.4.0`](https://renovatebot.com/diffs/npm/pnpm/9.3.0/9.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/pnpm/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/pnpm/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/pnpm/9.3.0/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/pnpm/9.3.0/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [tar](https://togithub.com/isaacs/node-tar) | [`7.2.0` ->
`7.4.0`](https://renovatebot.com/diffs/npm/tar/7.2.0/7.4.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/tar/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tar/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tar/7.2.0/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tar/7.2.0/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

### [`v9.4.0`](https://togithub.com/pnpm/pnpm/compare/v9.3.0...v9.4.0)

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

</details>

<details>
<summary>isaacs/node-tar (tar)</summary>

###
[`v7.4.0`](https://togithub.com/isaacs/node-tar/compare/v7.3.0...v7.4.0)

[Compare
Source](https://togithub.com/isaacs/node-tar/compare/v7.3.0...v7.4.0)

###
[`v7.3.0`](https://togithub.com/isaacs/node-tar/compare/v7.2.0...v7.3.0)

[Compare
Source](https://togithub.com/isaacs/node-tar/compare/v7.2.0...v7.3.0)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjQxMy4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-24 07:56:18 +00:00
Dunqing
5501d5ce33 feat(transformer/typescript): transform import {} from "mod" to import "mod" (#3866)
close: #3736
2024-06-24 03:27:39 +00:00
Boshen
f3a21a28d7
chore: do not compile test crates that have no tests 2024-06-24 00:20:04 +08:00
Boshen
13754cbd3d fix(parser): change diagnostic to "modifier cannot be used here" (#3853) 2024-06-23 15:14:27 +00:00
Boshen
ae09a97a09
refactor(ast)!: remove Modifiers from ts nodes (#3846) 2024-06-23 19:44:35 +08:00
Boshen
1af5ed3d89 refactor(ast)!: replace Modifiers with declare and const on EnumDeclaration (#3845) 2024-06-23 10:34:55 +00:00
Boshen
0673677317 refactor(ast)!: replace Modifiers with declare on Function (#3844) 2024-06-23 10:34:54 +00:00
Boshen
ee6ec4ee57 refactor(ast)!: replace Modifiers with declare and abstract on Class (#3841) 2024-06-23 10:34:53 +00:00
Boshen
9b38119ec9 refactor(ast)!: replace Modifiers with declare on VariableDeclaration (#3839)
part of #2958
2024-06-23 10:34:52 +00:00
Don Isaac
d5f6aeb1ca
feat(semantic): check for illegal symbol modifiers (#3838) 2024-06-23 12:36:09 +08:00
Boshen
445603444f feat(ast)!: add IdentifierReference to ExportSpecifier (#3820)
closes #3795
closes #3796
2024-06-22 11:43:41 +00:00
rzvxa
567334834b chore(ci): now we mark both ts alias and eslint rules. (#3813)
Fixes the unmarked implemented rules in #479.
2024-06-22 04:55:34 +00:00
overlookmotel
4f7ff7e3ad perf: do not pass &Atom to functions (#3818)
`Atom` is just a wrapper around `&str`, so better not to pass `&Atom` to functions, as that's a double-reference. Prefer `Atom` or `&str` instead to avoid indirection.
2024-06-22 04:48:00 +00:00
Boshen
8027b1e894 refactor(minifier): change prepass to ast_passes::remove_parens (#3801) 2024-06-21 07:18:08 +00:00
Boshen
2a16ce0624 feat(traverse): disable syntax check and disable build module record (#3794)
These can be skipped because :
 * semantic errors are not passed to the caller
 * module record is not used
2024-06-20 13:05:35 +00:00
Dunqing
dc8e2b8dc0 feat(coverage/transpile): compare error message (#3789) 2024-06-20 10:13:36 +00:00
Boshen
ebb6eb8c67
chore(coverage): add a prepass benchmark 2024-06-20 15:07:17 +08:00
Alexander S
a5e0f2274a
fix(docs): detect typescript alias rules and mark them as supported (#3779)
Some tpyescript rules are extensions of the core eslint rules.  

Now we mark them as supported :) 

Maybe add a info for the user about this behavior?

Some discord discussion:

https://discord.com/channels/1079625926024900739/1080712072012238858/1226407188650659845

## Current State

Found Aliases:
- default-param-last
- max-params
- no-array-constructor
- require-await
- no-dupe-class-members
- no-empty-function
- no-loss-of-precision
- no-redeclare
- no-useless-constructor

Todo: why im getting following output:
```
👀 typescript/require-await is implemented but not found in their rules
👀 tree-shaking/no-side-effects-in-initialization is implemented but not found in their rules
```
2024-06-20 14:56:31 +08:00
Dunqing
497769cb60 feat(ast): add some visitor functions (#3785) 2024-06-20 05:23:04 +00:00
overlookmotel
6ba60e978a ci: custom global allocator for benchmarks (#3776)
Use a custom global allocator for benchmarks. Will hopefully fix the wild variance in many benchmarks that we've been seeing, which I believe is caused by unpredictable behavior in the system allocator.
2024-06-19 17:02:19 +00:00
Boshen
36de684fd1
chore(benchmark): use a more complated file for codegen_sourcemap 2024-06-19 13:31:21 +08:00
rzvxa
49d28c0dd2 chore(benchmark): enable cfg for linter benchmarks. (#3746)
The benchmark result on this PR - if we filter out the unstable benchmarks - can also be used to show the total impact of CFG enable rules.
2024-06-19 05:12:58 +00:00
Boshen
4e9d8a5585
chore: fix some nightly clippy warnings 2024-06-19 00:53:58 +08:00
Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt 2024-06-19 00:48:30 +08:00
Boshen
5c38a0fd69 feat(codegen)!: new code gen API (#3740)
This PR introduces two type alias to avoid the confusing const generic `pub struct Codegen<'a, const MINIFY: bool>`

* CodeGenerator - Code generator without whitespace removal.
* WhitespaceRemover - Code generator with whitespace removal.

Usage is changed to a builder pattern:

```rust
CodeGenerator::new()
  .enable_comment(...)
  .enable_sourcemap(...)
  .build(&program);
```
2024-06-18 15:50:12 +00:00
Boshen
5a99d30eba feat(codegen): improve codegen formatting (#3735) 2024-06-18 11:10:36 +00:00
Boshen
bf9b38a197 feat(codegen): improve codegen formatting (#3731) 2024-06-18 04:14:10 +00:00
Boshen
38a75e559b feat(coverage): improve codegen (#3729) 2024-06-18 02:53:09 +00:00
Boshen
41b3c24f98 feat(coverage): snapshot isolated declarations dts emit (#3723) 2024-06-17 18:31:03 +00:00
Dunqing
889198ae60 fix(coverage/transpiler): diff comparison results are reversed (#3727)
<img width="963" alt="image" src="https://github.com/oxc-project/oxc/assets/29533304/fbec74bc-e06e-42f3-9963-f2fdce3ae784">
2024-06-17 16:47:05 +00:00
Dunqing
0fbecdcd81 fix(isolated-declarations): should be added to references, not bindings (#3726) 2024-06-17 16:47:02 +00:00
Boshen
0b8098a442 feat(napi): isolated-declaration (#3718) 2024-06-17 13:06:00 +00:00
Boshen
1c7f19c868 chore(oxlint): remove unused code (format command) (#3716) 2024-06-17 12:16:21 +00:00
Boshen
815260ed2f refactor(isolated-declarations): decouple codegen (#3715) 2024-06-17 11:45:29 +00:00
Boshen
87c3282deb chore(transformer-dts): change crate to oxc_isolated_declarations (#3713) 2024-06-17 11:14:13 +00:00
Boshen
982e6f08df chore: make println and eprintln opt-in (#3712)
I noticed accidental `println` can be merged, which isn't really nice.
2024-06-17 10:40:34 +00:00
Boshen
da1e2d0e9b fix(codegen): improve typescript codegen (#3708)
Remaining issues are tracked in https://github.com/oxc-project/oxc/issues/3692
2024-06-17 09:34:54 +00:00
renovate[bot]
a048493a92
chore(deps): update pnpm to v9.3.0 (#3707)
[![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.2.0` -> `9.3.0`](https://renovatebot.com/diffs/npm/pnpm/9.2.0/9.3.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/pnpm/9.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/pnpm/9.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/pnpm/9.2.0/9.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/pnpm/9.2.0/9.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

### [`v9.3.0`](https://togithub.com/pnpm/pnpm/releases/tag/v9.3.0)

[Compare Source](https://togithub.com/pnpm/pnpm/compare/v9.2.0...v9.3.0)

#### Minor Changes

- **Semi-breaking.** Dependency key names in the lockfile are shortened
if they are longer than 1000 characters. We don't expect this change to
affect many users. Affected users most probably can't run install
successfully at the moment. This change is required to fix some edge
cases in which installation fails with an out-of-memory error or
"Invalid string length (RangeError: Invalid string length)" error. The
max allowed length of the dependency key can be controlled with the
`peers-suffix-max-length` setting
[#&#8203;8177](https://togithub.com/pnpm/pnpm/pull/8177).

#### Patch Changes

- Set `reporter-hide-prefix` to `true` by default for `pnpm exec`. In
order to show prefix, the user now has to explicitly set
`reporter-hide-prefix=false`
[#&#8203;8174](https://togithub.com/pnpm/pnpm/issues/8174).

#### Platinum Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a href="https://bit.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank"><img src="https://pnpm.io/img/users/bit.svg"
width="80"></a>
      </td>
      <td align="center" valign="middle">
<a href="https://figma.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank"><img src="https://pnpm.io/img/users/figma.svg"
width="80"></a>
      </td>
    </tr>
  </tbody>
</table>

#### Gold Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a href="https://discord.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/discord.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/discord_light.svg" />
<img src="https://pnpm.io/img/users/discord.svg" width="220" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://prisma.io/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/prisma.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/prisma_light.svg" />
<img src="https://pnpm.io/img/users/prisma.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://uscreen.de/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/uscreen.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/uscreen_light.svg" />
<img src="https://pnpm.io/img/users/uscreen.svg" width="180" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://www.jetbrains.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/jetbrains.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/jetbrains.svg" />
<img src="https://pnpm.io/img/users/jetbrains.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://nx.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/nx.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/nx_light.svg" />
            <img src="https://pnpm.io/img/users/nx.svg" width="120" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://coderabbit.ai/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/coderabbit.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/coderabbit_light.svg" />
<img src="https://pnpm.io/img/users/coderabbit.svg" width="220" />
          </picture>
        </a>
      </td>
    </tr>
  </tbody>
</table>

#### Our Silver Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a
href="https://leniolabs.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <img src="https://pnpm.io/img/users/leniolabs.jpg" width="80">
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://vercel.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/vercel.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/vercel_light.svg" />
<img src="https://pnpm.io/img/users/vercel.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://depot.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/depot.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/depot_light.svg" />
<img src="https://pnpm.io/img/users/depot.svg" width="200" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://moonrepo.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/moonrepo.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/moonrepo_light.svg" />
<img src="https://pnpm.io/img/users/moonrepo.svg" width="200" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://devowl.io/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/devowlio.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/devowlio.svg" />
<img src="https://pnpm.io/img/users/devowlio.svg" width="200" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://macpaw.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/macpaw.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/macpaw_light.svg" />
<img src="https://pnpm.io/img/users/macpaw.svg" width="200" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://cerbos.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/cerbos.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/cerbos_light.svg" />
<img src="https://pnpm.io/img/users/cerbos.svg" width="180" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://vpsserver.com/en-us/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
<img src="https://pnpm.io/img/users/vpsserver.svg" width="180" />
        </a>
      </td>
    </tr>
  </tbody>
</table>

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-17 03:16:12 +00:00
Boshen
d65c652700
feat(parser): display jsx mismatch error, e.g. <Foo></Bar> (#3696)
relates #3548 

I'll remove the closing name in a follow up PR.

The snapshot is incorrect, so I created a follow up issue:
https://github.com/oxc-project/oxc/issues/3697
2024-06-16 01:05:28 +08:00
Boshen
750a534455 feat(coverage): transformer idempotency test (#3691) 2024-06-15 13:59:53 +00:00
Dunqing
0e6d3ceee5 feat(transformer-dts): report error for async function and generator (#3688)
feat(transformer-dts): report error for async function and generator

fix(transformer-dts): correct span for type containing private name error

fix(transformer-dts): should add reference for export specifiers
2024-06-15 13:34:25 +00:00
Boshen
568b6479ae feat(coverage): use oxc printend text for comparing dts transform (#3686) 2024-06-15 11:00:16 +00:00
Boshen
4f166642a0 refactor(transformer_dts): create a Program for codegen (#3679) 2024-06-15 05:44:25 +00:00
Boshen
eff9cff048 feat(coverage): add dts transform coverage test (#3675) 2024-06-14 14:29:27 +00:00