DEV Community

Tommy
Tommy

Posted on • Originally published at jsonic.io

The JSON config files quietly breaking your JS build (and how to fix them)

Half the "weird" build failures in a JavaScript/TypeScript project aren't code bugs — they're malformed JSON in a config file. .eslintrc.json, tsconfig.json, vercel.json, turbo.json all look like JSON but each has its own quirks, and a single trailing comma can take down your whole pipeline with a cryptic message.

Here are the traps I hit most often, and how to stop wasting time on them.

1. Trailing commas (the #1 culprit)

This is valid JavaScript but invalid JSON:

{
  "extends": "next",
  "rules": {
    "no-unused-vars": "warn",
  }
}
Enter fullscreen mode Exit fullscreen mode

That comma after "warn" throws Unexpected token } in JSON. ESLint, tsc, and Vercel's build all parse these files as strict JSON — no trailing commas allowed.

2. Comments don't belong in plain .json

tsconfig.json tolerates comments (it's JSONC). .eslintrc.json and vercel.json do not. Copy a commented snippet from a blog into the wrong file and the parser dies. If you need comments, use the .js/.cjs variant of the config instead.

3. vercel.json and turbo.json have schemas — use them

Both validate against a JSON Schema. A misspelled key (build vs buildCommand) won't error locally but will silently do nothing on deploy. Validating against the schema catches these before you push. I keep notes on the exact gotchas here: vercel.json guide and turbo.json guide.

4. ESLint flat config + JSON

Migrating to flat config trips people up because the JSON shape changed. The most common failure is still just malformed JSON, not the new structure. I wrote up the specific cases here: validating .eslintrc.json.

A 10-second fix for all of the above

Whenever a config file misbehaves, paste it into a strict JSON validator first — it points to the exact line/column of the problem instead of a vague build error. I built a free in-browser one (no signup, nothing uploaded) for exactly this: jsonic. It formats, validates, and shows a precise error locator, which turns "why is my build broken" into a five-second fix.


TL;DR: Before debugging your build, validate your config JSON. Trailing commas and stray comments cause more failed CI runs than they have any right to.

Top comments (0)