-
Notifications
You must be signed in to change notification settings - Fork 88
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
Added support for ESLint flat config files (eslint.config.js) #338
Conversation
Turns out there's also an experimental https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-resolution I wonder if my PR would break any use-cases? It's definitely missing mjs/cjs extensions. |
I think the |
You are absolutely right and this should be the job of eslint. I'm using: "linters": {
"eslint": {
"args": ["--flag", "unstable_config_lookup_from_file"]
}
} for now. Otherwise the integrated eslint algorithm is just backwards to what monorepos require and how the algorithm works for legacy configs. |
Maybe you can take a look at SublimeLinter's debug output. Isn't the most important part here which |
Yes, that's how I was able to debug this and ended up here. I had to figure out why the command that SublimeLinter runs did not work. So
which will result in
Because it does not pick up all the configs correctly to support TypeScript. If I set
which is also exactly what I get when I manually run eslint in the If I enable I re-read everything again.
From what I've described above it appears eslint won't walk further up than the cwd? Otherwise why would it only work when I'm in |
That's not what I expect when I read their docs (https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-resolution):
The flag As it seems that Regardless of that, you did not say what SublimeLinter computes as the best default |
Thanks a lot for the recommendations. It looks like something I did last week fixed the issue, I likely repaired the nx setup as I was upgrading dependencies.
Had no idea this was possible but also no idea how I'd do that. Looks like nx can't lint a single file and every nx command requires a project to be specified, which SublimeLinter has no understanding of. For now I'd rather not touch anything and hope it keeps working. |
In theory, you set Better don't touch it for now. 😁 |
Refs #335
@silverwind could you update your minimal test to verify this works for you as well?
I've inherited a project that uses
nx
monorepos and just migrated to the new flat file format (with multipleeslint.config.js
that extend each other). Apparently the resolution of configurations works different now. For some reasonnx lint
successfully linted but SublimeLinter couldn't parse the files. Runningeslint
directly worked only when pointing--config
at the closest config.This code was mostly written by Claude inspired by the code that nx uses:
https://github.com/nrwl/nx/blob/8eb615969633ca4d2e5147828d725d7df5bbca2a/packages/eslint/src/executors/lint/lint.impl.ts#L40-L49
https://github.com/nrwl/nx/blob/8eb615969633ca4d2e5147828d725d7df5bbca2a/packages/eslint/src/utils/config-file.ts#L31-L52
If I edit linter.py locally this PR fixes the problem for me. I honestly don't fully understand the entire eslint setup and what exactly broke.