Skip to content

Commit 4368037

Browse files
authored
Add prettier (#117)
* feat: add prettier file
1 parent 37f443a commit 4368037

11 files changed

+1883
-500
lines changed

.commitlintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"type-enum": [
5+
2,
6+
"always",
7+
["feat", "fix", "build", "ci", "docs", "perf", "refactor", "test", "types", "style", "revert", "chore"]
8+
]
9+
}
10+
};

.eslintrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser", // Eslint TypeScript Parser
3+
extends: ["plugin:prettier/recommended"],
4+
plugins: ["@typescript-eslint"],
5+
parserOptions: {
6+
ecmaVersion: 2019,
7+
sourceType: "module",
8+
ecmaFeatures: {
9+
jsx: true
10+
}
11+
},
12+
env: {
13+
browser: true,
14+
node: true
15+
}
16+
};

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ e2e/screenshots/*
1717
e2e/downloads/*
1818
e2e/diff/*
1919
e2e/.dev/mpa
20+
.husky/post-checkout
21+
.husky/post-commit
22+
.husky/pre-push
23+
.husky/post-merge

.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 -- commitlint --edit "$1"

.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+
npx lint-staged

.prettierrc.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# More detail:https://prettier.io/docs/en/configuration.html
2+
3+
---
4+
printWidth: 120
5+
proseWrap: never
6+
singleQuote: false
7+
trailingComma: none
8+
semi: true
9+
tabWidth: 2
10+
useTabs: false

package.json

+15-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,16 @@
6363
"ts-node": "^10.9.2",
6464
"tsconfig-paths": "^4.2.0",
6565
"typescript": "^5.5.3",
66-
"vite": "^5.3.4"
66+
"vite": "^5.3.4",
67+
"husky": "^8.0.3",
68+
"lint-staged": "^10.5.4",
69+
"@typescript-eslint/eslint-plugin": "^6.21.0",
70+
"@typescript-eslint/parser": "^6.21.0",
71+
"eslint": "^8.57.1",
72+
"eslint-config-prettier": "^8.10.0",
73+
"eslint-plugin-prettier": "^5.2.1",
74+
"@commitlint/cli": "^11.0.0",
75+
"@commitlint/config-conventional": "^11.0.0"
6776
},
6877
"ci": {
6978
"type": "aci",
@@ -111,7 +120,11 @@
111120
"build:watch": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c --watch",
112121
"ci": "npm run lint && npm run test-cov",
113122
"lint": "eslint src --fix --ext .ts,.tsx",
114-
"b:types": "tsc --emitDeclarationOnly"
123+
"b:types": "tsc --emitDeclarationOnly",
124+
"prepare": "husky install"
125+
},
126+
"lint-staged": {
127+
"*.{ts,tsx}": ["eslint --fix"]
115128
},
116129
"types": "types/index.d.ts",
117130
"repository": "https://github.com/johanzhu/engine-spine.git"

0 commit comments

Comments
 (0)