Replies: 2 comments 2 replies
-
Lets try to tackle it down in smaller pieces @camc314 @camchenry @shulaoda 🟥🟫🔲 Disabling / Enabling rules
My preffered way:
Problems on the way:
|
Beta Was this translation helpful? Give feedback.
-
Looks like I am the only one who is crying about it --> Closing |
Beta Was this translation helpful? Give feedback.
-
Follow up from #7242
We did make a great step in the right direction, but there are still problems.
I want to summarize it for you and discuss how to solve it forever 🤞.
I do not provide a solution. This is a discussion to discuss each problem
and in a perfect world, create issues/prs for it.
There is probably more stuff that I did not cover. Feel free to extend the problems.
To make it a bit more simple, here is a legend for the different categories:
eslint-plugin-oxlint
@oxlint/migrate
Preword
We have 4 different rule-cases, some are split into separate files, and some are remapped by oxlint:
Each combination will create its own kind of problem. Some we have (almost) completed.
🟦 JS Parsing for keeping all rules up to date
The smallest one first:
We need to keep track of all the special rules:
https://github.com/oxc-project/oxc/blob/main/tasks/lint_rules/src/oxlint-rules.mjs#L147-L218
cargo -p oxlint --rules
will currently not work, see next part🟥🟦🟫🔲
cargo -p oxc_linter --rules
This command or
oxlint ....
can't be used because the remapped rules are not displayed:oxc/crates/oxc_linter/src/utils/mod.rs
Lines 21 to 100 in 85fbe8c
🟥🟦
As a user I expect to see my lovely vitest rules, which are copies of jest, too.
I need to know that oxlint is remapping some rules and keep track of them.
Oxlint will not count them as separate rules. More details in the next block (integration tests)
🟫🔲
Not only users, but programs needs to keep track of the rules too.
Both plugins have the same mapping:
https://github.com/oxc-project/eslint-plugin-oxlint/blob/78910e2ce4fbdd7592c92e8c3e0791ab1ca09e3f/src/constants.ts#L18-L83
https://github.com/oxc-project/oxlint-migrate/blob/e7992ae2dcebe0218abd562feb0e70e834355b4b/src/constants.ts#L18-L41
This is needed to generate a JS Array / Object:
https://github.com/oxc-project/eslint-plugin-oxlint/blob/78910e2ce4fbdd7592c92e8c3e0791ab1ca09e3f/scripts/traverse-rules.ts#L57-L91
https://github.com/oxc-project/oxlint-migrate/blob/e7992ae2dcebe0218abd562feb0e70e834355b4b/scripts/traverse-rules.ts#L56-L98
For
eslint-plugin-oxlint
we need to work around with the integration tests here:https://github.com/oxc-project/eslint-plugin-oxlint/blob/78910e2ce4fbdd7592c92e8c3e0791ab1ca09e3f/src/build-from-oxlint-config.spec.ts#L149-L183
🟥 Diagnostic Messages
Because we are remapping the rules, the diagnosticmessages are displaying with the "main" plugin name.
We can not be sure what plugin should be displayed. See more info here: #8223
🟥 (v1.1) Reporting invalid rules
When we are checking rules if they are invalid, we need to keep in mind that the remapped rules exists.
#4146
🟥🟫🔲 Disabling / Enabling rules
When disabling
@typescript/xy
should beeslint/xy
be disabled too?When disabling
vitest/xy
should bevitest/xy
be disabled too?🟥
Problem with eslint and unicorn rule: #9402
Is there a difference between:
{rules: { "@typescript/xy": "error", "eslint/xy": "off"}}
and{rules: { "eslint/xy": "off", "@typescript/xy": "error"}}
?Is there a difference between:
{rules: { "@typescript/xy": "off", "eslint/xy": "error"}}
and{rules: { "eslint/xy": "off", "@typescript/xy": "error"}}
?How do we handle
{rules: { "jest/xy": "error", "vitest/xy": "off"}}
?🟫
The question above did keep me from implementing this Issue:
oxc-project/eslint-plugin-oxlint#228
🔲
The migration tool wants to keep the config file as small as possible.
There is an implementation only for ts/eslint rules only at the moment. See oxc-project/oxlint-migrate#7
I can include it for jest/vitest too, but that will confuse people who do not know they are the same.
🟥🟫🔲 Overrides Rules
see "disabling / enabling" rules for the base problems.
This will also include for
overrides
in.oxlintc..json
config🟥🟫🔲 Extending Config
see "disabling / enabling" rules for the base problems.
This will also include for
extends
in.oxlintc..json
config, which is currently in work: #9217🟥🟫🔲 Nested Configs
see "disabling / enabling" rules for the base problems.
This will also include for nested configurations, which are currently in under a feature flag: #9152
EDIT v1.1
Beta Was this translation helpful? Give feedback.
All reactions