From 9a3bafaaccf7f62f2d58fc4744c542dcd8e1a4b7 Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Wed, 7 Jul 2021 11:01:47 +0800 Subject: [PATCH 1/2] update husky and lint-staged config --- .lintstagedrc | 1 - package.json | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.lintstagedrc b/.lintstagedrc index 073463f6901..15ecb0e6102 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -3,6 +3,5 @@ "prettier --write", "eslint --fix", "stylelint --formatter verbose", - "git add" ] } \ No newline at end of file diff --git a/package.json b/package.json index 7043b4c5bbe..5cc741584ce 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,8 @@ "translate:upload": "crowdin upload sources -b crowdin", "deploy": "npm run build && gh-pages -d public -b master", "deploy-dev": "npm run build && gh-pages -d public", - "deploy-branch": "PATH_PREFIX=/deriv-com/br/$branch_name npm run build && gh-pages -d public -e br/$branch_name" + "deploy-branch": "PATH_PREFIX=/deriv-com/br/$branch_name npm run build && gh-pages -d public -e br/$branch_name", + "prepare": "husky install" }, "repository": { "type": "git", @@ -98,5 +99,12 @@ }, "bugs": { "url": "https://github.com/binary-com/deriv-com/issues" + }, + "lint-staged": { + "*.js": [ + "eslint --cache --fix", + "prettier --write" + ], + "*.css": "stylelint --fix" } } From 83de721b1abc47e4392d67bd6b8cbaf7ab18729d Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Wed, 7 Jul 2021 12:06:13 +0800 Subject: [PATCH 2/2] update husky and lint-staged config --- .husky/pre-commit | 2 +- .lintstagedrc | 4 +++- package.json | 10 ++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index c37466e2b30..78f90addcb1 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx lint-staged \ No newline at end of file +npm run pre-commit-lint \ No newline at end of file diff --git a/.lintstagedrc b/.lintstagedrc index 15ecb0e6102..0e59783ce91 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -1,7 +1,9 @@ { "src/**/*.js": [ - "prettier --write", "eslint --fix", "stylelint --formatter verbose", + ], + "src/**/*.{js,jsx,json,md}": [ + "prettier --write", ] } \ No newline at end of file diff --git a/package.json b/package.json index 5cc741584ce..531ad775563 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,8 @@ "deploy": "npm run build && gh-pages -d public -b master", "deploy-dev": "npm run build && gh-pages -d public", "deploy-branch": "PATH_PREFIX=/deriv-com/br/$branch_name npm run build && gh-pages -d public -e br/$branch_name", - "prepare": "husky install" + "prepare": "husky install", + "pre-commit-lint": "lint-staged" }, "repository": { "type": "git", @@ -99,12 +100,5 @@ }, "bugs": { "url": "https://github.com/binary-com/deriv-com/issues" - }, - "lint-staged": { - "*.js": [ - "eslint --cache --fix", - "prettier --write" - ], - "*.css": "stylelint --fix" } }