Skip to content

Commit cfa7a19

Browse files
Markioniumcliffkoh
authored andcommitted
Introduce prettier as pre-commit (microsoft#5070)
* Pre prettier run setup * Setup for prettier run * Prepare utils for clean prettier run * Fix up code for clean run * Fix missing key * Add missing prettier configs * Prepare experiments for prettier * Allow lines with 'require' and urls to be longer than 140 * Move prettier to scripts package * Add prettier run on staged for ts and tsx files * Add lint staged * Empty log line * Add check for changed files * Add check task * Support build with lint * Add code-style command * Make code-style run * Lint on CI with fastbuild * Make sure tslint also runs for apps/<name> * Fix up formatOnSave * Minor * Prettier run * Change files * 120 line length * npm run generate * Log git diff to check why package changed * Add prettierignore to ignore package files and js files in lib folders * Update shrinkwrap * Minor prettier updates * Add prettier specific build script * Add api.ts to prettierignore * Add ignore file * Fix prettier option * Correct ignore path * More prettier ignore * Prettify the things * Fix pre commit * Remove lint option from travis
1 parent 4cb8f29 commit cfa7a19

File tree

1,407 files changed

+37433
-41180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,407 files changed

+37433
-41180
lines changed

.prettierignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package.json
2+
packages/*/package.json
3+
4+
**/*.d.ts
5+
**/*.api.ts
6+
7+
**/lib/**/*.js
8+
**/lib-commonjs/**/*.js
9+
**/dist/*.js
10+
11+
**/CHANGELOG.json

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ script:
77
fi
88
- npm run buildfast
99
- npm run bundlesize
10-
- npm run vrtest
10+
- npm run vrtest
11+
- npm run check-for-changed-files

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
6+
"esbenp.prettier-vscode"
7+
]
8+
}

.vscode/launch.json

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,9 @@
88
"program": "${workspaceRoot}/scripts/debug-test.js",
99
"cwd": "${fileDirname}",
1010
"stopOnEntry": false,
11-
"args": [
12-
"-i"
13-
],
11+
"args": ["-i"],
1412
"runtimeExecutable": null,
15-
"runtimeArgs": [
16-
"--nolazy",
17-
"--debug"
18-
],
13+
"runtimeArgs": ["--nolazy", "--debug"],
1914
"env": {
2015
"NODE_ENV": "development"
2116
},
@@ -28,14 +23,9 @@
2823
"program": "${workspaceRoot}/scripts/build.js",
2924
"cwd": "${workspaceRoot}/packages/office-ui-fabric-react",
3025
"stopOnEntry": false,
31-
"args": [
32-
"ts"
33-
],
26+
"args": ["ts"],
3427
"runtimeExecutable": null,
35-
"runtimeArgs": [
36-
"--nolazy",
37-
"--debug"
38-
],
28+
"runtimeArgs": ["--nolazy", "--debug"],
3929
"env": {
4030
"NODE_ENV": "development"
4131
},
@@ -47,17 +37,10 @@
4737
"request": "launch",
4838
"program": "${workspaceRoot}/scripts/build.js",
4939
"stopOnEntry": false,
50-
"args": [
51-
"webpack",
52-
"--",
53-
"--production"
54-
],
40+
"args": ["webpack", "--", "--production"],
5541
"cwd": "${workspaceRoot}/apps/fabric-website",
5642
"runtimeExecutable": null,
57-
"runtimeArgs": [
58-
"--nolazy",
59-
"--debug"
60-
],
43+
"runtimeArgs": ["--nolazy", "--debug"],
6144
"env": {
6245
"NODE_ENV": "development"
6346
}
@@ -68,18 +51,10 @@
6851
"request": "launch",
6952
"program": "${workspaceRoot}/scripts/build.js",
7053
"stopOnEntry": false,
71-
"args": [
72-
"webpack",
73-
"--",
74-
"--production",
75-
"--dogfood"
76-
],
54+
"args": ["webpack", "--", "--production", "--dogfood"],
7755
"cwd": "${workspaceRoot}/apps/fabric-website",
7856
"runtimeExecutable": null,
79-
"runtimeArgs": [
80-
"--nolazy",
81-
"--debug"
82-
],
57+
"runtimeArgs": ["--nolazy", "--debug"],
8358
"env": {
8459
"NODE_ENV": "development"
8560
}
@@ -90,16 +65,10 @@
9065
"request": "launch",
9166
"program": "${workspaceRoot}/apps/ssr-tests/node_modules/mocha/bin/_mocha",
9267
"stopOnEntry": true,
93-
"args": [
94-
"--debug",
95-
"dist/test-bundle.js"
96-
],
68+
"args": ["--debug", "dist/test-bundle.js"],
9769
"cwd": "${workspaceRoot}/apps/ssr-tests",
9870
"runtimeExecutable": null,
99-
"runtimeArgs": [
100-
"--nolazy",
101-
"--debug"
102-
],
71+
"runtimeArgs": ["--nolazy", "--debug"],
10372
"env": {
10473
"NODE_ENV": "development"
10574
},
@@ -112,19 +81,13 @@
11281
"program": "${workspaceRoot}/scripts/create-component.js",
11382
"cwd": "${workspaceRoot}",
11483
"stopOnEntry": false,
115-
"args": [
116-
"--name",
117-
"TestComponentName"
118-
],
84+
"args": ["--name", "TestComponentName"],
11985
"runtimeExecutable": null,
120-
"runtimeArgs": [
121-
"--nolazy",
122-
"--debug"
123-
],
86+
"runtimeArgs": ["--nolazy", "--debug"],
12487
"env": {
12588
"NODE_ENV": "development"
12689
},
12790
"sourceMaps": true
12891
}
12992
]
130-
}
93+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
"editor.formatOnSave": true,
4848
"typescript.tsdk": "./common/temp/node_modules/typescript/lib",
4949
"tslint.autoFixOnSave": false
50-
}
50+
}

