The --fix CLI option instructs ESLint to fix as many issues as possible, writing changes to the actual files and outputting only the remaining unfixed issues, as in npx eslint --fix file.js. Not all problems are fixable: the option throws an error when code is piped to ESLint on stdin, and it has no effect on code that uses a processor unless the processor opts into allowing autofixes. To get the fixes without writing them to the file, or to fix code from stdin, use --fix-dry-run instead. The --fix-type option restricts which kinds of fixes --fix or --fix-dry-run applies: problem fixes potential errors, suggestion applies fixes that improve the code, layout applies fixes that do not change the program structure (AST), and directive applies fixes to inline directives such as // eslint-disable. The option may be passed multiple times, for example npx eslint --fix --fix-type suggestion . — useful when another program formats the code but ESLint should still apply other fix types. Scope: ESLint. Reviewed October 4, 2026.
Autofix with --fix
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- eslint.org
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.