Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using an ESLint config file does not seem to affect oxlint rule count #1969

Closed
jgeurts opened this issue Jan 9, 2024 · 5 comments
Closed

Comments

@jgeurts
Copy link

jgeurts commented Jan 9, 2024

Hi! I'm trying to use an eslint config file to explicitly enable/disable oxlint rules. However, each time I run oxlint, it shows that it is using 150 rules even though ~180 rules are enabled in the config file.

fwiw, I think this file can be reduced substantially after #1966 is supported.

oxlintrc.json

@jgeurts jgeurts changed the title Using an ESLint config file does not seem to affect oxlint Using an ESLint config file does not seem to affect oxlint rule count Jan 9, 2024
Boshen pushed a commit that referenced this issue Jan 10, 2024
This PR fixes the plugin parsing logic when reading a config file.

Specifically, the plugin names defined in `RuleEnum`s use snake-case
("jsx_a11y") while in the config file they are written as "jsx-a11y".
This inconsistency causes some rules to be filtered out.

I tested the change with the config json file provided in #1969.
- Before the change: `Finished in 21ms on 1 file with 157 rules using 8
threads.`
- After the change: `Finished in 23ms on 1 file with 178 rules using 8
threads.`

Related issue: #1969
@Boshen
Copy link
Member

Boshen commented Jan 12, 2024

Does v0.2.0 fixes this problem?

@jgeurts
Copy link
Author

jgeurts commented Jan 13, 2024

I admittedly had troubles with 0.2.0 loading any rules from the config file. It seemed to ignore the config file completely and ran with what appeared to be the default rule config that ships with oxlint. Unfortunately, I didn't have enough time to look into it further and reverted back to 0.1.2.

I can try again and look into it a bit more in detail maybe tomorrow or Monday.

@iSuslov
Copy link

iSuslov commented Jan 14, 2024

Can confirm that something is off with respecting config.

For instance running oxc like this npx oxlint@latest doesn't lint against console. presence.

If I create a config:

{
  "rules": {
    "no-console": "off"
  }
}

And run with npx oxlint@latest -c .eslint.json is will show me console related linting errors.

Setting "no-console": "blablalba" gives an error Failed to parse rule severity, expected one of "allow", "off", "deny", "error" or "warn" hence oxc reads the config.

Setting the above rule to any of the allowed values still makes oxc to run validation against console presence.

It seems like oxc doesn't respect the actual value for the rule in config.

@Boshen
Copy link
Member

Boshen commented Jan 15, 2024

I admittedly had troubles with 0.2.0 loading any rules from the config file. It seemed to ignore the config file completely and ran with what appeared to be the default rule config that ships with oxlint. Unfortunately, I didn't have enough time to look into it further and reverted back to 0.1.2.

I can try again and look into it a bit more in detail maybe tomorrow or Monday.

@jgeurts Do you mind pasting your config? I'm lacking examples to test on 😅

@Boshen
Copy link
Member

Boshen commented Jan 16, 2024

v0.2.1 made a correction for this issue.

@Boshen Boshen closed this as completed Jan 16, 2024
IWANABETHATGUY pushed a commit to IWANABETHATGUY/oxc that referenced this issue May 29, 2024
…oject#1972)

This PR fixes the plugin parsing logic when reading a config file.

Specifically, the plugin names defined in `RuleEnum`s use snake-case
("jsx_a11y") while in the config file they are written as "jsx-a11y".
This inconsistency causes some rules to be filtered out.

I tested the change with the config json file provided in oxc-project#1969.
- Before the change: `Finished in 21ms on 1 file with 157 rules using 8
threads.`
- After the change: `Finished in 23ms on 1 file with 178 rules using 8
threads.`

Related issue: oxc-project#1969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants