Browse Source

Run jsxhint as part of checks

David Cramer 10 years ago
parent
commit
a28d087ef2
3 changed files with 9 additions and 6 deletions
  1. 3 1
      Makefile
  2. 4 1
      hooks/pre-commit
  3. 2 4
      package.json

+ 3 - 1
Makefile

@@ -96,7 +96,9 @@ lint-python:
 
 
 lint-js:
 lint-js:
 	@echo "--> Linting JavaScript files"
 	@echo "--> Linting JavaScript files"
-	@npm run lint || exit 1
+	@npm install
+	@jsxhint --jsx-only src
+	@jshint src
 	@echo ""
 	@echo ""
 
 
 coverage: develop
 coverage: develop

+ 4 - 1
hooks/pre-commit

@@ -31,7 +31,10 @@ def py_lint(files_modified):
 
 
 def js_lint(files_modified):
 def js_lint(files_modified):
     has_errors = False
     has_errors = False
-    if os.system('node_modules/.bin/jshint src/sentry'):
+    if os.system('node_modules/.bin/jshint src'):
+        has_errors = True
+
+    if os.system('node_modules/.bin/jsxhint --jsx-only src'):
         has_errors = True
         has_errors = True
 
 
     return has_errors
     return has_errors

+ 2 - 4
package.json

@@ -22,6 +22,7 @@
     "gulp-webpack": "^1.1.2",
     "gulp-webpack": "^1.1.2",
     "jquery": "^2.1.3",
     "jquery": "^2.1.3",
     "jshint": "~2.5.0",
     "jshint": "~2.5.0",
+    "jsx": "^0.9.89",
     "jsx-loader": "^0.12.2",
     "jsx-loader": "^0.12.2",
     "karma": "^0.12.19",
     "karma": "^0.12.19",
     "karma-chai": "^0.1.0",
     "karma-chai": "^0.1.0",
@@ -43,9 +44,6 @@
   "scripts": {
   "scripts": {
     "postinstall": "bower install",
     "postinstall": "bower install",
     "pretest": "npm install && npm run build_static",
     "pretest": "npm install && npm run build_static",
-    "test": "node_modules/karma/bin/karma start tests/karma.conf.js --single-run",
-    "build_static": "gulp dist",
-    "prelint": "npm install",
-    "lint": "jshint src/"
+    "test": "node_modules/karma/bin/karma start tests/karma.conf.js --single-run"
   }
   }
 }
 }