Shareable ESLint config for Wagtail, based on airbnb/javascript.
The package provides Wagtail's .eslintrc
as an extensible shared config.
Our default export contains all of our ESLint rules, including Airbnb's config
(which has ECMAScript 6 and React). It requires eslint
, as well as the configuration’s peer dependencies.
# npm v7 and up:
npm install --save-dev @wagtail/eslint-config-wagtail@latest
# npm v6 and below:
npx install-peerdeps --dev @wagtail/eslint-config-wagtail@latest
Write JavaScript according to the Airbnb Styleguide, with some exceptions:
- Use soft-tabs with a two space indent. Spaces are the only way to guarantee code renders the same in any person’s environment.
- We accept
snake_case
in object properties, such asajaxResponse.page_title
, however camelCase or UPPER_CASE should be used everywhere else.
- Required Node
- We recommend using nvm
- Clone the project on to your computer
- Run
nvm install
to ensure you have the correct Node version - Run
npm install
to install project dependencies - Ensure your editor is set up to use editorconfig, Prettier and Eslint
- Run
nvm use
to set Node to the correct version - Run tests via
npm run test
- Run linting via
npm run lint
- Run preflight checks before commiting final code via
npm run preflight
- Note: When working with the rule set, only modify the
index.js
file, not the.eslintrc
file as it is for local linting only