Skip to content

Bug: Running CLI with only one rule fails to match any file #19361

@Pouja

Description

@Pouja

Environment

Node version: v20.18.1
npm version: v10.8.2
Local ESLint version: v9.18.0 (Currently used)
Global ESLint version: Not found
Operating System: darwin 24.2.0

What parser are you using?

@typescript-eslint/parser

What did you do?

When running eslint strictly using the CLI command it will report that no files are matching. But using the legacy engine through ESLINT_USE_FLAT_CONFIG works.

The use case is that we have a large repository (> 1M LoC) where we want to update rules from warn to error one at a time. And we want to use the auto fix of eslint to fix only a single rule, instead of all fixable problems.

The command I am trying to run for flat config:

node_modules/.bin/eslint \
--plugin '@typescript-eslint' \
--parser '@typescript-eslint/parser' \
--parser-options '{"project":"packages/awesome-helpers/tsconfig.json"}' \
--rule '{"@typescript-eslint/consistent-type-exports": "error"}' \
--no-config-lookup \
--no-cache \
"packages/awesome-helpers/src/**/*.ts"

What did you expect to happen?

/path/to/packages/awesome-helpers/src/index.ts
  1:1  error  All exports in the declaration are only used as types. Use `export type`  @typescript-eslint/consistent-type-exports

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

What actually happened?

Oops! Something went wrong! :(

ESLint: 9.18.0

You are linting "packages/awesome-helpers/src/**/*.ts", but all of the files matching the glob pattern "packages/awesome-helpers/src/**/*.ts" are ignored.

If you don't want to lint these files, remove the pattern "packages/awesome-helpers/src/**/*.ts" from the list of arguments passed to ESLint.

If you do want to lint these files, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored.

  * If the file is ignored because of a matching ignore pattern, check global ignores in your config file.
    https://eslint.org/docs/latest/use/configure/ignore

  * If the file is ignored because no matching configuration was supplied, check file patterns in your config file.
    https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions

  * If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory.

Link to Minimal Reproducible Example

https://github.com/Pouja/eslint-auto-fix-issue

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

I really like that we have switched to flat configs, thanks for the awesome work

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusioncliRelates to ESLint's command-line interfacecoreRelates to ESLint's core APIs and featuresfeatureThis change adds a new feature to ESLintrepro:yesIssues with a reproducible example

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions