aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/package.json
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-26 11:19:45 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-30 09:20:37 +0100
commit9c99df922c0a21065f1e3764c77ae1973698da96 (patch)
treeab9625990dc5bcc6c1928d0d570c12f0d13549c7 /server/sonar-web/package.json
parente4ef72e885308b113d89a7826d1b300c093134cf (diff)
downloadsonarqube-9c99df922c0a21065f1e3764c77ae1973698da96.tar.gz
sonarqube-9c99df922c0a21065f1e3764c77ae1973698da96.zip
update validate script, lint files on commit (#2756)
Diffstat (limited to 'server/sonar-web/package.json')
-rw-r--r--server/sonar-web/package.json33
1 files changed, 17 insertions, 16 deletions
diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json
index 7d82399d2ad..070b2310f07 100644
--- a/server/sonar-web/package.json
+++ b/server/sonar-web/package.json
@@ -95,6 +95,7 @@
"handlebars-loader": "1.6.0",
"html-webpack-plugin": "2.30.1",
"jest": "21.2.1",
+ "lint-staged": "4.3.0",
"postcss-custom-properties": "6.2.0",
"postcss-loader": "2.0.8",
"prettier": "1.7.4",
@@ -117,8 +118,10 @@
"coverage": "npm test -- --coverage",
"format": "prettier --write --list-different 'src/main/js/!(libs)/**/*.{js,ts,tsx,css}'",
"lint": "eslint --ext js,ts,tsx --quiet src/main/js",
- "typecheck": "flow src/main/js",
- "validate": "eslint src/main/js && flow check src/main/js && NODE_ENV=test jest"
+ "flow-check": "flow check src/main/js",
+ "ts-check": "tsc --noEmit",
+ "validate": "yarn lint && yarn flow-check && yarn ts-check && NODE_ENV=test jest",
+ "precommit": "lint-staged"
},
"engines": {
"node": ">=6"
@@ -132,28 +135,19 @@
],
"jest": {
"coverageDirectory": "<rootDir>/target/coverage",
- "coveragePathIgnorePatterns": [
- "<rootDir>/node_modules",
- "<rootDir>/tests"
- ],
+ "coveragePathIgnorePatterns": ["<rootDir>/node_modules", "<rootDir>/tests"],
"mapCoverage": true,
- "moduleFileExtensions": [
- "ts",
- "tsx",
- "js",
- "json"
- ],
+ "moduleFileExtensions": ["ts", "tsx", "js", "json"],
"moduleNameMapper": {
- "^.+\\.(hbs|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/config/jest/FileStub.js",
+ "^.+\\.(hbs|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
+ "<rootDir>/config/jest/FileStub.js",
"^.+\\.css$": "<rootDir>/config/jest/CSSStub.js"
},
"setupFiles": [
"<rootDir>/config/polyfills.js",
"<rootDir>/config/jest/SetupTestEnvironment.js"
],
- "snapshotSerializers": [
- "enzyme-to-json/serializer"
- ],
+ "snapshotSerializers": ["enzyme-to-json/serializer"],
"testPathIgnorePatterns": [
"<rootDir>/node_modules",
"<rootDir>/src/main/webapp",
@@ -169,5 +163,12 @@
"jsxBracketSameLine": true,
"printWidth": 100,
"singleQuote": true
+ },
+ "lint-staged": {
+ "gitDir": "../../",
+ "linters": {
+ "*.{css,json}": ["prettier --write", "git add"],
+ "*.{js,ts,tsx}": ["eslint", "jest --bail --findRelatedTests", "prettier --write", "git add"]
+ }
}
}