Skip to content

Commit

Permalink
split tslint rules for dev and ci (#52)
Browse files Browse the repository at this point in the history
In development, console.log's are useful for debugging. This updates the
main tslint.json file to not error when console.log's are present, but
to just emit warnings. Since tslint doesn't have a stricter mode where
it fails on warnings also, I've created another tslint.ci.json file that
will emit errors if console.log's are present. This file will be used in
the CI and pre-commit hooks so when a developer is ready to commit a
change they will need to remove their debug statements.
  • Loading branch information
prydonius authored Feb 8, 2018
1 parent 235891c commit 95c6c61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"build": "react-scripts-ts build",
"test": "react-scripts-ts test --env=jsdom",
"eject": "react-scripts-ts eject",
"tslint-check": "tslint-config-prettier-check ./tslint.json",
"tslint-check": "tslint-config-prettier-check ./tslint.ci.json",
"precommit": "lint-staged",
"prettier": "prettier --write 'src/**/*.{ts,tsx,css}'",
"lint": "tslint 'src/**/*.{ts,tsx}'",
"lint-fix": "tslint --fix 'src/**/*.{ts,tsx}'"
"lint": "tslint -c ./tslint.ci.json 'src/**/*.{ts,tsx}'",
"lint-fix": "tslint -c ./tslint.ci.json --fix 'src/**/*.{ts,tsx}'"
},
"lint-staged": {
"*.{ts,tsx}": ["tslint --fix", "prettier --write", "git add"],
"*.{ts,tsx}": ["tslint -c ./tslint.ci.json --fix", "prettier --write", "git add"],
"*.{js,json,css,md}": ["prettier --write", "git add"]
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions tslint.ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"defaultSeverity": "error",
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}
4 changes: 3 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"no-console": false
"no-console": {
"severity": "warning"
}
},
"rulesDirectory": []
}

0 comments on commit 95c6c61

Please sign in to comment.