diff --git a/package.json b/package.json index b9141f74..bc9f2816 100644 --- a/package.json +++ b/package.json @@ -137,6 +137,7 @@ "gulp-less": "4.0.1", "gulp-sourcemaps": "2.6.4", "gulp-typescript": "5.0.1", + "husky": "^4.3.8", "jest": "25.2.4", "jest-html-reporter": "3.0.0", "less": "3.8.1", @@ -144,11 +145,13 @@ "node-abi": "^2.17.0", "npm-run-all": "4.1.5", "prettier": "2.2.1", + "pretty-quick": "^3.1.0", "robotjs": "0.6.0", "run-script-os": "1.0.7", "spectron": "^11.0.0", "ts-jest": "25.3.0", "tslint": "5.11.0", + "tslint-config-prettier": "^1.18.0", "typescript": "3.9.7" }, "dependencies": { @@ -183,5 +186,10 @@ "ignoredByWatcher": [ "!lib/src/**/*.js" ] + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } } } diff --git a/tslint.json b/tslint.json index 4e09a332..6063fc70 100644 --- a/tslint.json +++ b/tslint.json @@ -1,59 +1,36 @@ { - "extends": [ - "tslint:recommended" - ], + "extends": ["tslint:latest", "tslint-config-prettier"], "linterOptions": { - "exclude": [ - "**/*.json" - ] + "exclude": ["**/*.json"] }, "rules": { "curly": true, "eofline": true, - "align": [ - true, - "parameters" - ], + "align": [true, "parameters"], "class-name": true, - "indent": [ - true, - "spaces" - ], - "max-line-length": [ - true, - 650 - ], + "indent": [true, "spaces"], + "max-line-length": [true, 650], "no-shadowed-variable": false, "no-trailing-whitespace": true, "no-duplicate-variable": true, "no-var-keyword": true, - "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"], + "variable-name": [ + true, + "ban-keywords", + "check-format", + "allow-leading-underscore", + "allow-pascal-case" + ], "no-empty": true, "no-unused-expression": true, "no-use-before-declare": true, "no-var-requires": true, "only-arrow-functions": true, "object-literal-sort-keys": false, - "no-console": [ - true, - "log", - "error" - ], - "one-line": [ - true, - "check-else", - "check-whitespace", - "check-open-brace" - ], - "quotemark": [ - true, - "single", - "avoid-escape" - ], - "semicolon": [ - true, - "always" - ], + "no-console": [true, "log", "error"], + "one-line": [true, "check-else", "check-whitespace", "check-open-brace"], + "quotemark": [true, "single", "avoid-escape"], + "semicolon": [true, "always"], "typedef-whitespace": [ true, {