Run pre-commit type check only for TypeScript (#1597)

* Prevent unnecessary type-checks

* Remove commented code
This commit is contained in:
filtered
2024-11-19 13:58:54 +11:00
committed by GitHub
parent 6e49685f58
commit 40245aacf9
3 changed files with 14 additions and 9 deletions

View File

@@ -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

13
lint-staged.config.js Normal file
View File

@@ -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(' ')}`]
}

View File

@@ -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"
]
}
}
}}