How can I get a list of the files ESLint is checking?
The only talk about it I can find is this eslint issue where a member of the repo suggested running DEBUG=eslint:* eslint
. However, the output from that is impossibly large.
A close look at the output shows a single line with eslint:flat-eslint Lint
before the filename. Knowing that we can narrow the debug statement based on the output (eslint
v8).
DEBUG=eslint:flat-eslint eslint
when using flat config
or DEBUG=eslint:cli-engine eslint
when using deprecated config
or DEBUG=eslint:flat-eslint,eslint:cli-engine
if unsure.
As the OP in the linked issue suggested, a --list-files
option seems like a no brainer for eslint
to add.
DEBUG=eslint:eslint npx eslint .
https://github.com/eslint/eslint/blob/v9.13.0/lib/eslint/eslint.js#L101
I can't find these details in the eslint@v9 docs, but it does work (see example).
DEBUG=eslint:cli-engine npx eslint .
https://github.com/eslint/eslint/blob/v8.57.0/lib/cli-engine/cli-engine.js#L43
The answer from Maxim should be working according to the source listed in https://github.com/eslint/eslint/blob/v8.57.0/lib/eslint/flat-eslint.js#L99, but I'm not seeing eslint:flat-config
work locally. However eslint:cli-engine
does appear work for this version, at least on my machine.
Run npx eslint . --debug
and look for the prefix of the line you want to filter by.
This is a simplified output of npx eslint . --debug
eslint:cli CLI args: [ '.', '--debug' ] +0ms
eslint:cli Using flat config? true +2ms
eslint:cli Running on files +5ms
eslint:eslint Using config loader LegacyConfigLoader +0ms
eslint:eslint Using file patterns: . +0ms
eslint:eslint Deleting cache file at /redacted/path/.eslintcache +0ms
eslint:rules Loading rule 'no-empty-function' (remaining=284) +4ms
eslint:eslint 3 files found in: 1332ms +1s
eslint:rules Loading rule 'no-var' (remaining=206) +132ms
eslint:linter Generating fixed text for /redacted/path/1 (pass 1) +40ms
eslint:source-code-fixer Applying fixes +40ms
eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +0ms
eslint:eslint Lint /redacted/path/2 +6ms
eslint:source-code-fixer Applying fixes +72ms
eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +0ms
eslint:eslint Lint /redacted/path/3 +72ms
DEBUG=eslint:rules npx eslint .
eslint:rules
. eslint:rules Loading rule 'no-empty-function' (remaining=284) +4ms
eslint:rules Loading rule 'no-var' (remaining=206) +132ms
DEBUG=eslint:eslint npx eslint .
eslint:eslint
, which will list file names (Plus some other stuff as mentioned by Alejandro). eslint:eslint Using config loader LegacyConfigLoader +0ms
eslint:eslint Using file patterns: . +2ms
eslint:eslint Deleting cache file at /redacted/path/.eslintcache +0ms
eslint:eslint 3 files found in: 1944ms +2s
eslint:eslint Lint /redacted/path/1 +3ms
eslint:eslint Lint /redacted/path/2 +258ms
eslint:eslint Lint /redacted/path/3 +19ms
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With