diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..36af21989 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/package-lock.json b/package-lock.json index 920ebcb85..d2d4e4a0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,8 +56,9 @@ "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react": "^7.29.4", "eslint-plugin-react-hooks": "^4.4.0", + "husky": "^8.0.3", "jest": "^27.5.1", - "lint-staged": "^12.3.8", + "lint-staged": "^12.5.0", "prettier": "^3.0.1", "serve": "^14.1.1", "tslint": "^6.1.3", @@ -7933,6 +7934,21 @@ "node": ">=8.12.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/i18next": { "version": "21.10.0", "funding": [ @@ -12861,8 +12877,9 @@ }, "node_modules/lint-staged": { "version": "12.5.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.5.0.tgz", + "integrity": "sha512-BKLUjWDsKquV/JuIcoQW4MSAI3ggwEImF1+sB4zaKvyVx1wBk3FsG7UK9bpnmBTN1pm7EH2BBcMwINJzCRv12g==", "dev": true, - "license": "MIT", "dependencies": { "cli-truncate": "^3.1.0", "colorette": "^2.0.16", diff --git a/package.json b/package.json index 05b284afb..f5210b4c6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "lint-staged": { - ".": [ + "*.{js,ts,tsx,css,md,json}": [ "prettier --write" ] }, @@ -54,7 +54,8 @@ "lint-fix": "eslint ./ --fix", "format": "prettier --write .", "format-all": "prettier --write .", - "cy:open": "cypress open" + "cy:open": "cypress open", + "prepare": "husky install" }, "eslintConfig": { "extends": [ @@ -92,8 +93,9 @@ "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react": "^7.29.4", "eslint-plugin-react-hooks": "^4.4.0", + "husky": "^8.0.3", "jest": "^27.5.1", - "lint-staged": "^12.3.8", + "lint-staged": "^12.5.0", "prettier": "^3.0.1", "serve": "^14.1.1", "tslint": "^6.1.3",