diff --git a/.github/husky/.gitignore b/.github/husky/.gitignore deleted file mode 100644 index 31354ec..0000000 --- a/.github/husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.github/husky/pre-commit b/.husky/pre-commit similarity index 58% rename from .github/husky/pre-commit rename to .husky/pre-commit index 81379d5..101ae24 100755 --- a/.github/husky/pre-commit +++ b/.husky/pre-commit @@ -4,6 +4,5 @@ . "$(dirname "$0")/_/husky.sh" -npm run format - -npm run test +npx lint-staged --verbose --allow-empty +echo "" diff --git a/.github/husky/pre-push b/.husky/pre-push similarity index 100% rename from .github/husky/pre-push rename to .husky/pre-push diff --git a/package.json b/package.json index 7bf6dde..cedf1fe 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,12 @@ "npm": ">=10" }, "scripts": { - "prepare": "husky install ./.github/husky", "format": "npx prettier --config-precedence prefer-file --write . && eslint . --fix", + "prepare": "husky", "pretest": "npx eslint-config-prettier eslint.config.js", "test": "npm run test --workspaces --if-present", - "publish": "npm publish --access public --workspaces", - "update": "./.github/scripts/update.sh" + "update": "./.github/scripts/update.sh", + "publish": "npm publish --provenance --access public --workspaces" }, "devDependencies": { "@github/prettier-config": "^0.0.6", @@ -40,13 +40,24 @@ "eslint-plugin-markdown": "^5.0.0", "eslint-plugin-prettier": "^5.1.3", "globals": "^15.8.0", + "husky": "^9.0.11", + "lint-staged": "^15.2.7", "prettier": "^3.3.2" }, "husky": { "hooks": { - "pre-commit": "./.github/husky/pre-commit", - "pre-push": "./.github/husky/pre-push" + "pre-commit": ".husky/pre-commit", + "pre-push": ".husky/pre-push" } }, + "lint-staged": { + "*.{js,jsx,ts,tsx}": [ + "npm run format", + "npm run test" + ], + "*.{json,md}": [ + "prettier --write" + ] + }, "prettier": "@github/prettier-config" }