Skip to content

Commit 9da36cc

Browse files
committed
chore: add prettier.
1 parent febb885 commit 9da36cc

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package.json
2+
dist
3+
build
4+
lib
5+
esm

.prettierrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 120,
5+
"overrides": [
6+
{
7+
"files": ".prettierrc",
8+
"options": { "parser": "json" }
9+
}
10+
]
11+
}

package.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
"require": "./cjs/index.js"
1111
},
1212
"scripts": {
13-
"prepare": "npm run build",
13+
"prepare": "husky install && npm run build",
1414
"watch": "tsbb watch",
1515
"build": "tsbb build",
1616
"doc": "kkt build --app-src ./website",
17-
"start": "kkt start --app-src ./website"
17+
"start": "kkt start --app-src ./website",
18+
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,html,less,md,json}'"
1819
},
1920
"repository": {
2021
"type": "git",
@@ -56,6 +57,11 @@
5657
"react-app/jest"
5758
]
5859
},
60+
"lint-staged": {
61+
"*.{js,jsx,ts,tsx,html,less,md,json}": [
62+
"prettier --write"
63+
]
64+
},
5965
"devDependencies": {
6066
"@codemirror/lang-cpp": "0.19.1",
6167
"@codemirror/lang-html": "0.19.1",
@@ -79,7 +85,10 @@
7985
"@uiw/react-shields": "1.1.1",
8086
"@uiw/reset.css": "1.0.5",
8187
"code-example": "3.0.6",
88+
"husky": "7.0.2",
8289
"kkt": "6.11.0",
90+
"lint-staged": "11.1.2",
91+
"prettier": "2.3.2",
8392
"react": "17.0.2",
8493
"react-dom": "17.0.2",
8594
"tsbb": "3.0.4"

0 commit comments

Comments
 (0)