From 71886fc3338ec796d24ceb1891c6a9cc55dddf8a Mon Sep 17 00:00:00 2001 From: "mirlan.maksitaliev" Date: Tue, 2 Jun 2020 16:33:55 +0600 Subject: [PATCH] chore: lint staged configuration --- package.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3dc0a6bc..e6968d2e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "prestart ": "yarn generate", "start": "react-scripts start", "build": "GENERATE_SOURCEMAP=false react-scripts build && gzipper --verbose ./build", - "test": "react-scripts test --passWithNoTests --watchAll=false", + "test": "react-scripts test --testMatch '**/__tests__/*' --passWithNoTests --watchAll=false", + "test:watch": "react-scripts test --testMatch '**/__tests__/*'", "eject": "react-scripts eject", "generate": "graphql-codegen --config codegen.yml", "lint": "eslint 'src/**/*.{ts,tsx}'" @@ -50,6 +51,7 @@ "eslint-plugin-typescript-sort-keys": "^1.2.0", "gzipper": "^3.7.0", "husky": "^4.2.5", + "lint-staged": "^10.2.7", "typescript": "^3.9.3" }, "config": { @@ -59,10 +61,16 @@ }, "husky": { "hooks": { - "pre-commit": "npm test", + "pre-commit": "lint-staged", "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } }, + "lint-staged": { + "src/**/*.{ts,tsx}": [ + "npm run lint -- --max-warnings 0", + "npm run test -- --findRelatedTests" + ] + }, "browserslist": { "production": [ ">0.2%",