-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Bug: can't run a single ESLint rule in CLI after migrating to flat config #18459
Comments
Hi @JavaScriptBach, thanks for the issue! Can you please provide a minimal reproducible example?
Yes, this message can appear for various reasons (not only because of a matching ignore pattern; we're working on the fix in eslint/rewrite#7), but without a reproducible example we can't know exactly what's causing this in the case you provided. |
@mdjermanovic here is a repro:
// test.ts
import b from "b";
import a from "a";
|
Thanks for the info. I can reproduce this with the latest ESLint v9.3.0 too. Here's what happens: ESLint by default lints only To support linting any files with @eslint/eslint-tsc thoughts about this use case? Currently available workaround is to add another config file with just file patterns, and use that file with // eslint.pre-commit.js
export default [{
files: ["**/*.ts"]
}];
|
I think adding a config file is the right way to go here. Trying to add back in |
My opinion is neutral because the mentioned config file solution already covers this use case. Furthermore, with a config file, you could specify plugins, rules, and parser in it so you wouldn't need But if we do decide to add a CLI option for this use case, it could be a CLI-only feature that just adds a config object with the |
I'd also argue that for this case, adding a config file like I wouldn't be oppose though to add a new option (like |
I agree that using a pre commit config is the correct solution here, and it's now possible thanks to flat config. Thank you all for implementing it! |
* docs: Add VS Code info to config migration guide fixes #18459 * Update docs/src/use/configure/migration-guide.md Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com> * Update docs/src/use/configure/migration-guide.md Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com> * Update docs/src/use/configure/migration-guide.md Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com> --------- Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
Environment
Node version: 20.12.2
npm version: 10.5.0
Local ESLint version: 8.57.0
Global ESLint version: 8.57.0
Operating System: Ubuntu 22
What parser are you using?
@typescript-eslint/parser
What did you do?
I have a pre-commit script that uses the CLI to run a subset of ESLint rules on commit. A minimal version of the command I'm running:
After migrating to flat config, this command fails and tells me to switch to
--no-config-lookup
instead of--no-eslintrc
. When I make the change, it still fails with "File ignored because of a matching ignore pattern.", likely because of #18263.The workaround I'm using in the meantime is to prepend the old command with ESLINT_USE_FLAT_CONFIG=false.
What did you expect to happen?
After switching to
--no-config-lookup
, the command continues to work.What actually happened?
Link to Minimal Reproducible Example
See above
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: