From cd0248ea6f8c54551d15909d4f0c8f6d4b721c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 23 Oct 2017 09:09:45 -0500 Subject: [PATCH] Lint staged (#25) * Add lint-staged * update --- package.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a4925b87..6d281d07 100755 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ant-design-pro", "private": true, "scripts": { - "precommit": "npm run lint", + "precommit": "npm run lint-staged", "start": "roadhog server", "start:no-proxy": "NO_PROXY=true roadhog server", "build": "roadhog build", @@ -10,6 +10,8 @@ "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", + "lint-staged": "lint-staged", + "lint-staged:js": "eslint --ext .js", "test": "jest", "test:all": "node ./tests/run-tests.js" }, @@ -45,6 +47,7 @@ "gh-pages": "^1.0.0", "husky": "^0.14.3", "jest": "^21.0.1", + "lint-staged": "^4.3.0", "mockjs": "^1.0.1-beta3", "nightmare": "^2.10.0", "react-test-renderer": "^15.6.2", @@ -79,5 +82,10 @@ "moduleNameMapper": { "\\.(css|less)$": "/tests/styleMock.js" } + }, + "lint-staged": { + "**/*.{js,jsx}": "lint-staged:js", + "**/*.less": "stylelint --syntax less", + "src/**/demo/*.md": "lint-staged:demo" } } -- GitLab