Skip to content

Commit 608f4df

Browse files
committed
feat: add prettier and commitlint
1 parent e34e673 commit 608f4df

6 files changed

+42
-1
lines changed

.commitlintrc.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional']
3+
}

.husky/commit-msg

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

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint && yarn format

.prettierignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/dist/*
2+
.local
3+
.output.js
4+
/node_modules/**
5+
6+
**/*.svg
7+
**/*.sh
8+
9+
/public/*

.prettierrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"singleQuote": true,
6+
"semi": false,
7+
"trailingComma": "none",
8+
"bracketSpacing": true
9+
}

package.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"commit": "cz",
3737
"test": "vitest --run",
3838
"coverage": "vitest run --coverage",
39-
"lint": "eslint --fix --ext .js,jsx,cjs,mjs ./common",
39+
"format": "prettier --write .",
40+
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx --fix",
4041
"lint:all": "eslint .",
4142
"lint:fix": "eslint . --fix",
4243
"create-color-font": "node scripts/create-color-font.js"
@@ -46,12 +47,17 @@
4647
"@inquirer/select": "^2.0.0",
4748
"chalk": "^5.3.0",
4849
"commander": "^12.0.0",
50+
"eslint-config-prettier": "^9.1.0",
51+
"eslint-plugin-prettier": "^5.1.3",
4952
"glob": "^10.3.10",
5053
"inquirer": "^9.2.14",
54+
"prettier": "^3.2.5",
5155
"realm": "^12.6.0"
5256
},
5357
"devDependencies": {
5458
"@antfu/eslint-config": "^2.8.0",
59+
"@commitlint/cli": "^19.0.3",
60+
"@commitlint/config-conventional": "^19.0.3",
5561
"@types/node": "^20.11.5",
5662
"@vitest/coverage-v8": "^1.2.2",
5763
"commitizen": "^4.3.0",
@@ -61,10 +67,16 @@
6167
"eslint-config-airbnb-base": "^15.0.0",
6268
"eslint-plugin-import": "^2.29.1",
6369
"gradient-string": "^2.0.2",
70+
"husky": "^9.0.11",
6471
"rimraf": "^5.0.5",
6572
"vite": "^5.0.11",
6673
"vitest": "^1.2.2"
6774
},
75+
"lint-staged": {
76+
"*.{js,jsx,tsx,ts}": [
77+
"npm run lint"
78+
]
79+
},
6880
"config": {
6981
"commitizen": {
7082
"path": "./node_modules/cz-conventional-changelog"

0 commit comments

Comments
 (0)