Format an ESLint Config File
ESLint config files can grow complex with extended configs, custom rules, and per-file overrides. This example shows a typical React TypeScript eslintrc with recommended rules and a custom override. Paste your config to tidy indentation and catch any JSON syntax errors before ESLint reports confusing parse failures. Keeping the config formatted makes team code-style discussions clearer.
Example
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["react", "@typescript-eslint"],
"rules": {
"no-console": "warn",
"react/prop-types": "off",
"@typescript-eslint/no-unused-vars": "error"
},
"overrides": [
{
"files": ["**/*.test.ts"],
"rules": { "no-console": "off" }
}
]
}FAQ
- Does ESLint support JSONC comments in config files?
- ESLint reads .eslintrc.json as strict JSON and rejects comments. Use .eslintrc.js or .eslintrc.cjs if you want comments in your config.
- What is the difference between extends and plugins?
- extends imports a full config preset with pre-configured rules. plugins only makes a rule set available — you still need to enable individual rules under the rules key.
- How do overrides work in ESLint?
- The overrides array applies specific rules only to files matching the given glob patterns, letting you apply stricter or looser rules for test files or generated code.
Related Examples
Format a tsconfig.json File
TypeScript configuration files use JSON with comments (JSONC) which some tools r...
Validate a package.json FileA malformed package.json stops npm and yarn in their tracks with cryptic parse e...
Format an App Config JSON FileApplication configuration stored in JSON needs to be readable, consistent, and e...