From 117ac96ba3acdf42538001c5d4da1ff739d52cae Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Tue, 5 Dec 2017 21:11:48 +0800 Subject: [PATCH] add prettier to precommit --- package.json | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 5f9e70ce..031c6261 100755 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "jest": "^21.0.1", "lint-staged": "^4.3.0", "mockjs": "^1.0.1-beta3", + "prettier": "^1.9.0", "pro-download": "^1.0.0", "react-test-renderer": "^16.0.0", "redbox-react": "^1.3.2", @@ -81,38 +82,22 @@ "nightmare": "^2.10.0" }, "babel": { - "presets": [ - "env", - "react" - ], - "plugins": [ - "transform-decorators-legacy", - "transform-class-properties" - ] + "presets": ["env", "react"], + "plugins": ["transform-decorators-legacy", "transform-class-properties"] }, "jest": { - "setupFiles": [ - "/tests/setupTests.js" - ], - "testMatch": [ - "**/?(*.)(spec|test|e2e).js?(x)" - ], + "setupFiles": ["/tests/setupTests.js"], + "testMatch": ["**/?(*.)(spec|test|e2e).js?(x)"], "setupTestFrameworkScriptFile": "/tests/jasmine.js", - "moduleFileExtensions": [ - "js", - "jsx" - ], + "moduleFileExtensions": ["js", "jsx"], "moduleNameMapper": { "\\.(css|less)$": "/tests/styleMock.js" } }, "lint-staged": { "**/*.{js,jsx}": "lint-staged:js", - "**/*.less": "stylelint --syntax less" + "**/*.less": "stylelint --syntax less", + "*.{js,jsx,less,json}": ["prettier --write", "git add"] }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 10" - ] + "browserslist": ["> 1%", "last 2 versions", "not ie <= 10"] } -- GitLab