npm install --save-dev eslint @gravity-ui/eslint-config
Add .eslintrc
file in the project root with the following content:
{
"extends": "@gravity-ui/eslint-config",
"root": true
}
Add client and server config files in corresponding directories:
{
"extends": "@gravity-ui/eslint-config/server"
}
{
"extends": "@gravity-ui/eslint-config/client"
}
If you are using Prettier, extend root config with the additional rules:
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
"root": true
}
If you want to spot accessibility issues, extend root config with the additional rules:
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/a11y"],
"root": true
}
if you want to enforce a convention in module import order, extend root config with the additional rules:
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/import-order"],
"root": true
}