Commit graph

3023 commits

Author SHA1 Message Date
Dunqing
e10ef03aa9
feat(linter/import) support check re-export in named (#2769) 2024-03-20 22:12:45 +08:00
Danil Karpenko
1721feea0e
feat(prettier/ts): better conformance (#2721)
I know 5% isn't much, but it's small steps like this that move us toward
our goal.
2024-03-20 18:59:49 +08:00
Jose
451162effc
feat(linter): eslint/no-iterator (#2758)
Rule detail: https://eslint.org/docs/latest/rules/no-iterator

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-20 16:20:09 +08:00
keita hino
53ffbc6bd2
feat(linter): eslint-plugin-react checked-requires-onchange-or-readonly (#2754)
partof: https://github.com/oxc-project/oxc/issues/1022

docs:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
code:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/checked-requires-onchange-or-readonly.js
test:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/tests/lib/rules/checked-requires-onchange-or-readonly.js

---------

Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-03-20 15:38:48 +08:00
overlookmotel
508091314f
feat(tasks): benchmark NodeJS parser (#2770)
Add NodeJS parser to benchmarks.

Previous attempt #2724 did not work due CodSpeed producing very
inaccurate results (https://github.com/CodSpeedHQ/action/issues/96).

This version runs the actual benchmarks without CodSpeed's
instrumentation. Then another faux-benchmark runs within Codspeed's
instrumented action and just performs meaningless calculations in a loop
for as long as is required to take same amount of time as the original
uninstrumented benchmarks took.

It's unfortunate that we therefore don't get flame graphs on CodSpeed,
but this seems to be the best we can do for now.
2024-03-20 05:06:09 +00:00
Jose
1c07a9908d
feat(linter): default_param_last (#2756)
Rule detail: https://eslint.org/docs/latest/rules/default-param-last

---------

Co-authored-by: j.buendia <j.buendia>
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-03-20 10:05:51 +08:00
Jose
291dc0597c
feat(linter): no_script_url (#2761)
Rule detail: https://eslint.org/docs/latest/rules/no-script-url

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-20 09:09:34 +08:00
Dunqing
99dcd00bf3
feat(linter/import) change the rule path to index.ts and add snapshot in export rule (#2732)
Looks like the current implementation is incorrect
2024-03-19 22:47:04 +08:00
Jose
ac813a60f6
feat(linter): no_template_curly_in_string (#2763)
Rule detail:
https://eslint.org/docs/latest/rules/no-template-curly-in-string

At first I implemented it with regex, but I think you are trying to
avoid it for performance reasons, so I did it by searching for the
chars.

I had some problems showing the span in the case of 'Hello, ${{foo:
"bar"}.foo}' I think it turned out more or less well, however, if you
think it can be done in another way I am willing to do it .

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-19 21:56:36 +08:00
Jose
134e15e657
feat(linter): eslint/no-proto (#2760)
Rule detail: https://eslint.org/docs/latest/rules/no-proto

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-19 20:01:15 +08:00
Jose
39b98badca
feat(linter): no_eq_null (#2757)
Rule detail: https://eslint.org/docs/latest/rules/no-eq-null

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-19 15:48:25 +08:00
Jose
a671d754df
fix(linter): fix guard_for_in span error (#2755)
As talked here
https://github.com/oxc-project/oxc/pull/2746#discussion_r1528145418
errors in guard_for_in could be improved so I attempted to improve it.

If anyone have a suggestion for the span element positions say me!

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-19 12:16:30 +08:00
Jose
86d006e171
feat(linter): eslint/max-params (#2749)
Rule detail: https://eslint.org/docs/latest/rules/max-params

Maybe I can add function name, I was searching for it, but I don't know
how to get it.

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-19 09:16:52 +08:00
overlookmotel
b82a5dd123
fix(tasks): don't upload log files to CodSpeed (#2762)
Improvement to #2751. CodSpeed have advised no need to upload the log
files.
2024-03-18 22:44:57 +00:00
overlookmotel
5edd196836
fix(tasks): fix codspeed upload for PRs from forks (#2759)
#2751 contained a mistake, which was pointed out by Adrian @ CodSpeed on
Discord.

For PRs from forks, `CODSPEED_TOKEN` is not provided, and the submission
to CodSpeed is "tokenless". #2751 wrongly assumed all runs are submitted
with a token. This PR fixes that.
2024-03-18 20:29:16 +00:00
Danil Karpenko
31efbc29fc
feat(prettier/ts): print type keyword inside import specifier braces, fixes #2708 (#2712)
- #2708
2024-03-18 20:54:19 +08:00
overlookmotel
e793063f75
perf(parser): faster lexing JSX identifiers (#2557)
Speed up lexing JSX identifier continuations (i.e. after `-`), by
searching for end of identifier byte-by-byte.

Change does not register on benchmarks, only because benchmarks don't
contain any `<Foo-Bar />` identifiers, so don't exercise this code path.
2024-03-18 12:06:27 +00:00
Jose
22c84c546a
feat(linter): eslint/guard-for-in (#2746)
Rule details: https://eslint.org/docs/latest/rules/guard-for-in

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-18 19:36:26 +08:00
Dunqing
95ac265504
feat(linter/import): check ObjectPattern syntax in namespace (#2691) 2024-03-18 12:55:55 +08:00
Dunqing
64db5643ce
feat(linter/import) implement no_unused_modules rule (#2720) 2024-03-18 12:55:36 +08:00
renovate[bot]
938debab71
chore(deps): update website npm packages (#2750) 2024-03-18 12:53:43 +08:00
Boshen
b1343d7bcb
Release oxlint and vscode extension v0.2.14 2024-03-18 12:47:53 +08:00
overlookmotel
68f304faa3
feat(tasks): shard linter benchmarks in CI (#2752)
Follow-on from #2751. Further shards linter benchmarks so each fixture runs in its own job.

This reduces total time to run benchmarks by another ~75 secs. So approx 2.5 mins shaved off in total.
2024-03-18 10:50:44 +08:00
overlookmotel
93e1ea4419
feat(tasks): shard benchmarks in CI (#2751)
This PR shards benchmarks when running on CI. Each benchmark (parser, minifier etc) runs as a separate job, and then a final job combines the results and uploads to Codspeed.

A bit of a hacky implementation. Uses a small NodeJS HTTP server to intercept the results from `codspeed-runner`, and then another NodeJS script to combine them all together, and upload to CodSpeed.

I will submit PRs on Codspeed's runner + action to do it properly, but as I imagine it'll be a slow process getting that merged upstream, I wanted to see if it worked first. We can replace this once it's supported upstream.

Sharding only reduces total time to run the benchmarks by about 70 secs at present, because linter benchmark takes 6 mins alone and holds up the whole process (all the rest are done in ~2 mins). If we can split up the linter benchmark, we can likely get total run time down to around 3 mins. I'll try that in a follow-on PR.

I guess the other upside is we can now add as many benchmarks as we like with impunity - they'll run in parallel, and so won't slow things down overall.
2024-03-18 10:45:44 +08:00
renovate[bot]
e146b8d3c4
chore(deps): update vscode npm packages (#2748) 2024-03-17 16:41:40 +00:00
renovate[bot]
1e9c0bc484
chore(deps): update rust crates (#2747) 2024-03-17 16:40:42 +00:00
Wang Wenzhe
2ef4762de8
feat(linter/tree-shaking): add cache for checking mutating identifiers (#2743) 2024-03-18 00:35:15 +08:00
Jose
f5b4599fd5
feat(linter): eslint/no-ternary (#2744)
Rule detail: https://eslint.org/docs/latest/rules/no-ternary

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-17 22:05:13 +08:00
Jose
6189985e9e
feat(linter): eslint/no-continue (#2742)
Rule detail: https://eslint.org/docs/latest/rules/no-continue

It's my first time in Rust, so I have a lot to learn from you. Maybe I
do some silly mistakes. Sorry!

---------

Co-authored-by: j.buendia <j.buendia>
2024-03-17 21:21:43 +08:00
Andi Pabst
91e8a71214
feat(linter): eslint/no-with (#2741)
Relates to #479 

Rule detail: https://eslint.org/docs/latest/rules/no-with
2024-03-17 19:53:55 +08:00
Andi Pabst
81752b2790
feat(linter): eslint/max-lines (#2739)
Relates to #479 

Rule detail: https://eslint.org/docs/latest/rules/max-lines
2024-03-17 18:59:47 +08:00
cinchen
0623a5335f
feat(linter): eslint-plugin-jest: prefer-to-contain (#2735)
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-to-contain.ts)
2024-03-17 09:44:01 +08:00
overlookmotel
78f1adc043
chore(napi): remove oxc-parser from benchmarks (#2738)
#2724 added CodSpeed benchmarks for NodeJS `oxc-parser`.

Unfortunately it turns out CodSpeed's results are wildly inaccurate.
Unclear why, but have raised an issue with CodSpeed
(https://github.com/CodSpeedHQ/action/issues/96). In meantime it seems
best to remove the benchmarks as they're not useful at present.
2024-03-16 23:39:23 +08:00
Boshen
57bf9857d3
chore(benche): remove redundant black_box because we are using codspeed 2024-03-16 18:59:19 +08:00
Boshen
178d205d53
chore: criterion2 (#2737) 2024-03-16 18:55:04 +08:00
Valerii Smirnov
26a8171b98
implemented import/no-default-export (#2736)
Tests:
https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/tests/src/rules/no-default-export.js
Rule:
https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/docs/rules/no-default-export.md

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-03-16 13:14:07 +08:00
cinchen
9edda499aa
feat(linter): eslint-plugin-jest: prefer-expect-resolves (#2703)
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-expect-resolves.ts)
2024-03-16 10:08:10 +08:00
overlookmotel
692e9bcab4
chore(napi): only enable Codspeed plugin on CI (#2733)
When running NAPI benchmarks locally, Codspeed plugin hides the
benchmark results.
2024-03-15 15:22:49 +00:00
overlookmotel
75226f3b4a
chore: silence erroneous RA warnings for Tsify (#2731) 2024-03-15 12:42:12 +00:00
overlookmotel
af47aebc7c
chore(napi): add oxc-parser to benchmarks (#2724)
Closes #2616.

Adds benchmarks for NodeJS NAPI build. Measurement includes `JSON.parse`
of the AST on JS side, since that's how it'll be used 99% of the time.

Benchmarks run against same files as Rust parser benchmarks, so we can
see the overhead of transferring AST to JS.
2024-03-15 19:45:02 +08:00
underfin
d7004da253
perf(sourcemap): remove unnecessary binary search (#2728)
Becuase `position` argument is ordering, using binary search is
unnecessary.
2024-03-15 18:50:53 +08:00
Boshen
125edb2650
refactor: remove unused dependencies (#2729) 2024-03-15 18:43:22 +08:00
underfin
2be5f9d6c9
perf(codegen): avoid unnecessary copy (#2727) 2024-03-15 16:09:24 +08:00
Boshen
798a1fde09
fix(parser): fix failed to parse JSXChild after JSXEmptyExpression (#2726)
fixes #2723
2024-03-15 13:39:20 +08:00
Yuji Sugiura
53a8e7ffbe
feat(linter): Add settings.jsdoc (#2706)
Base work for #2642 🏃🏻 

- [x] struct
- [x] bool flags
- [x] tagNamePreferences
2024-03-14 22:34:32 +08:00
cinchen
4947809772
feat(linter/jest): add new property for parse_jest_fn (#2715)
This pr is to add a new return value: `local`, which current property
`name` always return `expect` and the `local` property will return its
alias name for the following example:

```js
import { expect as JEST_EXPECT } from '@jest/globals';
```

and the `jest_expect_fn_call.name` will return `expect` and the
`jest_expect_fn_call.local` wil return `JEST_EXPECT`.
2024-03-14 21:06:05 +08:00
Boshen
a5ddb5b452
Release crates v0.10.0 2024-03-14 18:23:34 +08:00
Boshen
cbc2f5ff97
refactor: remove unused dependencies (#2718) 2024-03-14 17:50:31 +08:00
Boshen
945265a33e
chore: format wasm/parser/Cargo.toml 2024-03-14 17:25:53 +08:00
Boshen
697b6b70c0
feat: merge features serde and wasm to serialize (#2716)
This PR merges the previous confusing features `serde` and `wasm` into a
single `serialize` feature.

We'll eventually do serialize + type information for both wasm and napi
targets.

`oxc_macros` is removed from `oxc_ast`'s dependency because it requires
`syn` and friends, which goes against our policy ["Third-party
dependencies should be
minimal."](https://oxc-project.github.io/docs/contribute/rules.html#development-policy)
2024-03-14 17:13:12 +08:00