Skip to content

Commit 394b9a0

Browse files
committed
chore: add lint-staged
1 parent df16d01 commit 394b9a0

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
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

.prettierignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Build output
2+
build/
3+
dist/
4+
coverage/
5+
6+
# Dependencies
7+
node_modules/
8+
9+
# Logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
15+
# Configuration files
16+
package-lock.json
17+
yarn.lock
18+
19+
# IDE
20+
.vscode/
21+
.idea/
22+
23+
# OS
24+
.DS_Store
25+
Thumbs.db
26+
27+
# Jest
28+
jest-results.json
29+
30+
# ESLint cache
31+
.eslintcache

.prettierrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"bracketSameLine": false,
10+
"arrowParens": "avoid",
11+
"endOfLine": "lf",
12+
"quoteProps": "as-needed",
13+
"jsxSingleQuote": true,
14+
"proseWrap": "preserve"
15+
}

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --no-cache",
3737
"lint": "eslint src/**/*.ts",
3838
"lint:fix": "eslint src/**/*.ts --fix",
39+
"lint:staged": "lint-staged",
3940
"type-check": "tsc --noEmit",
4041
"pre-push": "npm run type-check && npm run lint && npm run test:ci",
4142
"commitlint": "commitlint --edit",
@@ -67,12 +68,27 @@
6768
"globals": "^15.0.0",
6869
"husky": "^8.0.3",
6970
"jest": "^29.7.0",
71+
"lint-staged": "^15.0.0",
72+
"prettier": "^3.0.0",
7073
"ts-jest": "^29.1.2",
7174
"typescript": "^5.3.3"
7275
},
7376
"config": {
7477
"commitizen": {
7578
"path": "./node_modules/cz-conventional-changelog"
7679
}
80+
},
81+
"lint-staged": {
82+
"*.{ts,tsx}": [
83+
"eslint --fix",
84+
"prettier --write"
85+
],
86+
"*.{js,jsx}": [
87+
"eslint --fix",
88+
"prettier --write"
89+
],
90+
"*.{json,md,yml,yaml}": [
91+
"prettier --write"
92+
]
7793
}
7894
}

0 commit comments

Comments
 (0)