Prettier & TSLint
Let Prettier take care of code formatting, and TSLint of the rest
Install
It can be used globally but is much better to have it in the project. Run
$ npm i --save-dev prettier tslint tslint-config-prettier tslint-plugin-prettier tslint-react
tslint-plugin-prettier: reports the errors visually. // TODO: check what really does
tslint-config-prettier: disables all conflicting rules that may cause such problems.
tslint-react: adds some extra configuration for react projects.
Configuration
Once all the dependencies has been installed, we will need to create a tslint.json
{
"defaultSeverity": "warning",
"extends": ["tslint:latest", "tslint-react", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"no-implicit-dependencies": false,
"jsx-boolean-value": ["always", { "never": ["exact"] }],
"jsx-no-lambda": ["always", { "never": ["onClick"] }],
"object-literal-sort-keys": false,
"prettier": [true, "./prettierrc"],
"no-shadowed-variable": false,
"interface-name": false,
"member-access": [false]
},
"rulesDirectory": ["tslint-plugin-prettier"]
}