eslint-config-wesbos
raw JSON → 4.3.2 verified Sat Apr 25 auth: no javascript
Wes Bos's personal ESLint & Prettier config, version 4.3.2. Updated infrequently; based on eslint-config-airbnb and includes TypeScript support. Lightweight alternative to other configs like `eslint-config-airbnb` or `standard`. Options for JS and TypeScript (via `wesbos/typescript`). Requires peer dependencies ESLint ^8, Prettier ^3, TypeScript ^4.8.4 or ^5. Requires manual `tsconfig.json` for TypeScript. Uses Prettier for formatting with opinionated defaults (singleQuote, endOfLine).
Common errors
error Error: Failed to load config "wesbos" to extend from. ↓
cause Missing peer dependency or incorrect extension name.
fix
Run
npm install eslint-config-wesbos and ensure peer deps are installed. Use 'wesbos' not 'wesbos/javascript'. error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. ↓
cause TypeScript config used without a tsconfig.json.
fix
Create a tsconfig.json in your project root.
error Cannot find module 'prettier'.eslint ↓
cause Prettier not installed as a peer dependency.
fix
npm install prettier@^3.0.0 --save-dev
Warnings
gotcha TypeScript config requires a tsconfig.json file in root. If missing, TypeScript linting will fail. ↓
fix Create an empty tsconfig.json or point to existing one.
gotcha Using eslint-config-wesbos with ESLint v9 may cause incompatibilities. The config uses the .eslintrc format which is not supported in flat config. ↓
fix Stick with ESLint v8 or switch to flat config and a different config package.
gotcha Only two Prettier options are set by default: singleQuote: true, endOfLine: 'auto'. Changes to these may cause conflicts. ↓
fix Override both in .prettierrc or via prettier/prettier rule.
Install
npm install eslint-config-wesbos yarn add eslint-config-wesbos pnpm add eslint-config-wesbos Imports
- Config for JavaScript wrong
Use 'wesbos/js' or just 'wesbos'.correct{ "extends": ["wesbos"] } - Config for TypeScript wrong
{ "extends": ["wesbos"] } // TypeScript files not linted properlycorrect{ "extends": ["wesbos/typescript"] } - Override rules wrong
Placing Prettier rules outside 'prettier/prettier' rulecorrect{ "extends": ["wesbos"], "rules": { "no-console": 2, "prettier/prettier": ["error", { "singleQuote": false }] } }
Quickstart
npm init -y && npm install eslint-config-wesbos
# .eslintrc.json
{
"extends": ["wesbos"]
}
# package.json scripts
"lint": "eslint .",
"lint:fix": "eslint . --fix"