An ESLint 10 lint job on a large repository takes nine minutes; what does --concurrency change, and when does it not help?
answer
- threads, not processes
- off unless you ask
- auto counts the files
- capped at half the cores
- a warning when overhead wins
basics
~20 s--concurrency, added in ESLint 9.34.0 and off by default, lints files on worker threads. A number sets the thread count; auto starts one per 50 files, capped at half the cores. Each worker reloads the config, so small runs gain nothing.
solid answer
~40 sIn ESLint 10, `--concurrency` takes a positive integer, `auto` or `off`; the default `off` lints every file in the main thread. A number starts up to that many worker threads, never more than there are files. `auto` estimates the files that actually need linting, starts one worker per 50 of them rounded up, caps that at half of the available CPU parallelism, and runs single-threaded when the estimate comes to one. Each worker loads the config and its plugins itself, so the gain is largest when rule execution dominates, not loading and reading files. When workers spend too little of their time linting, ESLint prints `ESLintPoorConcurrencyWarning` suggesting you reduce or disable concurrency. The flag arrived in ESLint 9.34.0 and changes speed, not the results or exit codes.
code
bash · 6 lines# compare on the CI machine itself
npx eslint --concurrency off .
npx eslint --concurrency auto .
npx eslint --concurrency 6 .
# a low share of time spent linting in the workers prints:
# ESLintPoorConcurrencyWarning: You may reduce or disable concurrency to improve performance.go deeper
Know that ESLint can lint on several threads with --concurrency, that it is off by default, and that auto lets ESLint choose.
Explain how auto sizes the pool: one worker per 50 files to process, capped at half the available parallelism, and single-threaded for small runs.
Diagnose a parallel run that is no faster: per-worker config and plugin loading, file reads, the poor-concurrency warning, and measuring with --debug and --stats before choosing a number.
Decide where lint time is best spent: fewer files through ignores and caching, or a thread count tuned on the CI hardware, weighing each against CI cost.
## What the flag does By default ESLint lints one file after another in a single thread. **Multithread linting**, added in **ESLint 9.34.0** and available throughout ESLint 10, spreads the files across Node.js **worker threads**. The CLI flag is `--concurrency`: | Value | Behaviour | |---|---| | `off` (default) | every file is linted in the main thread | | a positive integer `n` | up to `n` worker threads, never more than the number of files; a value that works out to one thread runs single-threaded | | `auto` | ESLint picks a worker count from the number of files to process | Any other value is rejected before linting starts. The results do not change: the same rules run on the same files, and the exit code follows the same `0`, `1` and `2` rules as a single-threaded run. ## How `auto` chooses `auto` is deliberately conservative. In ESLint 10.12.0's source it works like this: 1. Count the files that need processing. Ignored files are not counted, and in a cached run with the default `metadata` strategy, files whose cached result is still valid are not counted either. 2. Start one worker for every 50 of those files, rounded up. 3. Cap the total at half of the machine's available parallelism. 4. If the result is one worker, use none: a single worker thread costs more than linting in the main thread. So a pre-commit run over a dozen staged files stays single-threaded under `auto`, while a full run over thousands of files uses half the cores. ## Where the time goes, and why threads may not help Each worker is a separate ESLint instance. It loads the configuration for its files, importing `eslint.config.js` and every plugin and parser it pulls in, and reads its files from disk. That work is repeated per worker. Concurrency pays off when **rule execution** dominates the job; it does little when most of the time is spent starting up, loading configs or reading files. ESLint measures this. For each worker it compares the time spent actually linting, minus config loading and file reads, against the worker's total runtime. When that ratio is low, it emits `ESLintPoorConcurrencyWarning` with a message such as `You may disable concurrency to improve performance.` The suggestion depends on the setting: - with two or fewer workers, it suggests disabling concurrency; - with `auto` and more workers, it suggests disabling it or choosing a numeric setting; - with a larger number you chose, it suggests reducing or disabling it. ## A method for the nine-minute job - **Measure first.** `--debug` prints how many files were found and how many worker threads were used. `--stats` adds per-file parse, fix and rule timings to the results, readable with `-f json`. - **Try `--concurrency auto`**, then a few explicit numbers, on the CI machine itself; the right count depends on its cores and memory, not on a laptop. - **Remove work before parallelising it.** Ignoring generated output and build folders, or linting fewer files through a valid cache, shrinks what any number of threads has to do. - **Watch for the warning.** If CI prints `ESLintPoorConcurrencyWarning`, the threads are mostly overhead; lower the number or turn concurrency off. ## What concurrency does not change It is worth being precise about what stays the same, because people expect more from the flag than it offers: - **The results.** Every file is linted with the configuration that applies to it, by the same rules, whichever thread runs it. - **The exit code and the report.** Results from the workers are gathered and printed by the chosen formatter, and `0`, `1` or `2` is decided exactly as in a single-threaded run. - **The cache rules.** `--cache` still reuses results per file, and still cannot see dependencies between files. - **The amount of work per file.** A slow rule is just as slow on a worker thread; concurrency only runs more files at once. ## Using it from the Node.js API The same setting exists as the `concurrency` option of the `ESLint` class, also defaulting to `"off"`. Because options are sent to worker threads, every other option must be cloneable when concurrency is on; ESLint reports an error naming any option that cannot be cloned and suggests an options module instead. The CLI handles this for you.
- Why might `--concurrency auto` on a pre-commit run start no worker threads at all?`auto` starts one worker per 50 files that need processing, rounded up, and treats a result of one as zero. A run over a dozen staged files therefore lints in the main thread, which avoids paying for worker start-up and config loading on a small job.
- Does `--concurrency` change which problems ESLint reports or its exit code?No. The same configuration and rules apply to the same files; only the scheduling changes. The exit code is still `0`, `1` or `2` by the usual rules.
- ESLint 10 lints on all CPU cores by default.
- --concurrency auto always starts one worker per CPU core.
- More worker threads always make an ESLint run faster.
- --concurrency starts separate ESLint processes that share one loaded config.
- Turning on --concurrency changes which problems a run reports.
Assumes ESLint 10 (checked against 10.12.0); multithread linting with --concurrency was added in ESLint 9.34.0 and defaults to off.