oxc-project / oxc

⚓ A collection of JavaScript tools written in Rust.
https://oxc.rs
MIT License
12.27k stars 443 forks source link

linter: default plugins are always enabled in config file #6896

Open Sysix opened 1 week ago

Sysix commented 1 week ago

What version of Oxlint are you using?

latest

What command did you run?

npx oxlint -c .oxlint.json

What does your .oxlint.json config file look like?

{ "plugins": ["typescript"] }

What happened?

because the default values for plugins is react, unicorn, typescript and oxc,
I expect to run oxlint -c .oxlint.json with less rules.

npx oxlint -c .oxlint.json output:

Finished in 16ms on 21 files with 98 rules using 24 threads.
Found 0 warnings and 0 errors.

npx oxlint output:

Finished in 16ms on 21 files with 98 rules using 24 threads.
Found 0 warnings and 0 errors.
DonIsaac commented 1 week ago

You need to use --disable-<foo>-plugin to turn plugins off right now. This was a design decision, but if it's too confusing we can change behavior.

Sysix commented 1 week ago

I would expect I can use CLI arguments or the config file.
When I use both. I expect CLI arguments to override config file.

So the linked documentation is wrong? The 4 plugins are not "config plugins" but "CLI plugins", which can not enabled/disabled via config file.

Would like to rethink the --disable-<foo>-plugin argument with the combination --config :)

NateRadebaugh commented 1 week ago

I agree with @Sysix that I'd expect the config to replace the defaults if provided, instead of being additive. The current functionality isn't intuitive. I'd prefer to not require CLI commands since tooling like vscode and the eslint integration @Sysix is working on doesn't include any CLI args in those contexts.

DonIsaac commented 1 week ago

What would you expect to happen if a config file is provided but no plugins array is passed? Vs an empty array

Sysix commented 1 week ago

I expect the following:

DonIsaac commented 1 week ago

Gotcha, I'll make that change

Lancear commented 1 week ago

You need to use --disable--plugin to turn plugins off right now. This was a design decision, but if it's too confusing we can change behavior.

Ran into the same issue and wanted to add that another reason why this is problematic is that for the vscode plugin I couldn't find a way to pass cli arguments thus in my ide my config wouldn't match my lint command in my package.json and I get additional errors (I'm using solidjs and now get a bunch of react errors).

Whoops, someone already said that! Gotta learn to read everything first 😅