From 721225b71d14e06f809e801f823f8e7b30327a42 Mon Sep 17 00:00:00 2001 From: Supriya M Date: Sat, 9 Sep 2023 22:10:46 +0530 Subject: [PATCH 1/2] feat: added husky for lint and prettier --- .husky/pre-commit | 4 ++++ package.json | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000000..7e2936624c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +yarn pre-commit \ No newline at end of file diff --git a/package.json b/package.json index ac3a01016f..381f59a185 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,15 @@ "cypress:run": "cypress run", "lint": "eslint src/**/*.{js,jsx,ts,tsx}", "lint:fix": "eslint --fix src/**/*.{js,jsx,ts,tsx}", - "format": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,css,md}\" --config ./.prettierrc" + "format": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,css,md}\" --config ./.prettierrc", + "prepare": "husky install", + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.+(js|jsx|ts|tsx)": [ + "eslint --fix", + "prettier --write" + ] }, "reactSnap": { "puppeteerArgs": [ @@ -132,6 +140,8 @@ "eslint-plugin-promise": "^6.0.0", "eslint-plugin-react": "^7.31.10", "eslint-plugin-react-hooks": "^4.6.0", + "husky": "^8.0.3", + "lint-staged": "^13.2.2", "postcss": "^8.4.13", "prettier": "^2.7.1", "puppeteer": "^13.7.0", From 3fd8ebb3e9735a8a37032535b032d8caba51dbe8 Mon Sep 17 00:00:00 2001 From: Supriya M Date: Sat, 9 Sep 2023 22:15:26 +0530 Subject: [PATCH 2/2] chore: changed access permission for file --- .husky/pre-commit | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755