cinchen
fdef8aec72
fix(linter): jest/vitest rule compat ( #4797 )
...
This pr is for jest/vitest compat and add another jest rule condition
---------
Co-authored-by: Don Isaac <donald.isaac@gmail.com>
Co-authored-by: Wang Wenzhe <mysteryven@gmail.com>
2024-08-29 11:04:00 +08:00
camc314
bb995f6361
feat(jsx-a11y/linter) add fixer for scope ( #5310 )
2024-08-29 00:51:00 +00:00
camc314
e5ead86d43
feat(linter) catch more cases for misrefactored-assign-op ( #5309 )
...
changes from using `without_parenthesis` to using `get_inner_expression` to ignore type casts, non null assertions ect.
this helps catch more error cases
2024-08-29 00:47:38 +00:00
Dunqing
3acb3f6461
fix(transformer/react): mismatch output caused by incorrect transformation ordering ( #5255 )
...
close : #4767
2024-08-29 00:38:02 +00:00
DonIsaac
fa1d460852
refactor(linter): clean up Fixer and Message ( #5308 )
...
- refactor(linter): clean up Fixer and Message
- perf(linter): replace sort_by_key with sort_unstable_by_key in fixer
2024-08-28 23:19:46 +00:00
magic-akari
318479ec4d
fix(linter/no-unused-vars): mark the class/function in the new expression as used ( #5306 )
...
Fix : #5274
2024-08-28 13:38:16 -04:00
magic-akari
08dc0adeab
feat(transformer): add object-spread plugin ( #3133 )
2024-08-28 15:57:20 +00:00
Boshen
5c4c00123d
fix(codegen): print export @decorator declare abstract class Foo correctly ( #5303 )
2024-08-28 15:30:39 +00:00
camc314
6633972663
feat(linter): add fixer for no-empty ( #5276 )
...
adds a suggestion for `no-empty` eslint lint rule
2024-08-28 15:06:29 +00:00
Boshen
7fa2fa386c
refactor(wasm): clean up code and add transform ( #5299 )
...
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-28 22:14:35 +08:00
Boshen
8d6b05ca01
fix(transformer): class property with typescript value should not be removed ( #5298 )
2024-08-28 13:53:41 +00:00
Boshen
70091771b6
test(parser): fix incorrect flow error test
2024-08-28 20:53:32 +08:00
Boshen
fb75d2576b
Revert "fix(parser): Revert "check for @flow with recoverable errors as well" ( #5297 )"
...
This reverts commit d4c06ef093 .
2024-08-28 20:53:13 +08:00
overlookmotel
d4c06ef093
fix(parser): Revert "check for @flow with recoverable errors as well" ( #5297 )
...
e1d8b92080 caused CI to fail. Revert it.
2024-08-28 12:48:37 +00:00
Boshen
e1d8b92080
fix(parser): check for @flow with recoverable errors as well
2024-08-28 19:39:07 +08:00
Boshen
5e27798dc3
chore(parser): parse regular expression in example
2024-08-28 19:32:44 +08:00
overlookmotel
b43a3948a1
refactor(traverse): correct code comments ( #5293 )
...
#5286 changed `TraverseCtx::ancestor` to always return an `Ancestor`. Update doc comments to reflect that.
2024-08-28 10:10:04 +00:00
Dunqing
292d162b23
feat(codegen): print missing fields for AccessorProperty ( #5291 )
...
Found in https://github.com/oxc-project/monitor-oxc/actions/runs/10592050362/job/29350666018
2024-08-28 08:42:39 +00:00
Dunqing
5754c89b5e
fix(transformer/typescript): remove accessibility from AccessorProperty ( #5292 )
...
Regression by #5290
2024-08-28 08:42:38 +00:00
Dunqing
550574982f
feat(ast): add accessibility field to AccessorProperty ( #5290 )
2024-08-28 08:42:37 +00:00
Arian94
76e86f80df
fix(linter): eslint-plugin-unicorn prefer-spread wrong linter suggestion on variables of type string ( #5265 )
...
fixes #5248 .
Similar issue found in here:
https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1147
2024-08-28 09:26:44 +01:00
overlookmotel
582ce9ea65
refactor(traverse)!: TraverseCtx::ancestor return Ancestor::None if out of bounds ( #5286 )
...
This aligns it better with `TraverseCtx::parent` which always returns an `Ancestor`.
2024-08-28 05:26:16 +00:00
Kevin Deng 三咲智子
234a24c14d
fix(ast)!: merge UsingDeclaration into VariableDeclaration ( #5270 )
...
relate #2854
2024-08-28 11:26:05 +08:00
leaysgur
15b87adb05
chore(regular_expression): Extract diagnostics ( #5287 )
...
- Extract `Diagnostic::error()`s to separate file
- Align error message prefix
2024-08-28 03:19:29 +00:00
camc314
d6b84ec44e
fix(linter) bug in fixer for no-null ( #5273 )
...
i tested this in the microsoft/vscode repo and there were no syntax errors after running the fixer 🎉
hopefully this is the last fix.
2024-08-28 02:14:38 +00:00
Boshen
e6fd52e2a6
fix(parser): change unterminated regex error to be non-recoverable ( #5285 )
...
closes #5257
2024-08-28 01:57:31 +00:00
leaysgur
cffce11620
fix(regular_expression): Prevent panic on too large number ( #5282 )
...
Partially close #5257
Use `checked_(mul|add)` to prevent panic.
2024-08-28 01:31:54 +00:00
overlookmotel
d71f0ed2d0
refactor(traverse): inline all passthrough methods ( #5279 )
...
Many methods of `TraverseCtx` just delegate to methods of `TraverseAncestry` or `TraverseScoping`. Mark them all `#[inline]`.
2024-08-28 01:07:11 +00:00
overlookmotel
188ce0766f
refactor(traverse): improve safety via type system ( #5277 )
...
Guard against mistakes in `oxc_traverse` codegen by making it impossible to pop from ancestors stack more times than have pushed.
2024-08-28 01:07:11 +00:00
overlookmotel
0f4a8b39d3
refactor(traverse): add debug asserts for safety invariants ( #5272 )
...
Add `debug_assert!`s for unchecked invariants.
2024-08-28 01:07:11 +00:00
overlookmotel
341e42ac4c
refactor(traverse): make Ancestor an owned type ( #5269 )
...
Make the `Ancestor` type used in `oxc_traverse` an owned type. Instead of `TraverseCtx::parent` returning a `&'t Ancestor<'a>`, it now returns an `Ancestor<'a, 't>`.
This allows `Ancestor` to be `Copy`.
The `'t` lifetime plays the same role in both cases - preventing any `Ancestor` from escaping from the `enter_*` / `exit_*` method in which it's obtained.
Same for the `*Without*` types which are `Ancestor` enum's "payloads". Any AST node references obtained from an `Ancestor` are also constrained by same `'t` lifetime - e.g. `&'t Statement<'a>`.
2024-08-28 01:07:10 +00:00
camc314
c8e85323cb
feat(linter/unicorn): add fixer to throw-new-error ( #5275 )
...
got merged into the wrong branch (https://github.com/oxc-project/oxc/pull/5148 ), hence setting to merge when ready (as was already approved)
2024-08-27 20:51:35 +00:00
Kevin Deng 三咲智子
681bd8071a
fix(wasm): reference ast from prettier ( #5268 )
...
regression by cc3332898c
2024-08-27 22:15:26 +08:00
overlookmotel
c23104b2a2
feat(wasm): output symbol IDs in scope tree ( #5266 )
...
`oxc_wasm` include `SymbolId`s in print-out of scopes.
2024-08-27 13:49:44 +00:00
overlookmotel
6a49dc36b2
perf(wasm): generate scope text with visitor ( #5264 )
...
Follow-on after #5232 . `oxc_wasm` build scopes text with a single AST traversal. Previous implementation was O($n^2$).
If we can assume scopes are listed in traversal order, then we could do it a bit more efficiently just from `ScopeTree`, but this approach of using `Visit` will handle out-of-order scope IDs (which you'd get if printing a post-transform `ScopeTree`).
Also reduce creating and discarding `String`s for indentation - reuse a single string instead.
2024-08-27 13:49:42 +00:00
overlookmotel
05d25e2aa3
refactor(semantic): combine add scope methods ( #5262 )
...
#5232 removed `ScopeTree::child_ids`, so it's no longer necessary to have separate `add_scope` and `add_root_scope` methods.
2024-08-27 13:00:21 +00:00
overlookmotel
17d8a88415
fix(wasm): display correct scope IDs ( #5263 )
...
`ScopeId`s were printed incorrectly. `+ 1` used to be correct, but isn't
any more since `ScopeId` became a `NonMaxU32`.
2024-08-27 20:39:07 +08:00
overlookmotel
fdedc0f8b1
refactor(semantic): transform checker: rename SemanticData to Scoping ( #5261 )
...
Pure refactor. Rename type and vars with a more descriptive name.
2024-08-27 11:58:21 +00:00
overlookmotel
10861096e0
refactor(semantic): transform checker do not output spans in errors ( #5260 )
...
Transform checker don't output spans in errors. They're inaccurate because (a) spans refer to the source text pre-transform, and (b) most errors relate to scopes/symbols/references newly created in transformer, which have no span.
2024-08-27 11:58:21 +00:00
overlookmotel
af5713e411
refactor(semantic): transform checker continue checks if missing IDs ( #5259 )
...
Transform checker don't bail out if some IDs missing from AST. Continue to check for other problems.
Also simplify iterating over pairs of IDs.
2024-08-27 11:58:20 +00:00
overlookmotel
943454fa5e
refactor(semantic): update transform checker for no conditional scopes ( #5252 )
...
All scopes are now unconditional (#5008 ). Update transform checker to reflect this.
2024-08-27 08:57:15 +00:00
Kevin Deng 三咲智子
cc3332898c
perf(wasm): reuse parse result for prettier ( #5254 )
2024-08-27 16:56:18 +08:00
overlookmotel
892a7fab60
refactor(semantic): replace ref syntax ( #5253 )
...
Pure code style refactor. Prefer `if let Some(y) = &x.y` over `if let Some(ref y) = x.y`.
2024-08-27 08:13:14 +00:00
overlookmotel
cbb47252ba
refactor(semantic): add comment to transform checker ( #5250 )
...
Add back a doc comment which was accidentally removed in #5232 .
2024-08-27 07:38:52 +00:00
Boshen
fea2746b73
chore: switch playground to https://github.com/oxc-project/playground ( #5249 )
...
playground app: https://oxc-playground.netlify.app/
2024-08-27 15:14:36 +08:00
Boshen
484f0d7579
fix(wasm): fix broken prettier
2024-08-27 14:25:25 +08:00
Kevin Deng 三咲智子
8b53ef9b27
feat(wasm): add option preserve_parens ( #5237 )
2024-08-27 12:10:08 +08:00
Dunqing
9953fa54a4
fix(linter/no-null): incorrect fixer for NullLiteral within ReturnStatement ( #5247 )
...
close : #5194
It’s a long time no contributed to Linter, I'd like to try it
2024-08-27 03:51:56 +00:00
Billy Levin
a6e97690a7
feat(linter/jsx-a11y): add label-has-associated-control ( #5163 )
2024-08-26 23:33:55 -04:00
Boshen
a17cf33dc3
refactor(semantic): remove ScopeTree::child_ids ( #5232 )
...
closes https://github.com/oxc-project/oxc/issues/5244
2024-08-27 01:49:47 +00:00