Boshen
e4d94dc379
chore(cli): improve help message ( #3309 )
...
Added a CLI page https://oxc-project.github.io/docs/guide/usage/linter-cli.html
2024-05-16 11:53:33 +00:00
Boshen
8ab9856dea
feat(cli,linter): add --disable-react/unicorn/typescript-plugin ( #3305 )
...
closes #1970
2024-05-16 10:15:08 +00:00
Dunqing
9ee962add8
feat(transformer): support from_babel_options in TransformOptions ( #3301 )
...
Move `BabelOptions` to Transformer. The `output.json` is a standard babel configuration. We can reuse BabelOptions to read [babel.config.json](https://babeljs.io/docs/configuration#babelconfigjson ) or our configuration(maybe oxc.config.json)
The current `from_babel_options` implementation is copied from the `transform_options` in `test_case.rs`, which I'll completely reimplement next
2024-05-16 10:10:39 +00:00
Boshen
bd8a0ddb7f
feat(linter): no-barrel-file ( #3275 )
...

2024-05-16 07:54:09 +00:00
Ali Rezvani
d46538ed68
fix(linter/react): fix loop hooks false positives. ( #3297 )
...
It is a temporary fix for false positives like
[this](https://github.com/oxc-project/oxc/issues/3257#issuecomment-2110199442 ).
Uses the node's ancestors for now instead of the cfg.
2024-05-16 11:03:54 +08:00
Boshen
33386ef197
perf(ast): inline all ASTBuilder methods ( #3295 )
2024-05-15 22:16:16 +08:00
Boshen
e12323f4f9
fix(linter/no-direct-mutation-state): false positive when class is declared inside a CallExpression ( #3294 )
...
fixes #3290
2024-05-15 14:07:02 +00:00
Dunqing
b9d69ad665
feat(transformer): do not add self attribute in react/jsx plugin ( #3287 )
...
follow-up: https://github.com/oxc-project/oxc/pull/3258 .
2024-05-15 17:59:57 +08:00
Wang Wenzhe
61281711f0
refactor(linter): rewrite react/require-render-return ( #3276 )
...
Closes : #3245
It's gone now, curious about why didn't have performance improvement.

This picture generated by running all the rules.
2024-05-15 16:40:46 +08:00
Don Isaac
a12ed0fd26
fix(codegen): using declaration in for statement ( #3285 )
...
Fixes conformance tests for `using` declarations in for statements, e.g.
```ts
for (using x = 1;;) {}
```
2024-05-14 23:10:47 -04:00
Don Isaac
5b2fc391bc
feat(linter): add use-isnan fixer for (in)equality operations ( #3284 )
...
Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-15 02:20:52 +00:00
Don Isaac
508dae6f8f
perf(lexer): dedupe numeric separator check ( #3283 )
...
## What This PR Does
Updates numeric literal token lexing to record when separator characters
(`_`) are found in a new `Token` flag. This then gets passed to
`parse_int` and `parse_float`, removing the need for a second `_` check
in those two functions.
When run locally, I see no change to lexer benchmarks and minor
improvements to codegen benchmarks. For some reason, semantic and source
map benches seem to be doing slightly worse.
Note that I attempted to implement this with `bitflags!` (making
`escaped` and `is_on_newline` flags as well) and this caused performance
degradation. My best guess is that it turned reads on these flags from a
`mov` to a `mov` + a binary and.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-15 01:48:21 +00:00
overlookmotel
dad47a553e
refactor(transformer): improve indentation ( #3282 )
...
Improve indentation in code. Not sure why rustfmt didn't do this already.
2024-05-14 17:53:11 +00:00
Boshen
482dcc0aed
chore(traverse): revert the build script
2024-05-15 00:07:56 +08:00
Boshen
6d63f99500
Release crate oxc_traverse v0.13.0
2024-05-14 23:15:27 +08:00
Boshen
23b39169a6
Release crate oxc_ast_macros v0.13.0
2024-05-14 23:15:20 +08:00
Boshen
c395f8641e
Release crates v0.13.0
2024-05-14 23:14:15 +08:00
Dunqing
b4fa27a2ee
fix(transformer): do no add __self when the jsx is inside constructor ( #3258 )
2024-05-14 16:12:49 +01:00
overlookmotel
65540c0118
fix(traverse): set ScopeFlags::Function bit for class methods ( #3277 )
2024-05-14 21:33:59 +08:00
overlookmotel
6fd7a3c427
fix(traverse): create scopes for functions ( #3273 )
...
Fix bug with:
1. scopes not being created for functions.
2. too many scopes being created for class methods.
i.e. Logic for when `Function` creates a scope was opposite of what it
should be.
Discovered by @Dunqing in
https://github.com/oxc-project/oxc/pull/3258#pullrequestreview-2054259476 .
2024-05-14 18:27:18 +08:00
Pig Fang
56346d59da
chore(linter): expose Message:start and Message:end ( #3268 )
...
Expose the `start` and `end` field for modification in downstream
projects.
2024-05-14 08:48:05 +00:00
Boshen
b27a905958
refactor(parser): simplify Context passing ( #3266 )
2024-05-14 12:22:27 +08:00
Boshen
c4ccf9f4d8
fix(parser): parse DecoratorCallExpression when Arguments contains MemberExpression ( #3265 )
...
closes #3261
closes #3262
```
DecoratorCallExpression[Yield, Await] :
DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
```
2024-05-14 03:18:41 +00:00
Jelle van der Waa
3644400aed
feat(linter/eslint): Implement fixer for unicode-bom rule ( #3259 )
2024-05-14 09:57:01 +08:00
Boshen
f6daf0b7ae
feat(sourcemap): add feature "sourcemap_concurrent"
2024-05-14 00:05:27 +08:00
Dunqing
eefb66f750
feat(ast): add type to AccessorProperty to support TSAbractAccessorProperty ( #3256 )
2024-05-13 12:35:58 +00:00
Boshen
6edcae86cd
feat(linter): move react/rules_of_hooks to nursery
2024-05-13 18:33:04 +08:00
Jelle van der Waa
44b16ef79d
feat(linter/eslint): Implement max-classes-per-file ( #3241 )
...
Rule Detail:
[link](https://eslint.org/docs/latest/rules/max-classes-per-file )
2024-05-13 17:23:01 +08:00
Boshen
edb30e1be8
fix(linter): handle import { default as foo } in import/named ( #3255 )
2024-05-13 08:56:30 +00:00
Dunqing
34dd53cc98
feat(transformer): report ambient module cannot be nested error ( #3253 )
2024-05-13 07:51:06 +00:00
rzvxa
1f135ce4ce
feat(linter/react): add the rules_of_hooks rule. ( #3071 )
...
[RulesOfHooks](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js ), [docs](https://react.dev/reference/rules/rules-of-hooks ), [npm](https://www.npmjs.com/package/eslint-plugin-react-hooks )
This one sounds like something straight out of `Mortal Kombat`!
2024-05-12 19:20:38 +00:00
Boshen
d9e2431acf
chore: improve prefer-enum-initializers error message
2024-05-12 23:33:56 +08:00
Boshen
2fd6d05a4a
chore(linter): change prefer-literal-enum-member from correctness to restriction
2024-05-12 23:32:06 +08:00
Boshen
c6874ad71b
feat(linter): demote no-inner-declarations from correctness to pedantic (eslint v9)
2024-05-12 23:23:52 +08:00
Boshen
4ccc3ee6b2
feat(linter): demote react/jsx-no-useless-fragment from correctness to pedantic
2024-05-12 23:23:46 +08:00
Boshen
893af230c0
refactor: clean up more diagnostics usages
2024-05-12 21:46:03 +08:00
Jelle van der Waa
8244d2be0a
feat(linter/eslint): Implement unicode-bom rule ( #3239 )
...
Rule Detail:
[link](https://eslint.org/docs/latest/rules/unicode-bom )
2024-05-12 11:39:02 +00:00
1zumii
d45b28a3b9
feat(linter): unicorn/no-anonymous-default-export ( #3220 )
...
Refer to
[eslint-plugin-unicorn/no-anonymous-default-export](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v52.0.0/docs/rules/no-anonymous-default-export.md )
link: #684
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-12 11:29:47 +00:00
Boshen
faa2e4b26b
feat(cli): add --symlinks to allow symbolic walking ( #3244 )
2024-05-12 05:52:23 +00:00
Boshen
313fb839b5
fix(linter/default): ignore unsupported files (e.g. .vue)
...
relates #3157
2024-05-12 13:33:29 +08:00
Boshen
b86ef7d2dd
fix(diagnostics): need to escape strings for --format github
...
closes #3212
2024-05-12 13:01:07 +08:00
Boshen
d8173e1000
refactor: remove all usages of Into<Error>
2024-05-12 12:01:26 +08:00
Boshen
dbde5b3a04
refactor(diagnostics): remove export of miette
2024-05-12 11:46:48 +08:00
Boshen
551632a348
refactor(diagnostics): remove thiserror
2024-05-12 11:34:14 +08:00
Boshen
f7a37739c8
refactor(linter): clean up diagnostics
2024-05-12 11:26:51 +08:00
Boshen
570a45add3
refactor(cli): clean up diagnostics
2024-05-12 11:26:51 +08:00
Dunqing
93030e8af9
chore(linter): change the category of all react-perf rules to perf ( #3243 )
...
close : #3242
2024-05-12 10:55:48 +08:00
Boshen
5671714adb
refactor(linter): clean up diagnostics in fixer
2024-05-12 10:45:22 +08:00
Boshen
1b4ebb3166
refactor: run fmt
2024-05-12 01:20:41 +08:00
Boshen
c5588c9b1c
refactor(semantic): clean up redeclaration diagnostic
2024-05-12 01:18:30 +08:00