Skip to content

Commit 920be3a

Browse files
clydinhansl
authored andcommitted
build: integrate prettier code formatter
1 parent 214e8ef commit 920be3a

File tree

7 files changed

+500
-174
lines changed

7 files changed

+500
-174
lines changed

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"linters": {
3+
"*.{js,ts}": ["precise-commits", "git add"]
4+
}
5+
}

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "all"
5+
}

etc/rules/Rule.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

etc/rules/singleEofLineRule.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"build-tsc": "tsc -p tsconfig.json",
2525
"fix": "npm run admin -- lint --fix",
2626
"lint": "npm run admin -- lint",
27+
"precise-commits": "precise-commits",
2728
"prebuildifier": "bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier",
2829
"buildifier": "find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier",
2930
"templates": "node ./bin/devkit-admin templates",
@@ -33,7 +34,6 @@
3334
"test:watch": "nodemon --watch packages -e ts ./bin/devkit-admin test",
3435
"validate": "node ./bin/devkit-admin validate",
3536
"validate-commits": "./bin/devkit-admin validate-commits",
36-
"prepush": "node ./bin/devkit-admin hooks/pre-push",
3737
"preinstall": "node ./tools/yarn/check-yarn.js",
3838
"webdriver-update": "webdriver-manager update --standalone false --gecko false --versions.chrome 2.45"
3939
},
@@ -103,20 +103,23 @@
103103
"conventional-commits-parser": "^3.0.0",
104104
"gh-got": "^8.0.1",
105105
"git-raw-commits": "^2.0.0",
106-
"husky": "^0.14.3",
106+
"husky": "^1.3.1",
107107
"istanbul": "^0.4.5",
108108
"jasmine": "^2.6.0",
109109
"jasmine-spec-reporter": "^4.2.1",
110110
"karma": "~4.0.0",
111111
"karma-jasmine": "^2.0.1",
112112
"karma-jasmine-html-reporter": "^1.4.0",
113113
"license-checker": "^20.1.0",
114+
"lint-staged": "^8.1.4",
114115
"minimatch": "^3.0.4",
115116
"minimist": "^1.2.0",
116117
"npm-registry-client": "8.6.0",
117118
"pacote": "^9.2.3",
118119
"pidtree": "^0.3.0",
119120
"pidusage": "^2.0.17",
121+
"precise-commits": "^1.0.2",
122+
"prettier": "^1.16.4",
120123
"rxjs": "~6.4.0",
121124
"semver": "^5.3.0",
122125
"source-map": "^0.5.6",
@@ -126,7 +129,14 @@
126129
"through2": "^2.0.3",
127130
"tree-kill": "^1.2.0",
128131
"ts-node": "^5.0.0",
132+
"tslint-config-prettier": "^1.18.0",
129133
"tslint-no-circular-imports": "^0.6.0",
130134
"tslint-sonarts": "^1.7.0"
135+
},
136+
"husky": {
137+
"hooks": {
138+
"pre-commit": "lint-staged",
139+
"pre-push": "node ./bin/devkit-admin hooks/pre-push"
140+
}
131141
}
132142
}

tslint.json

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
// Consider using cognitive-complexity and refactor
44
// Consider using no-useless-cast but it's annoying
55
"extends": [
6-
"tslint-no-circular-imports"
6+
"tslint-no-circular-imports",
7+
"tslint-config-prettier"
78
],
89
"rulesDirectory": [
910
"dist/etc/rules",
1011
"node_modules/tslint-sonarts/lib/rules"
1112
],
13+
"linterOptions": {
14+
"exclude": ["dist-schema/**"],
15+
"format": "codeFrame"
16+
},
1217
"rules": {
1318
// ==================================================================================================
1419
// custom rules defined in etc/rules/**
1520
"defocus": true,
1621
"import-groups": true,
1722
"no-global-tslint-disable": true,
18-
"single-eof-line": true,
1923
// ==================================================================================================
2024
// tslint-sonarts rules. See https://github.com/SonarSource/SonarTS
2125
// These rules are part of the bug detection section of tslint-sonarts
@@ -52,45 +56,21 @@
5256
"no-floating-promises": true,
5357
"no-implicit-dependencies": true,
5458
"no-import-side-effect": [true, {"ignore-module": "^(?!rxjs\/)"}],
55-
"align": [
56-
true,
57-
"elements",
58-
"members",
59-
"parameters",
60-
"statements"
61-
],
62-
"max-line-length": [true, 100],
6359
"no-inferrable-types": true,
6460
"class-name": true,
6561
"comment-format": [
6662
true,
6763
"check-space"
6864
],
69-
"indent": [
70-
true,
71-
"spaces"
72-
],
73-
"eofline": true,
74-
"import-spacing": true,
7565
"match-default-export-name": true,
7666
"newline-before-return": true,
77-
"no-consecutive-blank-lines": [true, 2],
7867
"no-duplicate-variable": true,
7968
"no-eval": true,
8069
"no-any": true,
8170
"no-arg": true,
8271
"no-internal-module": true,
83-
"no-trailing-whitespace": true,
8472
"no-unused-expression": true,
8573
"no-var-keyword": true,
86-
"one-line": [
87-
true,
88-
"check-catch",
89-
"check-else",
90-
"check-finally",
91-
"check-open-brace",
92-
"check-whitespace"
93-
],
9474
"ordered-imports": [
9575
true,
9676
{
@@ -99,29 +79,6 @@
9979
}
10080
],
10181
"prefer-const": true,
102-
"quotemark": [
103-
true,
104-
"single",
105-
"avoid-escape"
106-
],
107-
"semicolon": [true, "always"],
108-
"trailing-comma": [
109-
true,
110-
{
111-
"multiline": "always",
112-
"singleline": "never"
113-
}
114-
],
115-
"typedef-whitespace": [
116-
true,
117-
{
118-
"call-signature": "nospace",
119-
"index-signature": "nospace",
120-
"parameter": "nospace",
121-
"property-declaration": "nospace",
122-
"variable-declaration": "nospace"
123-
}
124-
],
12582
"curly": true,
12683
"file-header": [
12784
true,
@@ -133,17 +90,6 @@
13390
"check-format",
13491
"allow-leading-underscore",
13592
"allow-pascal-case"
136-
],
137-
"whitespace": [
138-
true,
139-
"check-branch",
140-
"check-decl",
141-
"check-module",
142-
"check-preblock",
143-
"check-operator",
144-
"check-separator",
145-
"check-type",
146-
"check-typecast"
14793
]
14894
}
14995
}

0 commit comments

Comments
 (0)