From 69951443d1a2a8c8e31e6841cc0a3cf30aa2ec6c Mon Sep 17 00:00:00 2001 From: meetul Date: Mon, 1 Jan 2024 20:59:21 +0530 Subject: [PATCH] test --- .eslintignore | 3 ++- .husky/pre-commit | 6 ++++-- package.json | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1aa9d8a2d3a..452ddf82692 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,4 +4,5 @@ build coverage node_modules src/types -docs/Schema.md \ No newline at end of file +docs/Schema.md +package.json \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index fd80cee3955..eeeaa69562b 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -6,15 +6,17 @@ # Change to the current directory . "$(dirname -- "$0")/_/husky.sh" +STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(ts|tsx|json|scss|css)$") + # Formats code using prettier. -npm run format:fix +npm run pre-commit:format:fix -- $STAGED_FILES # Checks code for typescript type errors and throws errors if found. npm run typecheck # Checks and fixes all lint issues in code which don't require manual intervention. # Throws errors if lint issues requiring manual intervention are found in code. -npm run lint:fix +npm run pre-commit:lint:fix -- $STAGED_FILES npm run gen:schema diff --git a/package.json b/package.json index e66e1a2a986..3edc2773acf 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,9 @@ "typecheck": "graphql-codegen && tsc --noEmit --pretty", "lint:check": "eslint . --max-warnings=1500", "lint:fix": "eslint . --fix", + "pre-commit:lint:fix": "eslint --fix", "format:fix": "prettier --write \"**/*.{ts,tsx,json,scss,css}\"", + "pre-commit:format:fix": "prettier --write", "format:check": "prettier --check \"**/*.{ts,tsx,json,scss,css}\"", "prepare": "husky install", "generate:graphql-markdown": "graphql-markdown http://localhost:4000/graphql > docs/Schema.md",