ESLint Shareable Config for JavaScript Standard Style
eslint-config-standard is a shareable ESLint configuration that enforces JavaScript Standard Style rules. It is designed for advanced users who prefer to manage their ESLint setup manually, rather than using the all-in-one `standard` CLI tool. The current stable version is 17.1.0, which was released on May 29, 2023. While historically active, the project's maintenance status is noted as 'Sustainable' but with no new versions released to npm in the past 12 months, and low recent activity on its GitHub repository, potentially indicating a slower release cadence or a 'discontinued project' status, according to some analyses. Key differentiators include its opinionated, semicolon-free style and its integration with the broader ESLint ecosystem through specific plugin peer dependencies.
Common errors
-
Error: Failed to load config "standard" to extend from. Referenced from ...
cause The `eslint-config-standard` package or one of its peer dependencies is not installed, or ESLint cannot find it.fixEnsure `eslint-config-standard` and all its peer dependencies (`eslint`, `eslint-plugin-import`, `eslint-plugin-n`, `eslint-plugin-promise`) are correctly installed in your project's `devDependencies`. Run `npm install --save-dev eslint-config-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-n`. -
Parsing error: Cannot find module 'eslint-plugin-import'
cause A required ESLint plugin (e.g., `eslint-plugin-import`, `eslint-plugin-n`, `eslint-plugin-promise`) is missing or an incompatible version is installed.fixInstall the missing plugin(s) as `devDependencies` using `npm install --save-dev eslint-plugin-import eslint-plugin-n eslint-plugin-promise`. Also, verify that the installed versions satisfy the peer dependency requirements of `eslint-config-standard`. -
The style guide "standard" requires eslint@^8.0.1. You are currently using eslint@{version}. Do you want to downgrade?cause Your installed ESLint version is incompatible with the version required by `eslint-config-standard` (or the `standard` CLI tool if using that directly).fixUpgrade or downgrade your `eslint` package to match the peer dependency range specified by `eslint-config-standard` (e.g., `npm install --save-dev eslint@^8.0.1`). If prompted during `npx eslint --init`, choose 'Yes' to downgrade or adjust your `package.json` manually. -
Error: Node.js 8 is no longer supported.
cause Running `eslint-config-standard` with an unsupported Node.js version, typically older than Node.js 12.fixUpgrade your Node.js runtime to version 12 or newer. Use `nvm` or `fnm` to manage Node.js versions effectively.
Warnings
- gotcha This package is an ESLint configuration. For simpler usage, especially if you're new to linting or prefer an all-in-one CLI, consider using the `standard` package instead, which bundles the linter, formatter, and configuration.
- breaking Upgrading to `eslint-config-standard` v17.0.0 requires ESLint v8 and updated peer dependencies (eslint-plugin-n, eslint-plugin-import, eslint-plugin-promise). It also replaced `eslint-config-node` with `eslint-plugin-n`. Rules referencing `node/` must be updated to `n/`.
- breaking `eslint-config-standard` requires Node.js version 12 or greater. Using older Node.js versions will result in installation or runtime errors.
- gotcha ESLint's Flat Config system (introduced in ESLint v9) is not directly compatible with traditional `.eslintrc` configs. While `eslint-config-standard` still primarily uses the legacy format, direct usage with ESLint v9+ will require compatibility layers.
- gotcha The `eslint-plugin-n` peer dependency range (`^15.0.0 || ^16.0.0`) in `eslint-config-standard` v17.1.0 does not support `eslint-plugin-n` v17. This can lead to issues if `eslint-plugin-n` is auto-updated to v17 or higher.
Install
-
npm install eslint-config-standard -
yarn add eslint-config-standard -
pnpm add eslint-config-standard
Imports
- standard
{ "extends": "eslint-config-standard" }{ "extends": "standard" } - Node.js 12+
`"engines": { "node": ">=12.0.0"}` in `package.json` - Overrides
Placing rules outside the `rules` object or with incorrect severity levels.
{ "extends": "standard", "rules": { "semi": ["error", "always"] } }
Quickstart
{
"name": "my-project",
"version": "1.0.0",
"description": "My JavaScript Standard Style project.",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"eslint": "^8.0.1",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0"
}
}
// .eslintrc.json
{
"extends": "standard",
"env": {
"node": true,
"es2021": true
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
// Example: Override a rule to require semicolons, deviating from Standard Style
// "semi": ["error", "always"]
}
}
// index.js (example file to lint)
const message = 'Hello, Standard Style';
console.log(message);
// To run:
// 1. `npm install`
// 2. `npm run lint`
// 3. `npm run lint:fix` (to automatically fix fixable errors)