.vscode/tasks.json

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
"label": "Typescript (oufr) watch",
66
"type": "process",
77
"command": "node",
8-
"args": [
9-
"./scripts/node_modules/typescript/bin/tsc",
10-
"-p",
11-
"packages/office-ui-fabric-react/tsconfig.json",
12-
"-w",
13-
"--noEmit"
14-
],
8+
"args": ["./scripts/node_modules/typescript/bin/tsc", "-p", "packages/office-ui-fabric-react/tsconfig.json", "-w", "--noEmit"],
159
"problemMatcher": "$tsc",
1610
"group": {
1711
"kind": "build",
@@ -22,18 +16,12 @@
2216
"label": "Typescript (vr-tests) watch",
2317
"type": "process",
2418
"command": "node",
25-
"args": [
26-
"./scripts/node_modules/typescript/bin/tsc",
27-
"-p",
28-
"apps/vr-tests/tsconfig.json",
29-
"-w",
30-
"--noEmit"
31-
],
19+
"args": ["./scripts/node_modules/typescript/bin/tsc", "-p", "apps/vr-tests/tsconfig.json", "-w", "--noEmit"],
3220
"problemMatcher": "$tsc",
3321
"group": {
3422
"kind": "build",
3523
"isDefault": true
3624
}
3725
}
3826
]
39-
}
27+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"typescript.tsdk": "./node_modules/typescript/lib"
3-
}
3+
}

