Skip to content

Commit 9f6ec33

Browse files
chore(prettier): add prettier git hook
yarn add -D husky prettier pretty-quick "scripts": { "precommit": "pretty-quick --staged" } .prettierignore: package.json .prettierrc.json: { "singleQuote": true, "trailingComma": "all", "printWidth": 120 } ❯ npx prettier --write {test,src}/**/*.{ts,js}
1 parent 8b8d645 commit 9f6ec33

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package.json

.prettierrc.json

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

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"docs": "generate_docs && publish_docs",
1818
"prepublishOnly": "npm run build",
1919
"changelog": "update_changelog --include-core",
20-
"artifacts": "artifact_tagging"
20+
"artifacts": "artifact_tagging",
21+
"precommit": "pretty-quick --staged"
2122
},
2223
"homepage": "https://ui-router.github.io/ng2",
2324
"contributors": [
@@ -67,6 +68,7 @@
6768
"@types/jasmine": "2.8.6",
6869
"@types/jquery": "3.3.1",
6970
"@uirouter/publish-scripts": "2.3.1",
71+
"husky": "^0.14.3",
7072
"jasmine-core": "2.99.1",
7173
"karma": "2.0.0",
7274
"karma-chrome-launcher": "2.2.0",
@@ -75,6 +77,8 @@
7577
"karma-sourcemap-loader": "0.3.7",
7678
"karma-super-dots-reporter": "^0.1.0",
7779
"karma-webpack": "3.0.0",
80+
"prettier": "^1.11.1",
81+
"pretty-quick": "^1.4.1",
7882
"rollup": "0.57.1",
7983
"rollup-plugin-commonjs": "9.1.0",
8084
"rollup-plugin-node-resolve": "3.3.0",

yarn.lock

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ chokidar@^2.0.0:
979979
optionalDependencies:
980980
fsevents "^1.0.0"
981981

982+
ci-info@^1.0.0:
983+
version "1.1.3"
984+
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.3.tgz#710193264bb05c77b8c90d02f5aaf22216a667b2"
985+
982986
cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
983987
version "1.0.4"
984988
resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de"
@@ -1916,6 +1920,18 @@ execa@^0.7.0:
19161920
signal-exit "^3.0.0"
19171921
strip-eof "^1.0.0"
19181922

1923+
execa@^0.8.0:
1924+
version "0.8.0"
1925+
resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da"
1926+
dependencies:
1927+
cross-spawn "^5.0.1"
1928+
get-stream "^3.0.0"
1929+
is-stream "^1.1.0"
1930+
npm-run-path "^2.0.0"
1931+
p-finally "^1.0.0"
1932+
signal-exit "^3.0.0"
1933+
strip-eof "^1.0.0"
1934+
19191935
expand-braces@^0.1.1:
19201936
version "0.1.2"
19211937
resolved "https://registry.yarnpkg.com/expand-braces/-/expand-braces-0.1.2.tgz#488b1d1d2451cb3d3a6b192cfc030f44c5855fea"
@@ -2668,6 +2684,14 @@ https-proxy-agent@1:
26682684
debug "2"
26692685
extend "3"
26702686

2687+
husky@^0.14.3:
2688+
version "0.14.3"
2689+
resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3"
2690+
dependencies:
2691+
is-ci "^1.0.10"
2692+
normalize-path "^1.0.0"
2693+
strip-indent "^2.0.0"
2694+
26712695
26722696
version "0.4.15"
26732697
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
@@ -2680,6 +2704,10 @@ ieee754@^1.1.4:
26802704
version "1.1.8"
26812705
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
26822706

2707+
ignore@^3.3.7:
2708+
version "3.3.7"
2709+
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021"
2710+
26832711
import-local@^1.0.0:
26842712
version "1.0.0"
26852713
resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc"
@@ -2809,6 +2837,12 @@ is-callable@^1.1.1, is-callable@^1.1.3:
28092837
version "1.1.3"
28102838
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
28112839

2840+
is-ci@^1.0.10:
2841+
version "1.1.0"
2842+
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5"
2843+
dependencies:
2844+
ci-info "^1.0.0"
2845+
28122846
is-data-descriptor@^0.1.4:
28132847
version "0.1.4"
28142848
resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
@@ -3679,6 +3713,10 @@ module-deps@^4.0.8:
36793713
through2 "^2.0.0"
36803714
xtend "^4.0.0"
36813715

3716+
mri@^1.1.0:
3717+
version "1.1.0"
3718+
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.0.tgz#5c0a3f29c8ccffbbb1ec941dcec09d71fa32f36a"
3719+
36823720
36833721
version "0.7.1"
36843722
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
@@ -3843,6 +3881,10 @@ normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-
38433881
semver "2 || 3 || 4 || 5"
38443882
validate-npm-package-license "^3.0.1"
38453883

3884+
normalize-path@^1.0.0:
3885+
version "1.0.0"
3886+
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379"
3887+
38463888
normalize-path@^2.0.0, normalize-path@^2.0.1, normalize-path@^2.1.1:
38473889
version "2.1.1"
38483890
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9"
@@ -4276,13 +4318,27 @@ preserve@^0.2.0:
42764318
version "0.2.0"
42774319
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
42784320

4321+
prettier@^1.11.1:
4322+
version "1.11.1"
4323+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75"
4324+
42794325
pretty-ms@^3.1.0:
42804326
version "3.1.0"
42814327
resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-3.1.0.tgz#e9cac9c76bf6ee52fe942dd9c6c4213153b12881"
42824328
dependencies:
42834329
parse-ms "^1.0.0"
42844330
plur "^2.1.2"
42854331

4332+
pretty-quick@^1.4.1:
4333+
version "1.4.1"
4334+
resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.4.1.tgz#9d41f778d2d4d940ec603d1293a0998e84c4722c"
4335+
dependencies:
4336+
chalk "^2.3.0"
4337+
execa "^0.8.0"
4338+
find-up "^2.1.0"
4339+
ignore "^3.3.7"
4340+
mri "^1.1.0"
4341+
42864342
process-nextick-args@~1.0.6:
42874343
version "1.0.7"
42884344
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
@@ -5409,6 +5465,10 @@ strip-indent@^1.0.1:
54095465
dependencies:
54105466
get-stdin "^4.0.1"
54115467

5468+
strip-indent@^2.0.0:
5469+
version "2.0.0"
5470+
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68"
5471+
54125472
strip-json-comments@~2.0.1:
54135473
version "2.0.1"
54145474
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"

0 commit comments

Comments
 (0)