diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..a1fd632 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +pnpm run test:cli run +pnpm run lint diff --git a/eslint.config.js b/eslint.config.js index e33187a..0581434 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -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/*", diff --git a/package.json b/package.json index e998bda..dbee07f 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/packages/core/event-handler.js b/packages/core/event-handler.js index 80e8827..5b25bc5 100644 --- a/packages/core/event-handler.js +++ b/packages/core/event-handler.js @@ -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; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d64d146..842b0ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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: {}