eslint-config-google
raw JSON → 0.14.0 verified Sat Apr 25 auth: no javascript
ESLint shareable config enforcing the Google JavaScript style guide (ES2015+ version). The current stable version is 0.14.0, with peer dependency on ESLint >=5.16.0. This package is the official config from Google, updated to match the Google JS style guide. It is an extension of ESLint's base config that overrides rules to comply with Google's coding standards. It is minimal by design – no additional plugins or custom rules beyond style enforcement. Release cadence is low, typically updated for style guide changes. For new projects, consider using the flattened version from google/gts for easier setup.
Common errors
error Failed to load config "google" to extend from. ↓
cause eslint-config-google is not installed or cannot be resolved.
fix
Run 'npm install --save-dev eslint eslint-config-google' to install the package.
error ESLint couldn't find the config "google" after extending. ↓
cause The config name 'google' is not a valid module; it must be installed as a dev dependency.
fix
Ensure eslint-config-google is listed in devDependencies and node_modules/ contains it.
error Configuration for rule "google/..." is invalid. ↓
cause Using a rule from eslint-config-google that doesn't exist (e.g., a plugin rule).
fix
Google config only sets core ESLint rules; there is no such rule prefix. Remove any 'google/' prefixed rules from your config.
Warnings
breaking Google's style guide has changed over time; major version bumps in eslint-config-google may introduce new rules or change existing ones, breaking linting on code that previously passed. ↓
fix Check the changelog and update your code to comply with new rules. Run 'npx eslint --fix' to auto-fix where possible.
gotcha This package only enforces style rules; it does not include any rules beyond what Google style requires. It does not include plugins like @typescript-eslint. ↓
fix If you need TypeScript support, use '@typescript-eslint/eslint-plugin' and '@typescript-eslint/parser' along with overrides.
deprecated ESLint version <5.0.0 is no longer supported by recent versions of eslint-config-google (0.11.0+). ↓
fix Upgrade ESLint to >=5.16.0.
gotcha The 'google' config does not include 'eslint:recommended' by default. If you extend only 'google', recommended rules like 'no-undef' are not enabled. ↓
fix Add 'eslint:recommended' to 'extends' array before 'google' to get both sets of rules.
gotcha Some rules enforced by Google style may conflict with other plugins (e.g., Prettier). This can cause double-formatting confusion. ↓
fix Use eslint-config-prettier to disable any rules that conflict with Prettier.
Install
npm install eslint-config-google yarn add eslint-config-google pnpm add eslint-config-google Imports
- extends: 'google' wrong
import google from 'eslint-config-google' or require('eslint-config-google')correctUse in eslint config: { "extends": "google" } - Usage with eslint:recommended wrong
{ "extends": ["google", "eslint:recommended"] }correct{ "extends": ["eslint:recommended", "google"] } - npm install wrong
npm install eslint-config-google (without eslint as peer dep)correctnpm install --save-dev eslint eslint-config-google
Quickstart
// Install dependencies:
// npm install --save-dev eslint eslint-config-google
// .eslintrc.json:
{
"extends": ["eslint:recommended", "google"],
"rules": {
// Override any rules here
"valid-jsdoc": "warn"
}
}
// Example file to lint (test.js):
function greet(name) {
return 'Hello, ' + name;
}
console.log(greet('World'));
// Run: npx eslint test.js