Commit cd0248ea authored by 偏右's avatar 偏右 Committed by GitHub

Lint staged (#25)

* Add lint-staged

* update
parent 12f41ad8
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "ant-design-pro", "name": "ant-design-pro",
"private": true, "private": true,
"scripts": { "scripts": {
"precommit": "npm run lint", "precommit": "npm run lint-staged",
"start": "roadhog server", "start": "roadhog server",
"start:no-proxy": "NO_PROXY=true roadhog server", "start:no-proxy": "NO_PROXY=true roadhog server",
"build": "roadhog build", "build": "roadhog build",
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
"lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style", "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: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": "jest",
"test:all": "node ./tests/run-tests.js" "test:all": "node ./tests/run-tests.js"
}, },
...@@ -45,6 +47,7 @@ ...@@ -45,6 +47,7 @@
"gh-pages": "^1.0.0", "gh-pages": "^1.0.0",
"husky": "^0.14.3", "husky": "^0.14.3",
"jest": "^21.0.1", "jest": "^21.0.1",
"lint-staged": "^4.3.0",
"mockjs": "^1.0.1-beta3", "mockjs": "^1.0.1-beta3",
"nightmare": "^2.10.0", "nightmare": "^2.10.0",
"react-test-renderer": "^15.6.2", "react-test-renderer": "^15.6.2",
...@@ -79,5 +82,10 @@ ...@@ -79,5 +82,10 @@
"moduleNameMapper": { "moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/tests/styleMock.js" "\\.(css|less)$": "<rootDir>/tests/styleMock.js"
} }
},
"lint-staged": {
"**/*.{js,jsx}": "lint-staged:js",
"**/*.less": "stylelint --syntax less",
"src/**/demo/*.md": "lint-staged:demo"
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment