diff --git a/package.json b/package.json index a4925b8788071b0c821fe7ed50855769e073b012..6d281d07499706ad72a5fb3afb3b2cf4d03e9536 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" } }