From 31de127f4b47dddfe55cda5952d501902996d1a1 Mon Sep 17 00:00:00 2001 From: Sauradip Ghosh <82558066+Sauradip07@users.noreply.github.com> Date: Wed, 6 Mar 2024 03:07:40 +0530 Subject: [PATCH] [MNT] Added post-merge hook and updated scripts (#38) * Enhance the usability of users * Enhance the change format:fix * Added post-commit hook * change the lintstagedrc value * change the lintstagedrc value to check * Create codeql.yml * Create eslint.yml * Delete .github/workflows/eslint.yml * Delete .github/workflows/codeql.yml * Added clean install of node modules * remove unnecessary type check * Remove unnecessary type check from package.json * Added fromat check * Remove frormat:fix --- .husky/post-merge | 4 ++++ .husky/pre-commit | 1 + .lintstagedrc.json | 2 +- package.json | 6 ++++-- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .husky/post-merge diff --git a/.husky/post-merge b/.husky/post-merge new file mode 100644 index 00000000..3aaff098 --- /dev/null +++ b/.husky/post-merge @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +git diff HEAD^ HEAD --exit-code -- ./package.json || npm ci \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index d24fdfc6..7d5c4c84 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,3 +2,4 @@ . "$(dirname -- "$0")/_/husky.sh" npx lint-staged + diff --git a/.lintstagedrc.json b/.lintstagedrc.json index f7143671..aef4aebd 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,3 +1,3 @@ { - "*.{ts,tsx}": ["npm run lint", "npm run format"] + "*.{ts,tsx}": ["npm run lint:check", "npm run format:check"] } diff --git a/package.json b/package.json index 9a357514..38b19946 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,11 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives", + "lint:check": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings=0", + "lint:fix": "eslint --fix **/*.{ts,tsx}", "preview": "vite preview", - "format": "prettier --write .", + "format:fix": "prettier --write .", + "format:check": "prettier --check .", "prepare": "husky install" }, "dependencies": {