Installation
-
yarn add -D @preply/lint-configs tslint@5 eslint@5
— explanation - Create an
.eslintrc.js
:
module.exports = {
extends: require.resolve('@preply/lint-configs/eslint.main.js'),
};
- Create a
.prettierrc.js
:
module.exports = {
...require('@preply/lint-configs/prettier'),
};
- Create a
.tslint.json
:
{
"extends": [
"@preply/lint-configs/tslint.json"
]
}
- Put these guys into
"scripts"
in yourpackage.json
:
"lint:es": "eslint src --ext .js,.jsx",
"lint:ts": "tslint 'src/**/*.ts{,x}' --config ./tslint.json --project ./tsconfig.json",
"prettify": "prettier --write \"./src/**/*.{ts,tsx,js}\"",
Tip: pass --fix
into both in development:
yarn lint:es --fix
yarn lint:ts --fix
- Call it on CI (make sure there's no
--fix
, we want it to block non-compliant code)!