Fix Husky setup (#28636)

Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Jon Koops 2024-04-11 16:11:06 +02:00 committed by GitHub
parent 8bec2442ef
commit 242063dc74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View file

@ -7,5 +7,4 @@ if [ ! -f "$FILE" ]; then
exit 0; exit 0;
fi fi
cd js ESLINT_USE_FLAT_CONFIG=true pnpm exec lint-staged
pnpm exec lint-staged

8
js/lint-staged.config.js Normal file
View file

@ -0,0 +1,8 @@
import path from "node:path";
const CONFIG_PATH = path.resolve(import.meta.dirname, "eslint.config.js");
export default {
"*.{js,jsx,mjs,ts,tsx}": (filenames) =>
`eslint --config ${CONFIG_PATH} --cache --fix ${filenames.join(" ")}`,
};

View file

@ -2,7 +2,7 @@
"name": "root", "name": "root",
"type": "module", "type": "module",
"scripts": { "scripts": {
"prepare": "cd .. && husky js/.husky" "prepare": "husky js/.husky"
}, },
"devDependencies": { "devDependencies": {
"@eslint/eslintrc": "^3.0.2", "@eslint/eslintrc": "^3.0.2",
@ -24,8 +24,5 @@
"typescript-eslint": "^7.6.0", "typescript-eslint": "^7.6.0",
"wireit": "^0.14.4" "wireit": "^0.14.4"
}, },
"packageManager": "pnpm@8.15.5", "packageManager": "pnpm@8.15.5"
"lint-staged": {
"*.{js,jsx,mjs,ts,tsx}": "eslint --cache --fix"
}
} }