oxc-project / oxc

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

Oxlint doesn't follow `extends` directive in .eslintrc.json #3362

Open sergi opened 4 months ago

sergi commented 4 months ago

Given a .eslint.json file like this:

{
    "extends": "../.eslintrc.json",
    "rules": {
        "no-console": "error",
        "brace-style": "off"
    }
}

Oxlint will only check for these two rules, ignoring all the parent rules from ../.eslintrc.json.

Running oxlint with the following command:

oxlint --symlinks -c ../.eslintrc.json -A unicorn --deny-warnings --tsconfig ./tsconfig.json .
todor-a commented 4 months ago

I think this is known. Couldn't find it in the docs but I remembered reading it here.

Boshen commented 4 months ago

I'm in the process of setting up json schema, it will solve the discoverability issue.

As for supporting extends, I think it's valuable so I'll keep this feature request open.

rzvxa commented 4 months ago

@Boshen I can implement the extends resolution; Last night I actually did some work on it; But it seems like we are changing the ESLintConfig load process which would conflict with my changes.

I was planning to create an ESLintConfigBuilder that would resolve the stuff after deserialization and build an ESLintConfig.

I don't know the scope of changes in #3355; So let me know whether I should wait for you to merge those changes, start stacking on top of it; Or ignore it and let you merge with it.

Of course, I can also put a pin in it if you don't find it necessary at the moment.

Boshen commented 4 months ago

@Boshen I can implement the extends resolution; Last night I actually did some work on it; But it seems like we are changing the ESLintConfig load process which would conflict with my changes.

I was planning to create an ESLintConfigBuilder that would resolve the stuff after deserialization and build an ESLintConfig.

I don't know the scope of changes in #3355; So let me know whether I should wait for you to merge those changes, start stacking on top of it; Or ignore it and let you merge with it.

Of course, I can also put a pin in it if you don't find it necessary at the moment.

I'm currently working on json schema support using the schematic crate, there is a automatic extends support https://moonrepo.github.io/schematic/config/struct/extend.html I wanna try.

I'll let you know once it's done.

rzvxa commented 4 months ago

@Boshen I can implement the extends resolution; Last night I actually did some work on it; But it seems like we are changing the ESLintConfig load process which would conflict with my changes. I was planning to create an ESLintConfigBuilder that would resolve the stuff after deserialization and build an ESLintConfig. I don't know the scope of changes in #3355; So let me know whether I should wait for you to merge those changes, start stacking on top of it; Or ignore it and let you merge with it. Of course, I can also put a pin in it if you don't find it necessary at the moment.

I'm currently working on json schema support using the schematic crate, there is a automatic extends support https://moonrepo.github.io/schematic/config/struct/extend.html I wanna try.

I'll let you know once it's done.

It seems nice, especially if we somehow get to pass the eslintrc path to resolve relative extends. That's the main reason I've tried it with a builder, When we deserialize string directly (for example for test runners) we don't get to resolve relative extends.

sergi commented 3 weeks ago

What's the status of this issue? were you able to take advantage of extends support in schematic?