Skip to content

Commit aa07df1

Browse files
authored
Add source format checking with prettier (#19)
* Add source format checking with prettier * add craft first dependency * add craft first plugin
1 parent a29e92c commit aa07df1

File tree

5 files changed

+20292
-14
lines changed

5 files changed

+20292
-14
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Unique name for this workflow
2+
name: Validate Source Code
3+
4+
# Definition when the workflow should run
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
types: [opened, synchronize]
9+
10+
# Jobs to be executed
11+
jobs:
12+
validate-source-code-format:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Checkout the code in the PR
16+
- name: Checkout repository
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
ref: ${{ github.event.pull_request.head.sha }}
21+
22+
# Install Node JS
23+
- name: Install NodeJS
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: "14"
27+
cache: "npm"
28+
29+
- name: Install dependencies
30+
run: npm ci --no-audit --prefer-offline
31+
32+
# Verify Source Format with Prettier
33+
- name: Check format with Prettier
34+
run: |
35+
git diff -z --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha}}...${{ github.event.pull_request.head.sha }} | xargs -0 -I {} npx prettier --ignore-unknown --validate "{}"

.prettierignore

+32-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,35 @@
66
.localdevserver
77
.sfdx
88

9-
coverage/
9+
coverage/
10+
bower_components/
11+
node_modules/
12+
jspm_packages/
13+
dist/
14+
build/
15+
lib-cov
16+
.nyc_output
17+
.gitattributes
18+
.gitignore
19+
.env
20+
.env.build
21+
.env.test
22+
.npm
23+
.npmrc
24+
yarn
25+
.yarn-integrity
26+
.yarnclean
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
yarn.lock
31+
package-lock.json
32+
logs
33+
*.log
34+
*.min.js
35+
*.min.css
36+
.editorconfig
37+
.eslintignore
38+
.markdownlintignore
39+
.prettierignore
40+
.sfdx/

.prettierrc

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
{
22
"trailingComma": "none",
3+
"useTabs": true,
34
"overrides": [
45
{
56
"files": "**/lwc/**/*.html",
6-
"options": { "parser": "lwc" }
7+
"options": {
8+
"parser": "lwc"
9+
}
710
},
811
{
912
"files": "*.{cmp,page,component}",
10-
"options": { "parser": "html" }
13+
"options": {
14+
"parser": "html"
15+
}
16+
},
17+
{
18+
"files": "*.md",
19+
"options": {
20+
"printWidth": 70,
21+
"useTabs": false,
22+
"trailingComma": "none",
23+
"arrowParens": "avoid",
24+
"proseWrap": "never"
25+
}
26+
},
27+
{
28+
"files": "*.{json,babelrc,eslintrc,remarkrc,prettierrc}",
29+
"options": {
30+
"useTabs": false
31+
}
1132
}
1233
]
1334
}

0 commit comments

Comments
 (0)