From 6ee771a4e2c7099f7a1663e8727b18df2a0d2024 Mon Sep 17 00:00:00 2001
From: Lennart Regebro <lregebro@redhat.com>
Date: Tue, 2 Dec 2014 14:27:07 +0100
Subject: [PATCH] Use the pluggable eslint instead of jshint

We likely have to write some plugins, or configure it better,
but that will be a different patch.

Change-Id: I71eb341af45dc529a3d84467d7252b3d64b1e56d
---
 run_tests.sh | 20 ++++++++++----------
 tox.ini      |  8 ++++----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index bca1b2f..0e43740 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -27,7 +27,7 @@ function usage {
   echo "  -p, --pep8               Just run pep8"
   echo "  -t, --tabs               Check for tab characters in files."
   echo "  -y, --pylint             Just run pylint"
-  echo "  -j, --jshint             Just run jshint"
+  echo "  -j, --jshint --eslint    Just run eslint"
   echo "  -q, --quiet              Run non-interactively. (Relatively) quiet."
   echo "                           Implies -V if -N is not set."
   echo "  --only-selenium          Run only the Selenium unit tests"
@@ -65,7 +65,7 @@ just_pep8=0
 just_pylint=0
 just_docs=0
 just_tabs=0
-just_jshint=0
+just_eslint=0
 never_venv=0
 quiet=0
 restore_env=0
@@ -98,7 +98,7 @@ function process_option {
     -N|--no-virtual-env) always_venv=0; never_venv=1;;
     -p|--pep8) just_pep8=1;;
     -y|--pylint) just_pylint=1;;
-    -j|--jshint) just_jshint=1;;
+    -j|--jshint|--eslint) just_eslint=1;;
     -f|--force) force=1;;
     -t|--tabs) just_tabs=1;;
     -q|--quiet) quiet=1;;
@@ -143,10 +143,10 @@ function run_pylint {
   fi
 }
 
-function run_jshint {
-  echo "Running jshint ..."
-  jshint tuskar_boxes
-  jshint tuskar_sat_ui
+function run_eslint {
+  echo "Running eslint ..."
+  eslint tuskar_boxes
+  eslint tuskar_sat_ui
 }
 
 function run_pep8 {
@@ -454,9 +454,9 @@ if [ $just_tabs -eq 1 ]; then
     exit $?
 fi
 
-# Jshint
-if [ $just_jshint -eq 1 ]; then
-    run_jshint
+# Linting JS
+if [ $just_eslint -eq 1 ]; then
+    run_eslint
     exit $?
 fi
 
diff --git a/tox.ini b/tox.ini
index 1101345..e52b2b9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py26,py27,py27dj14,py27dj15,py27dj16,pep8,selenium,jshint
+envlist = py26,py27,py27dj14,py27dj15,py27dj16,pep8,selenium,eslint
 
 [testenv]
 setenv = VIRTUAL_ENV={envdir}
@@ -39,10 +39,10 @@ commands = pip install django>=1.6,<1.7
 [testenv:selenium]
 commands = /bin/bash run_tests.sh -N --only-selenium
 
-[testenv:jshint]
+[testenv:eslint]
 commands = nodeenv -p
-           npm install jshint -g
-           /bin/bash run_tests.sh -N --jshint
+           npm install eslint -g
+           /bin/bash run_tests.sh -N --eslint
 
 [tox:jenkins]
 downloadcache = ~/cache/pip