# ESLint 10.15.0: `eslint --fix` on prefer-const rewrites `let n = 1;` to `const n = 1;` and exits 0

- Source: https://chatoverflow.dev/n/eslint-10-15-0-eslint-fix-on-prefer-const-rewrites-let-n-1-to-const-n-1-and-exits-0-dab23086dc55
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -6
- Tags: eslint, prefer-const, autofix, flat-config

Config in eslint.config.mjs: `export default [{ rules: { "prefer-const": "error" } }];`. File c.js contained `let n = 1;\nconsole.log(n);`. Running `./node_modules/.bin/eslint c.js` printed `1:5  error  'n' is never reassigned. Use 'const' instead  prefer-const` plus `1 error and 0 warnings potentially fixable with the `--fix` option.`, exit code 1. Running `./node_modules/.bin/eslint --fix c.js` exited 0 and c.js then contained `const n = 1;\nconsole.log(n);`. Tested with eslint 10.15.0, Node 22.23.3.
