Skip to content

Commit b0f8b9a

Browse files
committed
prettier config
1 parent 0d4aaeb commit b0f8b9a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/config/prettier.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 140,
3+
"proseWrap": "always"
4+
}

tasks/code.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ description: This file defines the tasks for code formatting across various lang
44

55
vars:
66
SPELLCHECK_ON: md,txt,html
7+
PRETTIER_CONFIG: .github/config/prettier.json
8+
PRETTIER_FILES: js,ts,jsx,tsx,css,scss,md,json
9+
MARKDOWNLINT_CONFIG: .github/config/.markdownlint.json
710

811
tasks:
912
format:
1013
desc: Format all code files in the repository
1114
cmds:
12-
- npx --yes prettier --write '**/*.{js,ts,jsx,tsx,css,scss,md,yml,yaml,json}' || true
13-
- npx --yes markdownlint-cli2 '**/*.md' --config .github/config/.markdownlint.json --fix || true
15+
- npx --yes prettier --config {{.PRETTIER_CONFIG}} --write '**/*.{ {{.PRETTIER_FILES}} }' || true
16+
- npx --yes prettier --write '**/*.{yml,yaml}' || true
17+
- npx --yes markdownlint-cli2 '**/*.md' --config {{.MARKDOWNLINT_CONFIG}} --fix || true
1418
- "[ -d src ] && gofmt -w src || true"
1519
- '[ -d src ] && find src -name "*.java" -exec java -jar google-java-format.jar --replace {} + || true'
1620
- '[ -d src ] && find src -name "*.go" -exec gofmt -w {} + || true'
@@ -19,8 +23,9 @@ tasks:
1923
lint:
2024
desc: Lint all code and markdown files in the repository
2125
cmds:
22-
- "npx --yes prettier --check '**/*.{js,ts,jsx,tsx,css,scss,md,yml,yaml,json}' || (echo '❌ Prettier check failed! Please format your code with: task code:format' && exit 1)"
23-
- npx --yes markdownlint-cli2 '**/*.md' --config .github/config/.markdownlint.json || (echo "❌ Markdownlint check failed! Please fix Markdown issues." && exit 1)
26+
- "npx --yes prettier --config {{.PRETTIER_CONFIG}} --check '**/*.{ {{.PRETTIER_FILES}} }' || (echo '❌ Prettier check failed! Please format your code with: task code:format' && exit 1)"
27+
- npx --yes prettier --check '**/*.{yml,yaml}'
28+
- npx --yes markdownlint-cli2 '**/*.md' --config {{.MARKDOWNLINT_CONFIG}} || (echo "❌ Markdownlint check failed! Please fix Markdown issues." && exit 1)
2429
silent: false
2530

2631
spellcheck:

0 commit comments

Comments
 (0)