eslint-config-appnexus
Installation
npm install eslint-config-appnexus --save-dev
# Additional plugins needed
npm install eslint-plugin-import --save-dev
npm install eslint-plugin-lodash --save-dev
npm install eslint-plugin-promise --save-dev
npm install eslint-plugin-prettier --save-dev
npm install --save-dev --save-exact prettier
Create a .prettierrc
file in the project root with the standard overrides:
{
"printWidth": 120,
"singleQuote": true,
"arrowParens": "always",
"semi": true,
"trailingComma": "all"
}
Links
Configure .eslintrc.json
Base
View Config
{
"extends": ["appnexus"]
}
Base + UI Rules
View Config
{
"extends": ["appnexus/frontend"]
}
Additional installs
npm install eslint-plugin-react --save-dev
Base + Backend Rules
View Config
{
"extends": ["appnexus/backend"]
}
Additional installs
npm install eslint-plugin-hapi --save-dev
Typescript Base
View Config
{
"extends": ["appnexus/typescript"]
}
Additional installs
npm install @typescript-eslint/eslint-plugin@latest --save-dev
npm install eslint-plugin-import@latest --save-dev
package.json scripts:
"lint": "eslint --ext .js,.jsx,.ts,.tsx src",
"lint-fix": "eslint --ext .js,.jsx,.ts,.tsx src --fix",
Overriding rules
To override rules for your project use the rules section of the .eslintrc.json file
Example overriding indentation to 2 spaces:
{
"extends": ["appnexus"],
"rules": {
"indent": ["error", 2]
}
}
Example of adding mocha defined functions:
{
"env": {
"mocha": true
},
"extends": ["appnexus"]
}
Rule Changes
See the wiki for the semver policy for this project. Please propose rule changes as an issue in this repo.
Find Unused Rules
npm run find-unused-rules -- base.js
npm run find-unused-rules -- frontend.js
npm run find-unused-rules -- backend.js