chore: set up husky

This commit is contained in:
Ayo Ayco 2024-12-19 23:07:49 +01:00
parent 4975bb8206
commit 5a4f8b9b30
5 changed files with 17 additions and 7 deletions

2
.husky/pre-commit Normal file
View file

@ -0,0 +1,2 @@
pnpm run test:cli run
pnpm run lint

View file

@ -5,11 +5,6 @@ import pluginJs from "@eslint/js";
export default [
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
{
rules: {
"no-unused-vars": "warn",
},
},
{
ignores: [
"dist/*",

View file

@ -10,12 +10,14 @@
"create": "node ./packages/create-mcfly",
"cli": "node ./packages/cli",
"test:cli": "cd packages/cli && pnpm run test",
"lint": "eslint . --config eslint.config.js"
"lint": "eslint . --config eslint.config.js",
"prepare": "husky"
},
"packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c",
"devDependencies": {
"@eslint/js": "^9.17.0",
"eslint": "^9.17.0",
"globals": "^15.14.0"
"globals": "^15.14.0",
"husky": "^9.1.7"
}
}

View file

@ -176,6 +176,7 @@ async function buildRegistry(usedCustomElements, type, storage) {
function isConstructor(f) {
try {
new f();
// eslint-disable-next-line no-unused-vars
} catch (err) {
// TODO: verify err is the expected error and then
return false;

View file

@ -17,6 +17,9 @@ importers:
globals:
specifier: ^15.14.0
version: 15.14.0
husky:
specifier: ^9.1.7
version: 9.1.7
packages/cli:
dependencies:
@ -1837,6 +1840,11 @@ packages:
resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==}
engines: {node: '>=16.17.0'}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
ieee754@1.2.1:
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
@ -4582,6 +4590,8 @@ snapshots:
human-signals@5.0.0: {}
husky@9.1.7: {}
ieee754@1.2.1: {}
ignore@5.3.2: {}