diff --git a/package.json b/package.json index 3307a653cbe7ddfe1c2eafcd3b4b7f5e14cc687b..e1d5b609a4ee8c1060edf9842f534c47a40c19b7 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,8 @@ "devDependencies": { "@angular/compiler": "^8.2.9", "@angular/core": "^8.2.9", + "husky": "^3.0.8", + "lint-staged": "^10.0.0-0", "prettier": "^1.15.0", "rxjs": "^6", "tslint": "^5.9.1", @@ -35,6 +37,16 @@ }, "scripts": { "test": "tslint -p tsconfig.json --print-config tsconfig.json >/dev/null", - "lint": "prettier --check '*.js' '*.json'" + "lint": "prettier --check *.js *.json", + "lint:fix": "prettier --write *.js *.json" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.js": "npm run lint:fix", + "*.json": "npm run lint:fix" } } diff --git a/tslint.json b/tslint.json index 6cc8ca4f579b0d740db1a34a243735caaade7020..74f69f2231a830ec8882281e35573f37ccf54604 100644 --- a/tslint.json +++ b/tslint.json @@ -5,11 +5,7 @@ "rxjs-tslint-rules", "tslint-config-prettier" ], - "rulesDirectory": [ - "codelyzer", - "tslint-defocus", - "tslint-plugin-prettier" - ], + "rulesDirectory": ["codelyzer", "tslint-defocus", "tslint-plugin-prettier"], "rules": { "arrow-return-shorthand": true, "array-type": [true, "array-simple"],