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@latestWrite 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_casein 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 installto ensure you have the correct Node version - Run
npm installto install project dependencies - Ensure your editor is set up to use editorconfig, Prettier and Eslint
- Run
nvm useto 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.jsfile, not the.eslintrcfile as it is for local linting only