Commit graph

3332 commits

Author SHA1 Message Date
overlookmotel
17131d23b8
refactor(prettier): reduce recursion (#3112)
Use a loop rather than recursive function call.
2024-04-27 10:54:14 +08:00
谭光志
cd600fade4
feat(linter): add more "ban-ts-comment" test cases. (#3107)
https://github.com/oxc-project/oxc/issues/2934

| name           | passed | failed |
| -------------- | ------ | ------ |
| ts-expect-error| 14     | 20     |
| ts-ignore      | 15     | 20     |
| ts-nocheck     | 11     | 9      |
| ts-check       | 11     | 8      |
| total          | 51     | 57
2024-04-26 22:54:05 +08:00
Boshen
5d0f165f51
ci: "Coverage and check diff" -> "Check Conformance" 2024-04-26 21:31:44 +08:00
cinchen
bef8a71b9d
feat(linter): eslint-plugin-jest/require-hook (#3110)
part of https://github.com/oxc-project/oxc/issues/492

Rule Detail: [link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/require-hook.ts)
2024-04-26 21:26:28 +08:00
Todor Andonov
388ee5135a
feat(linter): typescript-eslint/prefer-enum-initializers (#3097) 2024-04-26 21:09:05 +08:00
Ali Rezvani
51de41cc7a
fix(index): add example_generated to create the docs. (#3106)
This dummy feature is for generating the documentations made by macros, I've missed it in my initial fork.
2024-04-26 20:37:38 +08:00
Ali Rezvani
df2beb2d75
chore: make oxc_index dependency on serde optional. (#3103)
nothing fancy here, just a simple change.
2024-04-26 20:34:59 +08:00
Yuji Sugiura
5866086d17
feat(linter/jsdoc): Implement no-defaults rule (#3098)
Part of #1170

>
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header
2024-04-26 00:03:21 +08:00
overlookmotel
0185eb2edc
refactor(ast): remove duplicate TSNamedTupleMember representation (#3101)
Removes duplicate representation of a `TSTupleElement` which is a
`TSNamedTupleMember`.

Closes #3100.
2024-04-25 19:16:24 +08:00
Boshen
78875b79fe
feat(transformer): implement typescript namespace (#3025)
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-04-25 10:26:11 +00:00
Ali Rezvani
ac72d08592
chore: cleanup the dependencies on static_assertions and oxc_index. (#3095)
We used to export `static_assertions` as part of the `oxc_index`. It
would've made sense back when it was only a vessel for exporting other
crates - although even then it wouldn't make much sense other than being
convenient - Now with it turning into a port of `index_vec` and
potentially getting bigger as the result of specific needs of the
project; It makes much more sense to stop exporting it from `oxc_index`
and use the crate directly in places that used to use what `oxc_index`
were exporting.


PS: we may want to follow up this with an `oxc_asset` crate containing
our own set of assertion tools which would also export
`static_assertions`.
2024-04-25 16:56:23 +08:00
Ali Rezvani
8618f6b32a
chore(index): fork index_vec crate. (#3092)
related to #3086
2024-04-25 06:09:53 +00:00
Dunqing
2dd96df847
feat(semantic): report namespace related errors (#3093)
See
https://www.typescriptlang.org/play/?target=99#code/GYVwdgxgLglg9mABAIzgEwJ4AoCUiDeAUIomAIYC2ApgM4AOZEViAIgQL6HtA
2024-04-25 14:01:58 +08:00
Yuji Sugiura
fa3d9d23a0
feat(linter/jsdoc): Implement implements-on-classes rule (#3081)
Part of #1170

>
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.md

`contexts` option is not supported for now.
2024-04-25 10:14:28 +08:00
Ali Rezvani
08b2612245
improvement(linter/unicorn): use root_node method in the no_process_exit rule. (#3091) 2024-04-25 09:13:38 +08:00
Ali Rezvani
a43054bec5
improvement(linter/unicorn): use root_node method in the no_empty_file rule. (#3090) 2024-04-25 09:07:40 +08:00
Ali Rezvani
71da1a1d72
improvement(linter/tree_shaking): use root_node in the no_side_effects_in_initialization rule. (#3089) 2024-04-25 09:01:41 +08:00
Ali Rezvani
69e464b19a
improvement(linter/ts): use root_node method in the triple_slash_reference rule. (#3088) 2024-04-25 08:55:29 +08:00
Ali Rezvani
c49f6922c2
improvement(linter/nextjs): use root_node method in no_async_client_component rule. (#3087) 2024-04-25 08:49:30 +08:00
Ali Rezvani
dcb2528861
fix(semantic): revert test code pushed to the main by accident. (#3085)
I'm terribly sorry, I've reverted the wrong commit in #3084.
2024-04-25 08:43:49 +08:00
Ali Rezvani
8d17ab36c3
fix(semantic): allow root_node to be empty for empty trees. (#3084)
related to #3082, #3030 and #3069
2024-04-25 01:10:59 +08:00
Wang Wenzhe
8de7399b08
chore(tasks): observe nursery rule in benchmark (#3082) 2024-04-24 23:03:52 +08:00
Wang Wenzhe
88ded0cef5
feat(linter/tree-shaking): support ForStatement (#3078) 2024-04-24 00:32:47 +08:00
Yuji Sugiura
d109767330
feat(linter/jsdoc): Implement check-tag-names rule (#3029)
Part of #1170 

-
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-tag-names.md#user-content-check-tag-names-options-definedtags

(This time, I'm less confident that I have implemented correctly. 😓 )
2024-04-24 00:32:14 +08:00
Yuji Sugiura
45649db86e
fix(tasks/rulegen): Follow #3037, settings handling update (#3077) 2024-04-23 13:28:52 +08:00
Ali Rezvani
ac1a40fb43
feat(ast): add callee_name method to the CallExpression. (#3076)
Adds a simple way to get the name of a given `CallExpression`.
2024-04-23 09:47:23 +08:00
overlookmotel
ab445d6acd
chore(deps): update benchmark pnpm dependencies (#3075)
Update pnpm dependencies for benchmarks. Alter usage of `tar` package
for changes to exports in v7.

Fixes
https://github.com/oxc-project/oxc/pull/3056#issuecomment-2068362398.
2024-04-23 08:21:17 +08:00
Wang Wenzhe
c3ec710b3d
feat(linter/tree-shaking): support ExportNamedDeclaration (#3072) 2024-04-23 02:19:34 +08:00
overlookmotel
942b2ba084
refactor(ast): add array element Elision type (#3074)
Pure refactor. This change does nothing except makes it more consistent
with other types which are also just a wrapper around `Span` e.g.
`NullLiteral` and `TSThisType`.
2024-04-23 02:05:11 +08:00
overlookmotel
81f90fd8b0
fix(ast): do not include trailing_comma in JSON AST (#3073)
Don't include `trailing_comma` fields in JSON AST, for compat with
ESTree (#2854).
2024-04-23 02:04:32 +08:00
谭光志
be9cdfcd83
feat(linter): eslint/no-await-in-loop (#3070)
[no-await-in-loop](https://eslint.org/docs/latest/rules/no-await-in-loop)
2024-04-22 21:43:32 +08:00
Boshen
99d46f9e48
Release oxlint and vscode extension v0.3.1 2024-04-22 16:00:17 +08:00
Boshen
a5a73517f8
fix(linter): fix unwanted plugin rules being enabled 2024-04-22 16:00:17 +08:00
Boshen
b29aabd6f1
Release oxlint and vscode extension v0.3.0 2024-04-22 12:57:38 +08:00
Boshen
fc88208e60
Release napi oxc-parser@v0.9.0 2024-04-22 12:56:40 +08:00
Boshen
559bca86c5
Release crates v0.12.5 2024-04-22 12:52:17 +08:00
Boshen
b88dfd7cee
fix(linter): support -D all -D nursery 2024-04-22 12:43:12 +08:00
Boshen
8d17bb4052
feat(linter): --deny all should not enable nursery rules
closes #3067
2024-04-22 12:34:32 +08:00
Todor Andonov
c2ad8f82de
feat(linter): implement fixer for typescript-eslint/consistent-type-definitions (#3045)
This is a continuation of https://github.com/oxc-project/oxc/pull/2885.

closes https://github.com/oxc-project/oxc/issues/2933

Note for reviewers: please take a look at how the new test cases are
defined. I just copy-pasted them from
[here](c33f497ad8/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts (L67))
and I'm not sure if this is how it should be done. I also added a few
more test cases.
2024-04-22 12:13:33 +08:00
Boshen
5241e1e127
refactor(cli): improve --help documentation 2024-04-22 11:14:51 +08:00
Boshen
023c1acfd0
chore(linter): remove unused "timing" variable 2024-04-22 11:08:50 +08:00
Boshen
ae72be1964
feat(linter): remove all ESLint Stylistic rules
They are out of scopes of this project.

closes #3066
closes #3040
2024-04-22 11:05:13 +08:00
Boshen
58d6438efb
feat(linter): change no-empty-static-block to correctness 2024-04-22 11:05:13 +08:00
Ali Rezvani
7e4beb0118
refactor(linter/import/no_cycle): use ModuleGraphVisitor. (#3064)
Uses #3062 to avoid having multiple implementations for the same idea(shared with #3030).
2024-04-22 10:26:40 +08:00
Ali Rezvani
5cf55c212e
feat(linter): no barrel file. (#3030)
closes #3004 

I've based it on [this plugin](https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/lib/rules/avoid-barrel-files.js) instead of [biome](4130ff0e4c/crates/biome_js_analyze/src/lint/performance/no_barrel_file.rs (L70)) Since the original plugin is less likely to detect a false positive.

I didn't understand your statement [here](https://github.com/oxc-project/oxc/issues/3004#issue-2245574895), Where you've mentioned:

> In oxlint, we can do better when --import-plugin is enabled, by displaying the total number of dependencies pulled into a given file by walking

I would appreciate it if you expand upon it.

------

#### Edit:

I've added it under `eslint-plugin-import` even though it is not; I wasn't sure If I should create a whole new category for this single rule, It is a different story if we would like to adopt the other rules in [here](https://github.com/thepassle/eslint-plugin-barrel-files/tree/main/lib/rules).

Also, check my diagnosis messages; It is my first contribution to the linters so I'm just not familiar enough with the conventions of messages, rules, etc.
2024-04-22 10:18:33 +08:00
Ali Rezvani
e6d11c6190
feat(syntax): module graph visitor. (#3062)
I've tried too hard to make it into a full-fledged depth first iterator, But had no success with it; It is the next best thing that I could've thought of.

Provides a way to visit the module graph from a ModuleRecord as its entry point.
2024-04-22 10:10:27 +08:00
renovate[bot]
f4b8f0b533
chore(deps): lock file maintenance vscode npm packages (#3060) 2024-04-22 10:02:30 +08:00
Wang Wenzhe
1a1ba11a3b
feat(linter/tree-shaking): support ExportDefaultDeclaration (#3052) 2024-04-22 10:00:55 +08:00
renovate[bot]
df7b9ee8da
chore(deps): lock file maintenance rust crates (#3059) 2024-04-22 09:58:21 +08:00
Ali Rezvani
6c8296164e
perf(ast): box typescript enum variants. (#3065)
Similar to #3058 and #3061 it is a continuation of #3047.

Handles these enum types:

> TSEnumMemberName
> Variant sizes: 16, 24, 24, 40
> Unboxed variants: IdentifierName (struct), StringLiteral (struct),
NumericLiteral (struct)
> Dependents: TSEnumMember (struct)
> => Box all variants.
>
> TSModuleReference 
> Variant sizes: 16, 32
> Unboxed variants: TSExternalModuleReference (struct)
> Dependents: Box<TSModuleReference> in TSImportEqualsDeclaration
> => Box all variants. Replace Box<TSModuleReference> with
TSModuleReference in TSImportEqualsDeclaration.
>
> TSTypePredicateName 
> Variant sizes: 8, 24
> Unboxed variants: IdentifierName (struct), TSThisType (struct)
> Dependents: TSTypePredicate (struct)
> => Box Identifier variant. Do not box This variant as only 8 bytes
(just contains Span).
>
> TSTypeQueryExprName 
> Variant sizes: 16, 88
> Unboxed variants: TSImportType (struct)
> Dependents: TSTypeQuery (struct)
> => Box TSImportType variant. Do not box TSTypeName variant, as is
another enum.
2024-04-22 09:54:53 +08:00