overlookmotel
9590eb0cf4
fix(transform): implement transform-react-display-name with bottom-up lookup ( #3183 )
...
Sliced off from #3152 .
Re-implement `transform-react-display-name` using bottom-up lookup
provided by `Traverse` trait.
This fixes the 1 remaining failing test case for this plugin (see
#2937 ).
`Traverse` is not complete yet (see #3182 ), so this is also not ready to
merge yet.
2024-05-08 15:33:39 +00:00
Boshen
15f275f572
refactor(linter): reduce llvm lines generated by RuleEnum::read_json ( #3207 )
...
Previous:
```
Lines Copies Function name
----- ------ -------------
9150 (1.1%, 13.8%) 1 (0.0%, 8.2%) oxc_linter::rules::RuleEnum::read_json
```
After:
```
2285 (0.3%, 36.2%) 1 (0.0%, 40.3%) oxc_linter::rules::RuleEnum::read_json
```
2024-05-08 21:53:06 +08:00
overlookmotel
be958ce299
refactor(transform): transformer use Traverse ( #3182 )
...
Sliced off from #3152 .
This switches the transformer over to use `Traverse` instead of
`VisitMut`.
This is incomplete - scopes are not implemented yet. At present, no
transforms use scopes anyway, so all tests pass, but regardless I don't
think should be merged until the implementation is complete.
2024-05-08 17:18:40 +08:00
Wang Wenzhe
cba1e7f463
chore(linter): shorten eslint/eqeqeq rule error message's span ( #3193 )
2024-05-08 14:32:57 +08:00
Boshen
7363e14335
feat(sourcemap): add "rayon" feature ( #3198 )
2024-05-07 23:47:36 +08:00
overlookmotel
5329b0f260
refactor(transform): fix doc comments for methods generated by inherit_variants! macro ( #3195 )
...
Nit: Remove whitespace from doc comments for methods generated by
`inherit_variants!` macro.
2024-05-07 15:16:43 +01:00
overlookmotel
a4f881fff4
docs(transform): improve docs for TraverseCtx::ancestors_depth ( #3194 )
...
Update doc comment to clarify what `TraverseCtx::ancestors_depth`
returns.
2024-05-07 15:15:40 +01:00
Boshen
ed3fa399a6
feat(linter): add --format github for github check annotation ( #3191 )
...
closes #480
2024-05-07 20:55:10 +08:00
overlookmotel
c6bd616456
docs(ast): document enum inheritance ( #3192 )
...
Add more docs for AST type enum inheritance and the `inherit_variants!`
macro.
This covers the changes made in #3115 .
2024-05-07 20:28:15 +08:00
Boshen
82bd97d420
refactor(diagnostics): use a trait to implement the reporters ( #3190 )
2024-05-07 18:44:03 +08:00
Dunqing
fa0093b222
feat(linter): eslint-plugin-next/no-page-custom-font ( #3185 )
2024-05-07 09:53:43 +00:00
Boshen
4defe37f12
feat(linter): remove deprecated eslint v9 rules no-return-await and no-mixed-operators ( #3188 )
2024-05-07 17:17:31 +08:00
Boshen
ca9f13f4f2
feat(linter): eslint/no-new-native-nonconstructor ( #3187 )
...
feat(linter): eslint/no-new-native-nonconstructor
closes #3179
remove no new symbol
2024-05-07 17:10:17 +08:00
Boshen
7338364219
perf(lexer): improve comment building performance by using a vec instead of btreemap ( #3186 )
...
closes #2693
2024-05-07 16:43:27 +08:00
Jelle van der Waa
5081652bc1
feat(linter/eslint): Implement no-empty-function rule ( #3181 )
...
Rule Detail:
[link](https://eslint.org/docs/latest/rules/no-empty-function )
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-07 02:56:13 +00:00
Dunqing
5514936f51
feat(linter): eslint-plugin-next/no-styled-jsx-in-document ( #3184 )
2024-05-07 10:35:28 +08:00
overlookmotel
762677e17b
refactor(transform): retag_stack use AncestorType ( #3173 )
...
Make the code for `retag_stack` in `walk_*` functions more
comprehensible, by replacing hard-coded enum discriminants as integers
with an `AncestorType` type.
Alternative solution to the problem raised in #3170 .
close : #3170
2024-05-06 18:53:41 +01:00
Wang Wenzhe
c0abbbd204
feat(linter/tree-shaking): add isPureFunction ( #3175 )
2024-05-07 00:03:04 +08:00
Cameron
07076d9765
feat(linter) improve prefer-string-starts-ends-with rule ( #3176 )
...
basically:
`^#/i.test(hex)` is the same as `/^#/.test(hex)`
so, in this case the `i` flag does nothing and we can safely ignore it
inspired by https://x.com/the_moisrex/status/1787444601571221892
---
This could potentially lead a new `oxc` rule called
`no_useless_case_insensitive_regex_flag` that reports if you have a
regex with the `i` flag with no ascii alphabetic chars.
2024-05-06 23:52:19 +08:00
Boshen
cb2e651eea
feat(linter): eslint-plugin-next/no-duplicate-head ( #3174 )
...
closes #2438
2024-05-06 19:43:38 +08:00
Boshen
a84454cf87
refactor(linter): clean up prefer_node_protocol and move to restriction ( #3171 )
...
closes #3161
2024-05-06 12:43:24 +08:00
overlookmotel
be87ca8419
feat(transform): oxc_traverse crate ( #3169 )
...
First part of #3152 .
This adds a crate `oxc_traverse`, but doesn't connect it up to the
transformer or anything else yet.
I think we could merge this now - as it doesn't affect any code that's
in use - and then iterate on it to add scopes before using it in
transformer. Please see
https://github.com/oxc-project/oxc/pull/3152#issuecomment-2094965406 for
the broader picture.
2024-05-06 09:37:04 +08:00
Dunqing
f88f330426
feat(linter/import): improve multiple exports error message ( #3160 )
...
https://github.com/oxc-project/oxc/issues/3157#issuecomment-2094113518
2024-05-04 22:14:26 +08:00
Boshen
d78edb1eb5
chore(linter): move more import plugin rules out of nursery
2024-05-04 19:07:25 +08:00
Dunqing
6f5df113af
feat(linter/import): move some rules out of nursery ( #2841 )
...
### Correctness
- named
- export
- default
- namespace
- no-unresolved
The above rules will prevent bugs or broken, so I changed these to
correctness
### Suspicious
- no-duplicates
- no-named-as-default-member
- no-named-as-default
I'm still not sure whether the `no-unresolved` rule should be changed to
`correctness`. Because I found that the rule reported a lot in the
AFFiNE. But in fact, they are all correct reports
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-05-04 18:51:26 +08:00
Boshen
fde7d65992
fix(linter): handle named export default in import-plugin/named ( #3158 )
2024-05-04 17:40:56 +08:00
Boshen
b1bddacd09
fix(linter): fix hang if a file fails to parse while using --import-plugin
2024-05-04 17:16:43 +08:00
Boshen
222030c4c5
refactor(linter): render --rules in a table
2024-05-04 15:31:20 +08:00
Wang Wenzhe
32df6d779c
feat(linter/tree-shaking): support While/Switch/Yield Statement ( #3155 )
...
All test cases passed now. There are something remain. I'll change the category when it's ready.
- [ ] Port [`isPureFuncion`](96f0d1c825/src/utils/helpers.ts (L53-L67) ), [pure-function](198432ecc9/src/utils/pure-functions.ts )
- [ ] Support [options](463fa1f0be/src/rules/no-side-effects-in-initialization.ts (L1130-L1138) )
- [ ] Clean TODO
- [ ] Add more support of operator computation. [The original version](463fa1f0be/src/rules/no-side-effects-in-initialization.ts (L139-L210) ) is straightforward benefit of JS. We only [support Number](f91a063616/crates/oxc_linter/src/utils/tree_shaking.rs (L194) ) now.
2024-05-03 23:21:28 +08:00
Wang Wenzhe
8290421e72
feat(linter/tree-shaking): support SequenceExpression ( #3154 )
2024-05-03 23:19:36 +08:00
Wang Wenzhe
5c21b7f843
feat(linter/tree-shaking): support UnaryExpression ( #3153 )
2024-05-03 23:17:15 +08:00
renovate[bot]
56a0db8621
chore(deps): update dependency rust to v1.78.0 ( #3151 )
2024-05-03 00:01:42 +08:00
Yuji Sugiura
5a1d63afed
feat(linter/jsdoc): Implement require-yields rule ( #3150 )
...
Part of #1170
>
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields.md
With:
- Fix typo of JSDocPluginSettings
- Update utils/jsdoc
2024-05-02 22:49:19 +08:00
Yuji Sugiura
d7a8345e4c
feat(linter/jsdoc): Support settings.ignore(Private|Internal) ( #3147 )
...
>
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/settings.md#user-content-settings-allow-tags-private-or-internal-to-disable-rules-for-that-comment-block
...and fixed the issue that intended initial settings values are not
used in some cases.
2024-05-01 19:48:28 +08:00
Wang Wenzhe
8cdd5b0fd8
feat(linter/tree_shaking): support LogicExpression and MemberExpression ( #3148 )
...
MemberExpression's message is not accurate, I will update later.
2024-05-01 19:46:40 +08:00
kaykdm
80cf0b2b2e
feat(linter): @typescript-eslint/prefer-literal-enum-member ( #3134 )
...
Related issue: https://github.com/oxc-project/oxc/issues/2180
original implementation
- code: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/prefer-literal-enum-member.ts
- test: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts
- doc: https://typescript-eslint.io/rules/prefer-literal-enum-member/
2024-05-01 11:17:46 +08:00
Dunqing
a52e321b25
feat(transformer/jsx-source): get the correct lineNumber and columnNumber from the span. ( #3142 )
2024-05-01 00:30:47 +00:00
Boshen
f5dccc96fd
refactor(coverage): avoid an String::from_utf8 over head during serialization ( #3145 )
2024-04-30 23:11:22 +08:00
Dunqing
be8fabedab
feat(transformer/react): enable jsx plugin when development is true ( #3141 )
2024-04-30 15:48:17 +08:00
Boshen
a63a45d5b2
refactor(transformer): remove the requirement of Semantic ( #3140 )
...
It seems like we need to rebuild the scopes and symbols while
traversing. We can't utilize the scopes and symbols built by semantic
because they are immutable.
2024-04-30 12:48:21 +08:00
Wang Wenzhe
733361822e
feat(linter/tree-shaking): support JSX ( #3139 )
2024-04-30 11:25:39 +08:00
Wang Wenzhe
16a31e95b8
feat(linter/tree-shaking): support import statement ( #3138 )
2024-04-30 11:23:23 +08:00
Dunqing
b5894964d1
fix(transformer/arrow-functions): should not transform this in class ( #3129 )
2024-04-29 13:44:10 +00:00
Boshen
f1ccbd4856
feat(syntax): add ToJsInt32 trait for f64 ( #3132 )
2024-04-29 21:13:04 +08:00
Boshen
870d11f1bb
feat(syntax): add ToJsString trait for f64 ( #3131 )
2024-04-29 21:00:04 +08:00
Boshen
a8af5de8f5
refactor(syntax): move number related functions to number module ( #3130 )
2024-04-29 18:54:35 +08:00
Dunqing
843318cdbe
refactor(transformer/typescript): reimplementation of Enum conversion based on Babel ( #3102 )
...
The remaining test cases will perform better with a scope
implementation, and while we can implement them without the scope, it
still requires us to do what the scope did.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-04-29 16:26:22 +08:00
Dunqing
905ee3fef1
feat(transformer): add arrow-functions plugin ( #3083 )
...
close : #2983
2024-04-29 08:04:01 +00:00
Boshen
ae6561308c
refactor(syntax): use FxHashMap for ModuleRecord::request_modules ( #3124 )
...
closes #3121
The ordering is not important here.
2024-04-29 03:37:34 +00:00
overlookmotel
514228ad42
deps(allocator): disable serde dep by default ( #3120 )
...
`oxc_allocator` currently depends on `serde`, although it's generally
not required.
This PR puts the dependency behind a feature `serialize`.
NB: `serde` is needed for the crate's tests, but this can be enabled by
adding it to `dev-dependencies` and putting the impls behind
`#[cfg(any(feature = "serialize", test))]`.
2024-04-28 22:17:32 +08:00