ESLint "Cannot read config file (.eslintrc)" - Fix Bad Config in CI
By Daniel Zoghalchali·Latchkey
ESLint found the config file but could not read or parse it - invalid JSON/JS, a syntax error, or a file it cannot open. Config loading fails before any file is linted.
What this error means
ESLint aborts with Cannot read config file: /app/.eslintrc.json and an underlying parse error (e.g. Unexpected token } in JSON). It is deterministic and tied to the config file itself.
eslint
Cannot read config file: /app/.eslintrc.json
Error: Unexpected token } in JSON at position 142
at JSON.parse (<anonymous>)
Diagnose it: config resolution and version drift
Lint failures that appear only in CI are almost always a different linter version or a different resolved configuration, not new violations in the code.
Keep .eslintrc.json valid JSON (no comments, no trailing commas).
Use .eslintrc.cjs when you need comments or logic.
Validate the config with eslint --print-config in CI.
Frequently asked questions
What causes ESLint "Cannot read config file (.eslintrc)"?
There are 2 common causes: malformed json/js in the config and comments in a strict json config. A trailing comma, missing quote, or stray token makes .eslintrc.json invalid JSON, or a syntax error breaks .eslintrc.js.
How do I fix ESLint "Cannot read config file (.eslintrc)"?
There are 2 fixes depending on which cause you have: fix the config syntax and validate the config in ci before linting. Work through them in order, since the first is the most common.
What does ESLint "Cannot read config file (.eslintrc)" actually mean?
ESLint aborts with Cannot read config file: /app/.eslintrc.json and an underlying parse error (e.g.
How do I stop ESLint "Cannot read config file (.eslintrc)" happening again?
Keep .eslintrc.json valid JSON (no comments, no trailing commas). The prevention section lists 3 changes that keep it from recurring.