feat(linter): create the import/order rule
all cases are not covered bu the architecture is setup
How to use the Graphite Merge Queue
Add either label to this PR to merge it via the merge queue:
- 0-merge - adds this PR to the back of the merge queue
- hotfix - for urgent hot fixes, skip the queue and merge this PR next
You must have a Graphite account in order to use the merge queue. Sign up using this link.
An organization admin has enabled the Graphite Merge Queue in this repository.
Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.
CodSpeed Instrumentation Performance Report
Merging #7903 will not alter performance
Comparing Spoutnik97:linter/order (62f2753) with main (d936024)
Summary
β
34 untouched benchmarks
@Spoutnik97 thanks for the work π
It feels like you are going to the trouble of making your own file with tests. Please have a look how to setup a new rule: https://oxc.rs/docs/contribute/linter/adding-rules.html
The just commands looks to be outdatedπ . The listed commands can also be found here:
https://github.com/oxc-project/oxc/blob/main/justfile#L159-L199
@Sysix oh great! Indeed I didn't know this refreshed list
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
@Boshen yes indeed, this is for this rule
It seems that differences are you cannot customize the order/groups with biomejs
We've also got https://github.com/oxc-project/oxc/discussions/7197 which we were considering implementing
I would suggest we perhaps make an issue for this with one rule (maybe oxc) to cover all/most cases? my reasoning for this is that we don't really want two rules doing almost the same thing
We cam probable remove a few of the config options from eslint-plugin-import to help it get shipped quicker and to avoid having to support incredibly complex configrations
I just improved the rule by covering more use cases. Indeed, it would be better to don't have duplicate rule effects I fixed tests and move to the right folders
Performances issues are fixed. All checks passed
Hello β we updated the tests for rules in this PR: https://github.com/oxc-project/oxc/pull/8353 Could you please rebase/merge your PR with main foir the needed changes? π?
Hi @Sysix ! It's done β
Hi @Sysix and @Boshen !
How could I help you to accelerate the merge of this PR?
It's one of the rule I need to fully migrate to oxlint.
I will improve my ci from 56sec to 9 sec ! (x5 per day)
Hello @Spoutnik97
I do not feel comfortable when the test generation from just new-import-rule is failing :/
The rules have more options and more test cases too pass. I do not expect it pass it 100% in this PR.
Still I would like to have the test cases in the code, ready to be enabled.
And your configuration file test cases are wrong. You need to pass a js array like the auto generated tests here: https://github.com/oxc-project/oxc/blob/52bd0b1004b376c76cb0d808b2cc45930a4bb3d0/crates/oxc_linter/src/rules/eslint/new_cap.rs#L694
PS: I am currently not the person to request :) I just look around and try to help where I can
Hello @Spoutnik97 Is this job going on? this rule is very useful to many developers, i will be exciting if this PR is merged (π
Yes it is , but I don't have a lot of time the last weeks.
I am reshaping the rule according to the official eslint tests I writed manually.
My code pass the main tests, but there is still some work to be done
Converted to draft. Please let us know when PR is ready for review.
@Boshen a first version is ready to review. Not all config is implemented, but dozens of eslint tests pass, so I think it could be a good start for the next steps. let me know if it seems right for you
@camc314 maybe ?
Hi, the PR sims to be intact for 3 weeks. Are there any plans to move it from draft to open PR in a short future? Is any help required? @Spoutnik97
@vladimir-kuba I did the job and I am waiting for a reviewer. I don't know if I have the permissions to change the draft label
@Spoutnik97 can you resolve the conflicts? :)
@Spoutnik97 thanks for the reply! I see no settings implemented in the PR. even though the import/internal-regex and import/external-module-folders are mentioned in the How Imports Are Grouped docs.
Is it reasonable to implement the settings in the PR or in a separate one?
@vladimir-kuba I'm not sure about what you mean. In the crates/oxc_linter/src/rules/import/order.rs file, there is a configuration parser to get the specified settings for this rule
@Sysix done β !
@Sysix or @camc314 I don't understand why the Test Linux CI failed on tests I didn't modified. Why does it failed on linux and now macos or windows ?
We address import order properly in the formatter.