An ESLint configuration following WordPress.com's "Calypso" JavaScript Coding Guidelines.
You should install this configuration and peer dependencies as devDependencies
in your project:
npm install --save-dev eslint-config-wpcalypso eslint eslint-plugin-wpcalypso
If you're planning to use the React superset of rules, you should also install eslint-plugin-react
:
npm install --save-dev eslint-plugin-react
Next, simply extend the configuration from your project's .eslintrc
file:
"extends": "wpcalypso"
Or, if your project uses React and you want to opt in to additional React-specific rules, extend the React superset:
"extends": "wpcalypso/react"
Another set of rules available is the react-a11y
set, which contains the base rules, the react rules, and a set of accessibility checks. To use these:
"extends": "wpcalypso/react-a11y"
For these accessibility rules, you will need to also install the jsx-a11y plugin:
npm install --save-dev eslint-plugin-jsx-a11y
Refer to the ESLint documentation on Shareable Configs for more information.
Want to suggest a change to our style guide? Edit the JavaScript Coding Guidelines on the Automattic/wp-calypso repository and submit a pull request.
Want to revise the ESLint rules used here? Edit the index.js
file and submit a pull request.
Calypso is licensed under GNU General Public License v2 (or later).