Commit graph

110 commits

Author SHA1 Message Date
overlookmotel
3b2a3477d4 test(transformer): script to amend Babel fixtures (#7122)
Add a NodeJS script which amends Babel's fixtures in place to remove transform plugins which we don't support from `options.json` files. Where options are changed from the original, the script runs Babel transform with the new options to regenerate the fixture `output.js` files.

Currently limited to transforming the fixtures for `babel-plugin-transform-class-properties` transform, but we can also enable it for other plugins if we wish in future, to get additional test coverage.
2024-11-25 10:24:19 +00:00
Boshen
6f161de10f chore(coverage): bump test262, babel and TypeScript submodules (#7452) 2024-11-24 16:26:45 +00:00
Nicholas Rayburn
7b7555a0ab
docs(website): Link to specific ref when generating website docs (#7324)
Currently the website links to main which is subject to change without
an update to the website. This updates the website to link to the
specific commit that was used when the website was published.

Feel free to cleanup anything in this PR.
2024-11-17 14:23:00 +08:00
dalaoshu
28d37e478d
chore(justfile): add pnpm install to init (#7297)
Recently, due to some issues, I had to re-clone the oxc project multiple
times. After running `just init`, I always had to run `pnpm install`
separately. We could include `pnpm install` to init command to
streamline the process. In addition, I propose to include
`cargo-binstall` in the init command.

I'm not sure if we should include the `submodules` command in the init
command, as it is generally unnecessary for most users unless they are
working on specific projects like the minifier.
2024-11-17 00:30:56 +08:00
dalaoshu
16cfb96a79
fix(justfile): make submodules work on windows (#7293)
Related to #7290, closes #7296 

By default, `Windows` encounters the following issue unless the user
installs `PowerShell 7` (pwsh).

```bash
error: Recipe `submodules` could not be run because just could not find the shell: program not found
error: Recipe `init` could not be run because just could not find the shell: program not found
```

Furthermore, I have found a better way to solve this problem.
2024-11-16 00:03:23 +08:00
overlookmotel
f4213b8d12
fix(tools): just test-transform run conformance only once (#7295)
`--exec` flag also runs the non-exec tests, so it's not required to run
it twice.
2024-11-16 00:02:54 +08:00
Song Gao
ea9ca8ab10
fix(just): make submodules work on windows (#7290)
Fix #7282 
- Change default shell to powershell 7(pwsh) to supports "&&"
- change url from git protocol to https protocol. This does not need a
public token(I do not know what it is...).
- specify different submodule init command for windows

Co-authored-by: Song Gao <songgao@microsoft.com>
2024-11-15 18:55:03 +08:00
Boshen
0ae4cd6630
chore(justfile): improve watch command 2024-10-30 11:51:31 +08:00
Boshen
8cbf3f09d6
chore: replace bacon with watchexec 2024-10-29 11:50:58 +08:00
ottomated
1145341a92 feat(ast_tools): output typescript to a separate package (#6755)
Part of #6347.

Moves typescript logic from derive_estree into a new ast_tools generator.
2024-10-24 13:08:57 +00:00
Boshen
2f6ad42348 fix(codegen): print negative bigint 1n- -1n correctly after constant folding (#6798)
closes #6767
2024-10-23 04:56:50 +00:00
Boshen
82bc745da1
chore: use bacon instead of cargo watch 2024-10-21 15:04:40 +08:00
Boshen
3711c32f22 chore(coverage): bump test262, babel and TypeScript (#6702)
closes #6692
2024-10-20 15:02:26 +00:00
Dmitry Zakharov
25a49a5700
feat(rulegen): add import to rulegen (#6631)
Added for fast rule creation
2024-10-16 17:05:40 -04:00
no-yan
07196ae0a8
perf(justfile): optimize submodule cloining with shallow fetch (#6292)
fix #6291, where `just submodules` takes around 8 minutes to clone
repositories.

This change reduces the clone time from around 8 minutes to 42 seconds
in reported scenario.
 
<img width="534" alt="image"
src="https://github.com/user-attachments/assets/bf74e412-f1ed-419e-b180-09ed96a8eb67">

<details><summary>Command log: time just submodules</summary>
<p>

```
❯ time just submodules
just clone-submodule tasks/coverage/test262 git@github.com:tc39/test262.git d62fa93c8f9ce5e687c0bbaa5d2b59670ab2ff60
cd tasks/coverage/test262 || git init tasks/coverage/test262
bash: 1 行: cd: tasks/coverage/test262: No such file or directory
Initialized empty Git repository in /Users/noyan/ghq/github.com/oxc-project/oxc/tasks/coverage/test262/.git/
cd tasks/coverage/test262 && git remote add origin git@github.com:tc39/test262.git || true
cd tasks/coverage/test262 && git fetch --depth=1 origin d62fa93c8f9ce5e687c0bbaa5d2b59670ab2ff60 && git reset --hard d62fa93c8f9ce5e687c0bbaa5d2b59670ab2ff60
remote: Enumerating objects: 53504, done.
remote: Counting objects: 100% (53504/53504), done.
remote: Compressing objects: 100% (19436/19436), done.
remote: Total 53504 (delta 39436), reused 39428 (delta 33947), pack-reused 0 (from 0)
Receiving objects: 100% (53504/53504), 12.32 MiB | 9.06 MiB/s, done.
Resolving deltas: 100% (39436/39436), done.
From github.com:tc39/test262
 * branch              d62fa93c8f9ce5e687c0bbaa5d2b59670ab2ff60 -> FETCH_HEAD
Updating files: 100% (51664/51664), done.
HEAD is now at d62fa93c [explicit-resource-management] Complete exception handling
just clone-submodule tasks/coverage/babel git@github.com:babel/babel.git 3bcfee232506a4cebe410f02042fb0f0adeeb0b1
cd tasks/coverage/babel || git init tasks/coverage/babel
bash: 1 行: cd: tasks/coverage/babel: No such file or directory
Initialized empty Git repository in /Users/noyan/ghq/github.com/oxc-project/oxc/tasks/coverage/babel/.git/
cd tasks/coverage/babel && git remote add origin git@github.com:babel/babel.git || true
cd tasks/coverage/babel && git fetch --depth=1 origin 3bcfee232506a4cebe410f02042fb0f0adeeb0b1 && git reset --hard 3bcfee232506a4cebe410f02042fb0f0adeeb0b1
remote: Enumerating objects: 36357, done.
remote: Counting objects: 100% (36357/36357), done.
remote: Compressing objects: 100% (21830/21830), done.
remote: Total 36357 (delta 8527), reused 30780 (delta 7455), pack-reused 0 (from 0)
Receiving objects: 100% (36357/36357), 9.34 MiB | 9.24 MiB/s, done.
Resolving deltas: 100% (8527/8527), done.
From github.com:babel/babel
 * branch              3bcfee232506a4cebe410f02042fb0f0adeeb0b1 -> FETCH_HEAD
Updating files: 100% (31735/31735), done.
HEAD is now at 3bcfee23 Fix printing of TS `infer` in compact mode (#16788)
just clone-submodule tasks/coverage/typescript git@github.com:microsoft/TypeScript.git a709f9899c2a544b6de65a0f2623ecbbe1394eab
cd tasks/coverage/typescript || git init tasks/coverage/typescript
bash: 1 行: cd: tasks/coverage/typescript: No such file or directory
Initialized empty Git repository in /Users/noyan/ghq/github.com/oxc-project/oxc/tasks/coverage/typescript/.git/
cd tasks/coverage/typescript && git remote add origin git@github.com:microsoft/TypeScript.git || true
cd tasks/coverage/typescript && git fetch --depth=1 origin a709f9899c2a544b6de65a0f2623ecbbe1394eab && git reset --hard a709f9899c2a544b6de65a0f2623ecbbe1394eab
remote: Enumerating objects: 69880, done.
remote: Counting objects: 100% (69880/69880), done.
remote: Compressing objects: 100% (52067/52067), done.
remote: Total 69880 (delta 17267), reused 39053 (delta 16227), pack-reused 0 (from 0)
Receiving objects: 100% (69880/69880), 32.80 MiB | 8.54 MiB/s, done.
Resolving deltas: 100% (17267/17267), done.
From github.com:microsoft/TypeScript
 * branch                a709f9899c2a544b6de65a0f2623ecbbe1394eab -> FETCH_HEAD
Updating files: 100% (72575/72575), done.
HEAD is now at a709f9899 Update deps, dprint plugins (#59810)
just clone-submodule tasks/prettier_conformance/prettier git@github.com:prettier/prettier.git 52829385bcc4d785e58ae2602c0b098a643523c9
cd tasks/prettier_conformance/prettier || git init tasks/prettier_conformance/prettier
bash: 1 行: cd: tasks/prettier_conformance/prettier: No such file or directory
Initialized empty Git repository in /Users/noyan/ghq/github.com/oxc-project/oxc/tasks/prettier_conformance/prettier/.git/
cd tasks/prettier_conformance/prettier && git remote add origin git@github.com:prettier/prettier.git || true
cd tasks/prettier_conformance/prettier && git fetch --depth=1 origin 52829385bcc4d785e58ae2602c0b098a643523c9 && git reset --hard 52829385bcc4d785e58ae2602c0b098a643523c9
remote: Enumerating objects: 10259, done.
remote: Counting objects: 100% (10259/10259), done.
remote: Compressing objects: 100% (6662/6662), done.
remote: Total 10259 (delta 970), reused 8226 (delta 696), pack-reused 0 (from 0)
Receiving objects: 100% (10259/10259), 12.85 MiB | 10.34 MiB/s, done.
Resolving deltas: 100% (970/970), done.
From github.com:prettier/prettier
 * branch            52829385bcc4d785e58ae2602c0b098a643523c9 -> FETCH_HEAD
HEAD is now at 5282938 Release 3.3.3
just submodules  1.56s user 12.29s system 32% cpu 42.408 total
``` 

</p>
</details> 

## Solution
To optimize the cloning process:
- Fetch only the specified commit, eliminating the need for a git clone
(which fetches HEAD and subsequently updates with differences).
- Initialize it with git init when the repository doesn't exist locally.
- Use `git fetch --depth=1` to prevent fetching previous commits.

See: https://stackoverflow.com/a/3489576

I initially suggested using `git fetch --depth=1`, but after testing, I
found that removing clone could speed up the process by about 20
seconds. Therefore, I've changed the approach.
2024-10-05 23:58:03 +08:00
Brandon Largeau
006f2cdbf9
fix(just): use powershell compatible env variable for doc command (#6168)
Hello,

I was following the guide
https://oxc.rs/docs/contribute/development.html and executed `just
ready` as said.
I got an error on Windows on the `doc` command because it sets the env
variable in a way that is not compatible with `powershell`.

I've used
[attributes](https://just.systems/man/en/attributes.html#attributes) to
fix the issue.
I never used `just` so I don't know if there's a better way to fix the
issue.
2024-09-30 09:59:27 +08:00
DonIsaac
d24985ed51 feat(linter): add oxc-security/api-keys (#5906)
## What This PR does
Adds a new `oxc-security/api-key` rule that scans for hard-coded API keys.

It is broken up into "secret rules", where each one is responsible for finding a different kind of key. It is architecturally identical to how lint rules themselves. This PR also includes the first of these rules, for AWS access key IDs.

Logic and rules are based on [keyhunter](https://github.com/Donisaac/keyhunter). I've licensed that repo under GNU GPLv3, but it's my code and I can do what I want with it 😈 (read: I'm fine with it being MIT for oxc).

This PR is a complete feature in its own right, but does not represent the end of this work. See https://github.com/oxc-project/backlog/issues/116 to track overall progress.
2024-09-22 22:39:56 +00:00
Boshen
612f638bcd
chore: change just c to run cargo conformance 2024-09-22 23:50:30 +08:00
Boshen
508cbeafd5
chore(justfile): add just watch-oxlint 2024-09-09 16:57:51 +08:00
Boshen
63a830e08c
chore(dprint): format toml files (#5599)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
Boshen
0571a37022
chore(justfile): add dprint to just init 2024-09-08 14:02:24 +08:00
Boshen
955e83ec41
ci: add dprint to autofix (#5597) 2024-09-08 13:46:30 +08:00
Boshen
d00a1f6511
chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00
Boshen
2fb8c202e6
refactor(justfile): remove wasm-pack and cargo-llvm-cov from just init
They are rarely used.
2024-09-08 12:47:45 +08:00
IWANABETHATGUY
caf800700d
chore(justfile): bundle wasm with different flag (#5433)
1. wasm-pack with release flag will increase wasm bundling time, which
hurts dx when developing playground.
2. only enable `release` flag when `build-wasm`.
2024-09-04 13:30:48 +08:00
Boshen
cd0516752c
chore(justfile): build-wasm should build in prod 2024-09-04 08:58:14 +08:00
leaysgur
c7e61a1391 chore(prettier): Update conformance tests to Prettier v3.3.3 (#5394)
- v3.3.3 is latest released version
- Test file name was changed from v3.3.x
  - https://github.com/prettier/prettier/pull/16244
2024-09-02 10:32:17 +00:00
Boshen
29f8497001
ci: autofix formatting relates jobs (#5383)
closes #5382

Autofixes toml, rust and unused dependencies.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-01 16:19:53 +08:00
Boshen
e75e0f1465 chore: update test262 / babel / typescript submodules (#5369)
closes #5215
2024-08-31 12:28:25 +00:00
Kevin Deng 三咲智子
ac8fabd442
chore: fix precommit install hook (#5271)
Add `-e` for enabling interpretation of backslash escapes.

Before:
```
#!/bin/sh\njust fmt
```
2024-08-28 09:04:29 +08:00
Boshen
4c88997727
comment just ast 2024-08-23 21:42:21 +08:00
Boshen
c220730779 feat(coverage): check symbols and scopes after transformation (#4917)
closes https://github.com/oxc-project/oxc/issues/4790

@overlookmotel enjoy ... take a look at the snapshots and probably nothing else.

The snapshots are minimal right now, but it's already showing symbols from import specifiers are not being removed. We can iterate on the snapshot representation to aid debugging later.

I'll extend this to `transformer_conformance` and `oxc-monitor` in an up coming PR.
2024-08-16 07:05:11 +00:00
rzvxa
8e8fcd0584 refactor(ast_tools): rename oxc_ast_codegen to oxc_ast_tools. (#4846)
This PR renames the `oxc_ast_codegen` crate to `oxc_ast_tools`, It improves the readability and organization of the codebase by giving the crate a name that better reflects its purpose and contents.

It also improves the error message in CI.
2024-08-12 14:33:58 +00:00
DonIsaac
8ec7e1204a chore: alias new-typescript-rule to new-ts-rule (#4824)
This is the command suggested to users on our `typescript-eslint` mega-issue #2180.
This should help reduce confusion.
2024-08-11 15:27:53 +00:00
DonIsaac
f6258ae126 chore: add 'just fix' command (#4823)
Fixes all auto-fixable issues from rustfmt, taplo, typos, and clippy.
2024-08-11 15:27:53 +00:00
DonIsaac
3d40528588 feat(linter): add fix emoji to rules table and doc pages (#4715)
Rules table:
<img width="898" alt="image" src="https://github.com/user-attachments/assets/353052aa-0af3-4c09-8441-ff79f4561ca0">

Doc pages:
<img width="918" alt="image" src="https://github.com/user-attachments/assets/cb43cb2d-15ff-41e6-8523-145cfbc3f484">
2024-08-10 22:50:47 +00:00
dalaoshu
970c36942c
chore: support windows shell for just (#4795)
closes #4794
2024-08-10 14:24:14 +08:00
dalaoshu
6cf38cb776
chore(tasks): support init vitest lint rule (#4752)
Related to #4656
2024-08-08 16:27:50 +08:00
Jelle van der Waa
1f8968a521
feat(linter): Add eslint-plugin-promise rules: avoid-new, no-new-statics, params-names (#4293)
This introduces the `eslint-plugin-promise` plugin and implements three
relatively simple rules.

Split off from https://github.com/oxc-project/oxc/pull/4252
2024-07-17 09:21:20 +08:00
rzvxa
96af45933a
chore(justfile): add just check to the just ast command. (#4302)
I use this in my local environment when I'm developing the ast_codegen
and want a thorough build with the newly generated files. If you find it
useful merge otherwise feel free to close.
2024-07-16 23:58:29 +08:00
Boshen
f85188b1af
chore: sync ast changes 2024-07-15 10:51:38 +08:00
rzvxa
e6c407d1c3
chore(ci): add Codegen to the CI workflow. (#4144)
It should be marked as `required`.
Closes #4138

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-07-10 09:47:30 +08:00
Boshen
0511a1b014
chore(justfile): run cargo shear in just ready 2024-06-20 23:27:46 +08:00
Boshen
a11bdae1bb
chore(justfile): add a pre-commit hook
closes #3741
2024-06-19 20:09:42 +08:00
Boshen
c041e9d1a9
chore: bump test262, babel and TypeScript submodules (#3644) 2024-06-12 18:42:32 +08:00
Boshen
f849efa550
chore: fix build-wasm command 2024-06-07 17:05:46 +08:00
Boshen
515deb6165
chore: add cargo oxlint command 2024-05-28 11:10:08 +08:00
Boshen
2aba5beadb
chore(justfile): add wasm build commands 2024-05-26 20:55:49 +08:00
Boshen
21505e885c refactor(cli): move crates/oxc_cli to apps/oxlint (#3413)
We need to split the cli crate up to reduce dependencies,
the current cli crate is pulling in `oxc_prettier`, which is redundant
for the linter.
2024-05-26 05:00:30 +00:00
Boshen
ed54eca119
chore(justfile): remove cargo-edit in favor of renovate bot 2024-05-24 13:50:40 +08:00