An ESLint config file for all Osmo Systems Javascript code.
Usage of this config varies depending on if your package uses React (as the lint config then needs to know how to lint .jsx files).
Install our config package and peerDependencies
npm install --save-dev eslint@^4.19 eslint-plugin-import@^2.11 eslint-config-airbnb-base@^12.1
npm install --save-dev "@osmosystems/eslint-config-osmo"
npm install --save-dev eslint@^4.19 eslint-plugin-import@^2.11 eslint-config-airbnb@^16.1 eslint-plugin-jsx-a11y@^6.0 eslint-plugin-react@^7.7
npm install --save-dev "@osmosystems/eslint-config-osmo"
Add an .eslintrc
file at the top level of your package that references our config
{
"extends": "@osmosystems/eslint-config-osmo"
}
{
"extends": "@osmosystems/eslint-config-osmo/include-react"
}
Add an .eslintignore
that symlinks to .gitignore
. This is necessary to ensure ES Lint does not run against, e.g. files in node_modules, and the assumption is that anything we want git-ignored we also want eslint-ignored.
In the root of the package, run:
ln -s .gitignore .eslintignore
Finally, add a lint
script to your package.json
that runs eslint. Once the entire package has been linted, add a pretest
script that runs lint when testing, thereby enforces linting at test/build time.
{
"scripts": {
"lint": "eslint --ext=.js,.jsx .",
"pretest": "npm run lint", // Only add this once the entire package has been linted
}
}