apps/fabric-website/CHANGELOG.json

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
{
106106
"author": "lynamemi <lynam.emily@gmail.com>",
107107
"commit": "d3a85ba759d58bd74e4a1741ab73b729c96fa637",
108-
"comment": "When navigating to a new page, the page will now be scrolled to the top instead of whatever position of the page you were on."
108+
"comment":
109+
"When navigating to a new page, the page will now be scrolled to the top instead of whatever position of the page you were on."
109110
}
110111
]
111112
}
@@ -361,7 +362,8 @@
361362
{
362363
"author": "lynamemi <lynam.emily@gmail.com>",
363364
"commit": "8370f6f5c822189fbd84e13fb285df83b102a308",
364-
"comment": "Improved left nav scroll behavior and added fix to webpack so that we can load component pages from our local machines with the UHF."
365+
"comment":
366+
"Improved left nav scroll behavior and added fix to webpack so that we can load component pages from our local machines with the UHF."
365367
}
366368
],
367369
"dependency": [
@@ -399,7 +401,8 @@
399401
{
400402
"author": "lynamemi <lynam.emily@gmail.com>",
401403
"commit": "a9d0f70495f315998a5dad78699ffd2349436420",
402-
"comment": "Adding left nav scroll functionality, including fixing the left nav with the header. Other layout refactoring to accommodate."
404+
"comment":
405+
"Adding left nav scroll functionality, including fixing the left nav with the header. Other layout refactoring to accommodate."
403406
}
404407
],
405408
"dependency": [
@@ -444,7 +447,8 @@
444447
{
445448
"author": "David Zearing <dzearing@microsoft.com>",
446449
"commit": "08e59c871894c8ff443d48dbe5b0dd3316eb4331",
447-
"comment": "Updated build to newest React version and typings. Updated tests and made various tweaks to the code to remove React warnings and keep Enzyme"
450+
"comment":
451+
"Updated build to newest React version and typings. Updated tests and made various tweaks to the code to remove React warnings and keep Enzyme"
448452
}
449453
],
450454
"dependency": [
@@ -520,7 +524,8 @@
520524
{
521525
"author": "Eddie Liu <leddie24@gmail.com>",
522526
"commit": "67466325ed0ff6b89f82fa152860f968d8d740a0",
523-
"comment": "Add ActivityItem, Calendar, HoverCard, OverflowSet, ScrollablePane, TeachingBubble to fabric-website"
527+
"comment":
528+
"Add ActivityItem, Calendar, HoverCard, OverflowSet, ScrollablePane, TeachingBubble to fabric-website"
524529
}
525530
],
526531
"dependency": [
@@ -687,7 +692,8 @@
687692
{
688693
"author": "lynamemi <lynam.emily@gmail.com>",
689694
"commit": "9a399cc9187ec81611acec92655e3393878e28e1",
690-
"comment": "Added/removed Best Practices links for component pages that had/didn't have a Best Practices section."
695+
"comment":
696+
"Added/removed Best Practices links for component pages that had/didn't have a Best Practices section."
691697
},
692698
{
693699
"author": "lynamemi <lynam.emily@gmail.com>",
@@ -711,7 +717,8 @@
711717
{
712718
"author": "Jon Schectman <joschect@microsoft.com>",
713719
"commit": "8e1dcc66cda8334653a8b5ccbde02bf6275e0b23",
714-
"comment": "TSConfig: update to use preserveConstEnums so that certain builds s ystems don't break when importing const enums"
720+
"comment":
721+
"TSConfig: update to use preserveConstEnums so that certain builds s ystems don't break when importing const enums"
715722
}
716723
],
717724
"dependency": [
@@ -871,7 +878,8 @@
871878
{
872879
"author": "John Miller <rubixws@gmail.com>",
873880
"commit": "40e1ef1d6ac5ee498888e7200fd15af754d7b665",
874-
"comment": "Switched some font colors on theme and neutral color swatches from white to black to achieve minimum contrast requirement of 4.5:1 for accessibility."
881+
"comment":
882+
"Switched some font colors on theme and neutral color swatches from white to black to achieve minimum contrast requirement of 4.5:1 for accessibility."
875883
},
876884
{
877885
"author": "lynamemi <lynam.emily@gmail.com>",
@@ -886,7 +894,8 @@
886894
{
887895
"author": "John Miller <rubixws@gmail.com>",
888896
"commit": "40e1ef1d6ac5ee498888e7200fd15af754d7b665",
889-
"comment": "Changed where Fabric Core and Fabric React versions were drawing from so that they would appear as a number instead of a range."
897+
"comment":
898+
"Changed where Fabric Core and Fabric React versions were drawing from so that they would appear as a number instead of a range."
890899
},
891900
{
892901
"author": "lynamemi <lynam.emily@gmail.com>",
@@ -896,7 +905,8 @@
896905
{
897906
"author": "lynamemi <lynam.emily@gmail.com>",
898907
"commit": "faef37358c373a6848b8eab6ef4e3df05b5e9697",
899-
"comment": "Added section in ResourcePage for XD Toolkits and other assets, includes references on other pages, too."
908+
"comment":
909+
"Added section in ResourcePage for XD Toolkits and other assets, includes references on other pages, too."
900910
}
901911
],
902912
"dependency": [
@@ -951,7 +961,8 @@
951961
{
952962
"author": "John Miller <rubixws@gmail.com>",
953963
"commit": "055dd03c8ad9d74843f2bc3445d529a3c1fd8cb5",
954-
"comment": "Major site revisions, component updates, removal of dev office header and footer, infrastructure updates and improvements, webpack config updates."
964+
"comment":
965+
"Major site revisions, component updates, removal of dev office header and footer, infrastructure updates and improvements, webpack config updates."
955966
}
956967
],
957968
"dependency": [
@@ -1046,7 +1057,8 @@
10461057
{
10471058
"author": "lynamemi <lynam.emily@gmail.com>",
10481059
"commit": "2d179149380245f586834535299b5832094bee6d",
1049-
"comment": "Updated the CDN link on the \"Get Started\" page and section to an updated version of Fabric Core, 7.2.0"
1060+
"comment":
1061+
"Updated the CDN link on the \"Get Started\" page and section to an updated version of Fabric Core, 7.2.0"
10501062
}
10511063
],
10521064
"dependency": [
@@ -1106,7 +1118,8 @@
11061118
{
11071119
"author": "John Miller <rubixws@gmail.com>",
11081120
"commit": "16591f25f5ee2502e13e2ba1d764b4198e04d8ee",
1109-
"comment": "Updated fabric build system to use webpack dev server, removed the explicit !json loader in require statements."
1121+
"comment":
1122+
"Updated fabric build system to use webpack dev server, removed the explicit !json loader in require statements."
11101123
}
11111124
],
11121125
"dependency": [
@@ -1528,4 +1541,4 @@
15281541
}
15291542
}
15301543
]
1531-
}
1544+
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"copyTo": {
3-
"lib": [
4-
"./src/**/*.json"
5-
]
3+
"lib": ["./src/**/*.json"]
64
}
7-
}
5+
}

apps/fabric-website/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"scripts": {
1414
"build": "node ../../scripts/build.js",
1515
"clean": "node ../../scripts/clean.js",
16+
"code-style": "node ../../scripts/code-style.js",
1617
"start": "node ../../scripts/start.js",
1718
"production": "node --max_old_space_size=8192 ../../scripts/build.js --production",
1819
"dogfood": "node --max_old_space_size=8192 ../../scripts/build.js --dogfood",
@@ -44,4 +45,4 @@
4445
"office-ui-fabric-react": ">=6.4.0 <7.0.0",
4546
"tslib": "^1.7.1"
4647
}
47-
}
48+
}

0 commit comments

Comments
 (0)