build: add husky, support lint code when pre-commit (#178)

This commit is contained in:
Alan.He
2024-03-04 17:04:43 -08:00
committed by GitHub
parent ddd79c5949
commit d2b1333006
3 changed files with 821 additions and 13 deletions
+1
View File
@@ -0,0 +1 @@
npm run pre-commit
+810 -12
View File
File diff suppressed because it is too large Load Diff
+10 -1
View File
@@ -22,7 +22,8 @@
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"lint": "eslint src/ --ext .ts,.tsx && prettier src/ --check",
"lint:fix": "eslint src/ --ext .ts,.tsx --fix && prettier src/ --write",
"debug": "node --inspect --loader ts-node/esm src/index.ts -V"
"debug": "node --inspect --loader ts-node/esm src/index.ts -V",
"pre-commit": "lint-staged"
},
"repository": {
"type": "git",
@@ -61,10 +62,18 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-react": "^7.33.2",
"husky": "^9.0.11",
"jest": "^29.7.0",
"lint-staged": "^15.2.2",
"prettier": "3.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.2.2"
},
"lint-staged": {
"{,src/**/}*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
}
}