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.json b/package.json index 18ac4c3a1..8a4ff4887 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "build": "next build", "build-analyze": "ANALYZE=true next build", "postbuild": "next export", - "start": "next start" + "start": "next start", + "prepare": "husky install" }, "dependencies": { "@ente-io/next-with-workbox": "^1.0.3", @@ -75,12 +76,15 @@ "eslint-config-google": "^0.14.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-react": "^7.23.2", - "husky": "^6.0.0", - "lint-staged": "^11.0.0", + "husky": "^7.0.1", + "lint-staged": "^11.1.2", "prettier": "2.3.2", "typescript": "^4.1.3" }, "standard": { "parser": "babel-eslint" + }, + "lint-staged": { + "src/**/*.{js,jsx,ts,tsx}": ["eslint","prettier --write --ignore-unknown"] } } diff --git a/yarn.lock b/yarn.lock index b49e0bf0e..8b5f698ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3658,10 +3658,10 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -husky@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" - integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ== +husky@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.1.tgz#579f4180b5da4520263e8713cc832942b48e1f1c" + integrity sha512-gceRaITVZ+cJH9sNHqx5tFwbzlLCVxtVZcusME8JYQ8Edy5mpGDOqD8QBCdMhpyo9a+JXddnujQ4rpY2Ff9SJA== iconv-lite@0.4.24: version "0.4.24" @@ -4129,7 +4129,7 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@^11.0.0: +lint-staged@^11.1.2: version "11.1.2" resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-11.1.2.tgz#4dd78782ae43ee6ebf2969cad9af67a46b33cd90" integrity sha512-6lYpNoA9wGqkL6Hew/4n1H6lRqF3qCsujVT0Oq5Z4hiSAM7S6NksPJ3gnr7A7R52xCtiZMcEUNNQ6d6X5Bvh9w==