Commit graph

702 commits

Author SHA1 Message Date
Boshen
9ff7986610
feat(prettier): handle binaryish expression in return statement (#2388) 2024-02-11 20:01:25 +08:00
Boshen
871a73afdd
fix(prettier): semi colon after class property (#2387) 2024-02-11 19:25:38 +08:00
Dunqing
0df7e296f9
feat(tasks/codegen): check node version >= 20 (#2385)
This syntax only works on node >= 20
`import value from './json-value-array_FIXTURE.json' with { type: 'json'
};`
2024-02-11 19:23:11 +08:00
Boshen
15a8857927
refactor(prettier): improve print_statement_sequence (#2383) 2024-02-11 00:16:26 +08:00
Boshen
82a6dc17d3
feat(pretter): implement print_binaryish_expressions (#2382) 2024-02-10 23:18:56 +08:00
Boshen
2dfe5210bb
fix(prettier): print strings as raw strings (#2380) 2024-02-10 17:52:17 +08:00
Boshen
642484e2cb
feat(prettier): print newlines between array expression elements (#2379) 2024-02-10 17:31:09 +08:00
Boshen
ef336cb66b
feat(parser): recover from async x [newline] => x (#2375)
```javascript
async x
=> x
```

Babel recovers and displays "No line break is allowed before '=>'
2024-02-10 11:19:08 +08:00
Boshen
70c983d4bb
feat(prettier): print rest parameters (#2370) 2024-02-09 22:59:28 +08:00
Boshen
9b6c313ebf
fix(prettier): flatten all binary expressions for now (#2367) 2024-02-09 21:48:27 +08:00
Boshen
90a834f87b
chore: update snapshot 2024-02-09 21:08:39 +08:00
Dunqing
2eb489e996
fix(codegen): format new expession + import expression with the correct parentheses (#2346)
Similar to #2330
2024-02-09 20:51:50 +08:00
Dunqing
e4754873ee
fix(prettier): printing value instead of key in BindingProperty (#2334)
fix: #2314
2024-02-08 21:49:10 +08:00
Boshen
5d9b0f3312
ci: speed up benchmark build (#2343)
closes #2299

Managed to figure out what `cargo codspeed build` is doing :-)
2024-02-08 19:47:50 +08:00
overlookmotel
aef593fb50
parser(refactor): promise only one Source on a thread at a time (#2340)
Introduce invariant that only a single `lexer::Source` can exist on a thread at one time.

This is a preparatory step for #2341.

2 notes:

Restriction is only 1 x `ParserImpl` / `Lexer` / `Source` on 1 *thread* at a time, not globally. So this does not prevent parsing multiple files simultaneously on different threads.

Restriction does not apply to public type `Parser`, only `ParserImpl`. `ParserImpl`s are not created in created in `Parser::new`, but instead in `Parser::parse`, where they're created and then immediately consumed. So the end user is also free to create multiple `Parser` instances (if they want to for some reason) on the same thread.
2024-02-08 14:51:17 +08:00
Dunqing
3268d7d66e
feat(tasks/prettier): add some information for debug no spec calls (#2333) 2024-02-07 16:55:59 +08:00
Boshen
e8dc68c525
chore: update prettier to v3.2.5 (#2332) 2024-02-06 22:55:43 +08:00
Dunqing
55011e2793
feat(codegen): avoid printing comma in ArrayAssignmentTarget if the elements is empty (#2331) 2024-02-06 22:45:19 +08:00
Boshen
43a9cb5522
chore: update snapshot 2024-02-06 22:17:59 +08:00
Dunqing
a3570d41f0
feat(semantic): report parameter related errors for setter/getter (#2316) 2024-02-05 17:38:43 +08:00
Dunqing
9ca13d040d
feat(semantic): report type parameter list cannot be empty (#2315) 2024-02-05 16:05:51 +08:00
Dunqing
d6d931cd80
fix(tasks/coverage): when providing filter, do not run just submodules (#2310) 2024-02-05 15:06:37 +08:00
Dunqing
f53c54ced9
feat(semantic): report unexpected type annotation in ArrayPattern (#2309) 2024-02-05 13:45:52 +08:00
overlookmotel
73ec4df61c
chore(benchmark): add radix-ui.jsx as a real world jsx example (#2304)
Following #2297, this adds another benchmark.

This one is from radix-ui website. I've chosen this particular file
because it differs from the other benchmark sources in 3 ways:

1. JSX not TSX (despite the file extension).
2. Contains no logic, only JSX component hierarchy, and content text.
3. Very small (60 LOC).

The last is particularly important, I think. Often developers will be
working on small files (single component per file convention). And some
possible directions for the parser (SIMD etc) involve optimizing chewing
through chunks of text, with a de-opt at the end to process the final
batch of bytes. If that imposes a penalty on short files, this benchmark
will surface it.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-05 13:42:45 +08:00
Boshen
018674c56c
chore(benchmark): add cal.com.tsx as a realword tsx example (#2297)
closes #1884
2024-02-04 22:40:55 +08:00
underfin
2f97b332bd
chore: codegen test skip v8 failed test (#2283)
Because v8 isn't pass some test262 tests, we also need to skip them, you
can find it at
https://chromium.googlesource.com/v8/v8/+/refs/heads/main/test/test262/test262.status.
2024-02-04 14:02:39 +08:00
Boshen
d2f7ea2923
chore: manually clone git modules instead of using submodules (#2274)
closes #2231

Submodules are a blocker for beginners, we should make it clone on
demand.

It is also a blocker for people who wants to target this repo as a crate
for testing purposes, cargo will do a full clone if you specify
oxc_parser = { git = "this repo" } in Cargo.toml
2024-02-02 11:56:18 +00:00
Boshen
28daf83b19
feat(semantic): report no class name error (#2273)
closes #2144
2024-02-02 19:05:00 +08:00
kaykdm
2ceba79dcd
feat(tasks): add eslint-plugin-n rulegen (#2272)
related: https://github.com/oxc-project/oxc/issues/493

Support generate rules from
[eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n).
2024-02-02 18:50:58 +08:00
Boshen
d7feadedb4
chore(lint_rules): deprecated eslint no-dupe-args / no-octal / no-with
These are strict mode errors.

Closes #2257
2024-02-02 17:33:54 +08:00
Dunqing
8e221cb26e
fix(transformer): update snapshot (#2268) 2024-02-02 17:00:44 +08:00
Boshen
650f6c942f
refactor: use our forked version of miette::Reporter for tests (#2266) 2024-02-02 16:15:31 +08:00
Dunqing
da2ffdf7a0
feat(semantic): check parameters property (#2264) 2024-02-02 15:58:32 +08:00
Dunqing
d71175e712
feat(semantic): check optional parameters (#2263) 2024-02-02 15:54:04 +08:00
Boshen
8d99a15ac9
feat(semantic): report error on optional variable declaration in TypeScript (#2261)
closes #2253
closes #2255
2024-02-02 14:13:10 +08:00
hjio
a95a16c2ae
feat(linter): complete custom components setting (#2234)
- add custom components setting
- let tasks/rulegen generate settings

---------

Co-authored-by: huangjunjie.coder <huangjunjie.coder@bytedance.com>
2024-02-01 23:28:11 +08:00
Tzvi Melamed
73ccf8a4da
fix(oxc_semantic): proper traversal of try statements (#2250)
Closes #2227
2024-02-01 20:46:38 +08:00
Dunqing
02c18d8506
feat(transformer/decorators): support for static and private member decorators (#2246) 2024-02-01 15:19:14 +08:00
Dunqing
ba85b097e0
feat(transformer/decorators): support method decorator and is not static (#2238) 2024-02-01 11:36:22 +08:00
Dunqing
a79988d5e2
feat(transformer/decorators): support static member (#2235) 2024-01-31 19:11:27 +08:00
Dunqing
3b85e1813b
feat(transformer/decorators): ensure property key consistency (#2233) 2024-01-31 19:05:52 +08:00
Wenzhe Wang
5fb5d8a01e
chore(tasks): update codegen runtime snapshot (#2223) 2024-01-31 12:25:28 +08:00
renovate[bot]
d7a9bcf191
chore(deps): update rust crates (#2199) 2024-01-30 15:30:22 +08:00
Dunqing
f59e87f9c4
refactor(semantic): checking label in ContinueStatement based on LabelBuilder (#2202) 2024-01-29 18:24:42 +08:00
Dunqing
56adfb1a86
refactor(semantic): use LabelBuilder instead of UnusedLabeled (#2184)
I think `UnusedLabeled` can do more than that.

1. Collect unused label
2. Support check duplication label
3. Support check label in `BreakStatement`
4. Support check label in `ContinueStatement` (Not yet)

But then the `UnusedLabeled` name wouldn't fit, so I renamed it
`LabelBuilder` and moved it to `label.rs`
2024-01-29 15:15:07 +08:00
renovate[bot]
4b83d97c3b
chore(deps): update cargo (#2191) 2024-01-29 11:38:47 +08:00
Yuji Sugiura
41fb7ef7e7
chore(tasks/lint_rules): Arrange UI (#2187)
Part of #2020

- [x] rule counters
- [x] show two tables
- [x] omit all the deprecated rules

Eventually I decided to split them into 3 tables.

In order to be aware of the newly deprecated rules in the future, the
deprecated rules are hidden by default, rather than omitted altogether.
2024-01-28 22:25:33 +08:00
Boshen
87b9978859
refactor: move all miette usages to oxc_diagnostics 2024-01-28 16:52:16 +08:00
Boshen
87bc19830e
chore(tasks/lint_rules): change typescript issue number 2024-01-26 16:20:39 +08:00
Yuji Sugiura
cba8a4c131
feat(tasks): Enable tasks/lint_rules(JS ver) (#2177)
- [x] Remove old task(Rust ver)
- [x] Migrate to new task(JS ver)
- [x] Confirm CI works w/o `--output`
-
https://github.com/oxc-project/oxc/actions/runs/7663961642/job/20887579432?pr=2177
- [x] Confirm CI works w/ fake issue no
  - https://github.com/oxc-project/oxc/issues/2117
- [x] Enable

- - -

I've noticed that

- eslint/no-extra-semi
- eslint/no-mixed-spaces-and-tabs

are maked as deprecated and also recommended.

This is ESLint side
[issue](https://github.com/eslint/eslint/pull/17696#issuecomment-1792452766)
and will fix after v9.
2024-01-26 15:45:05 +08:00