diff --git a/.husky/pre-commit b/.husky/pre-commit index 5af23fe84..a19f49ff7 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,5 @@ if [[ "$OS" == "Windows_NT" ]]; then npx.cmd lint-staged - npm.cmd run typecheck else npx lint-staged - npm run typecheck fi diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 000000000..05a79cffd --- /dev/null +++ b/lint-staged.config.js @@ -0,0 +1,13 @@ +export default { + './**/*.js': (stagedFiles) => formatFiles(stagedFiles), + + './**/*.{ts,tsx,vue}': (stagedFiles) => [ + ...formatFiles(stagedFiles), + 'tsc --noEmit', + 'tsc-strict' + ] +} + +function formatFiles(fileNames) { + return [`prettier --write ${fileNames.join(' ')}`] +} diff --git a/package.json b/package.json index 4d2604b04..b6030d738 100644 --- a/package.json +++ b/package.json @@ -93,10 +93,4 @@ "vue-router": "^4.4.3", "zod": "^3.23.8", "zod-validation-error": "^3.3.0" - }, - "lint-staged": { - "./**/*.{js,ts,tsx,vue}": [ - "prettier --write" - ] - } -} + }}