Skip to content

Commit

Permalink
feat: Configure pre-commit hooks to handle style #198
Browse files Browse the repository at this point in the history
  • Loading branch information
maxisam committed Jun 27, 2019
1 parent bcdc232 commit 88c0492
Show file tree
Hide file tree
Showing 5 changed files with 571 additions and 74 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
37 changes: 27 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"prettier": "prettier --write \"**/*.{json,md,ts,html,component.html}\"",
"start": "ng serve",
"build": "ng build ngx-clipboard --prod && npm run build-copy",
"tslint-check": "tslint-config-prettier-check ./tslint.json",
"test": "ng test ngx-clipboard",
"lint": "ng lint ngx-clipboard",
"publish:lib": "yarn publish ./dist/lib",
Expand All @@ -23,40 +25,55 @@
"@angular/platform-browser-dynamic": "~7.2.15",
"@angular/router": "~7.2.15",
"core-js": "^2.5.4",
"ngx-clipboard": "12.1.2",
"ngx-window-token": "2.0.1",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"zone.js": "~0.8.26",
"ngx-clipboard": "12.1.2",
"ngx-window-token": "2.0.1"
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.9",
"@angular-devkit/build-ng-packagr": "~0.13.9",
"@angular/cli": "~7.3.9",
"@angular/compiler-cli": "~7.2.15",
"@angular/language-service": "~7.2.15",
"@types/node": "~8.9.4",
"@clr/angular": "^0.13.6",
"@clr/icons": "^0.13.6",
"@clr/ui": "^0.13.6",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"@webcomponents/custom-elements": "^1.2.1",
"codelyzer": "~4.5.0",
"cpx": "^1.5.0",
"husky": "2.4.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lint-staged": "8.2.1",
"ng-packagr": "^4.2.0",
"prettier": "1.18.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tsickle": ">=0.34.0",
"tslib": "^1.9.0",
"tslint": "~5.11.0",
"typescript": "~3.2.4",
"@webcomponents/custom-elements": "^1.2.1",
"@clr/ui": "^0.13.6",
"@clr/angular": "^0.13.6",
"@clr/icons": "^0.13.6",
"cpx": "^1.5.0"
"tslint-config-prettier": "^1.18.0",
"typescript": "~3.2.4"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{json,md,ts,html,component.html}": [
"prettier --write",
"git add"
]
}
}
16 changes: 16 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
printWidth: 120,
tabWidth: 4,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: "none",
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: "avoid",
rangeStart: 0,
rangeEnd: Infinity,
requirePragma: false,
insertPragma: false,
proseWrap: "preserve",
}
98 changes: 45 additions & 53 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,71 @@
{
"rulesDirectory": ["node_modules/codelyzer"],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"trailing-comma": [
false,
{
"multiline": "always",
"singleline": "never"
}
],
"interface-name": [false, "always-prefix"],
"class-name": true,
"comment-format": [true, "check-space"],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [true, "rxjs/Rx"],
"import-spacing": true,
"indent": [true, "spaces"],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [true, 200],
"member-access": false,
"curly": false,
"eofline": false,
"directive-selector": [true, ["attribute"], [], "camelCase"],
"component-selector": [true, ["element", "attribute"], [], "kebab-case"],
"component-class-suffix": true,
"directive-class-suffix": true,
"no-attribute-parameter-decorator": true,
"no-forward-ref": false,
"no-input-rename": true,
"no-output-rename": true,
"pipe-naming": [true, "camelCase", "mpix"],
"use-host-property-decorator": false,
"use-input-property-decorator": true,
"use-life-cycle-interface": true,
"use-output-property-decorator": true,
"use-pipe-transform-interface": true,
"ordered-imports": [false],
"variable-name": [true, "allow-leading-underscore", "allow-pascal-case", "ban-keywords", "check-format"],
"member-ordering": [
true,
{
"order": ["static-field", "instance-field", "static-method", "instance-method"]
}
],
"no-arg": true,
"no-bitwise": true,
"member-access": [false],
"arrow-parens": false,
"max-classes-per-file": [true, 2],
"callable-types": true,
"comment-format": [true, "check-space"],
"import-blacklist": [true],
"interface-over-type-literal": true,
"label-position": true,
"no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
"no-arg": true,
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [true, "ignore-params"],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-use-before-declare": true,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-unused-expression": [true, "allow-fast-null-checks"],
"no-var-keyword": true,
"no-inferrable-types": [true, "ignore-params"],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-unnecessary-initializer": true,
"object-literal-sort-keys": false,
"one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"],
"prefer-const": true,
"quotemark": [true, "single"],
"object-literal-shorthand": false,
"radix": true,
"semicolon": [true, "always"],
"triple-equals": [true, "allow-null-check"],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"],
"no-output-on-prefix": true,
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true
}
"unified-signatures": true
},
"extends": ["tslint:latest", "tslint-config-prettier", "tslint-config-prettier"]
}
Loading

0 comments on commit 88c0492

Please sign in to comment.