Skip to content

Commit 3a819fb

Browse files
committedAug 5, 2021
chore(format): add prettier
- upgrade prettier to v2.3.2 - lock version to prevent breaking changes in minor versions - add prettier.dry-run package.json script - add pipeline action to evaluate format status - add prettierignore file for faster runs STENCIL-8: Add Prettier to Stencil
1 parent 1381cc7 commit 3a819fb

File tree

6 files changed

+92
-24
lines changed

6 files changed

+92
-24
lines changed
 

‎.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

‎.github/workflows/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
- name: Install dependencies
3131
run: npm ci
3232

33+
- name: Prettier dry-run
34+
run: npm run prettier.dry-run
35+
shell: bash
36+
3337
- name: Build
3438
run: npm run build -- --ci
3539

‎.prettierignore

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# auto-generated dependencies list
2+
/dependencies.json
3+
4+
# npm packages in the root of the project and subdirectories
5+
node_modules/
6+
7+
# submodule packages
8+
/build/
9+
/cli/
10+
/compiler/
11+
/dev-server/
12+
/internal/
13+
/mock-doc/
14+
/sys/
15+
/testing/
16+
17+
# shims that are attributed to external authors, and are minified out of the box
18+
/src/client/polyfills/core-js.js
19+
/src/client/polyfills/dom.js
20+
/src/client/polyfills/es5-html-element.js
21+
/src/client/polyfills/index.js
22+
/src/client/polyfills/system.js
23+
24+
# project notes shared with the community
25+
/notes/
26+
27+
# output of building various scripts that support the project
28+
/scripts/build/
29+
30+
# these files are intentionally incomplete JavaScript files (they are parts of an Immediately Invoked Funciton
31+
# Expression (IIFE)). They act as a 'header' and 'footer' that get prepended and appended to the Stencil compiler.
32+
# Ignore them so Prettier doesn't fail and the 'prettier-ignore' pragma doesn't get put in the compiler output.
33+
/scripts/bundles/helpers/compiler-cjs-intro.js
34+
/scripts/bundles/helpers/compiler-cjs-outro.js
35+
36+
# output from compiling Stencil projects for testing purposes
37+
test/**/dist/
38+
test/**/dist-react/
39+
test/**/hydrate/
40+
test/**/test-dist/
41+
test/**/www/
42+
test/**/components.d.ts
43+
test/end-to-end/screenshot/
44+
test/end-to-end/docs.d.ts
45+
test/end-to-end/docs.json
46+
47+
# minified angular that exists in the test directory
48+
test/karma/test-app/assets/angular.min.js
49+
50+
# generated screenshot files
51+
/screenshot/index.js
52+
/screenshot/package.json
53+
/screenshot/pixel-match.js
54+
/screenshot/*.d.ts
55+

‎.prettierrc.json

-13
This file was deleted.

‎package-lock.json

+25-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"rollup.prod.ci": "rollup --config --config-prod --config-ci",
3737
"rollup.watch": "rollup --watch --config",
3838
"license": "node scripts --license",
39-
"prettier": "prettier --write \"./src/**/*.{ts,tsx}\"",
39+
"prettier": "npm run prettier.base -- --write",
40+
"prettier.base": "prettier \"./{bin,scripts,src,test}/**/*.{ts,tsx,js,jsx}\"",
41+
"prettier.dry-run": "npm run prettier.base -- --list-different",
4042
"test": "jest",
4143
"test.analysis": "cd test && npm run build",
4244
"test.dist": "node scripts --validate-build",
@@ -50,6 +52,7 @@
5052
"test.watch": "jest --watch"
5153
},
5254
"devDependencies": {
55+
"@ionic/prettier-config": "^2.0.0",
5356
"@rollup/plugin-commonjs": "15.1.0",
5457
"@rollup/plugin-json": "4.1.0",
5558
"@rollup/plugin-node-resolve": "9.0.0",
@@ -104,7 +107,7 @@
104107
"path-browserify": "^1.0.1",
105108
"pixelmatch": "4.0.2",
106109
"postcss": "^8.2.8",
107-
"prettier": "^2.2.1",
110+
"prettier": "2.3.2",
108111
"prompts": "2.4.0",
109112
"puppeteer": "~10.0.0",
110113
"rollup": "2.42.3",
@@ -137,5 +140,6 @@
137140
"custom elements",
138141
"pwa",
139142
"progressive web app"
140-
]
143+
],
144+
"prettier": "@ionic/prettier-config"
141145
}

0 commit comments

Comments
 (0)
Please sign in to comment.