From 1f23424ba8a624f3d5770de385aca96b8503b36d Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 26 Sep 2018 13:51:16 -0400
Subject: [PATCH] Improve Javascript style checking configuration. - Add jshint
 support - Improve name of eslint output file for use by Jenkins

---
 .travis.yml       |  3 ++-
 build.xml         | 11 ++++++++++-
 tests/jshint.json |  4 ++++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 tests/jshint.json

diff --git a/.travis.yml b/.travis.yml
index 9284368abf2..d990cf83447 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,7 @@ before_script:
   - phpenv rehash
   - composer install
   - npm install -g eslint@"<5.0.0"
+  - npm install -g jshint@"2.9.6"
 
 cache:
   directories:
@@ -21,4 +22,4 @@ cache:
     - $HOME/.composer/cache/files
 
 script:
-  - vendor/bin/phing eslint phpunitfast phpcs-console php-cs-fixer-dryrun
+  - vendor/bin/phing eslint jshint phpunitfast phpcs-console php-cs-fixer-dryrun
diff --git a/build.xml b/build.xml
index d389674afa4..824bd2fc9fb 100644
--- a/build.xml
+++ b/build.xml
@@ -67,6 +67,7 @@
     <phingcall target="pdepend"/>
     <phingcall target="phploc"/>
     <phingcall target="eslint-report"/>
+    <phingcall target="jshint-report"/>
   </target>
 
   <!-- Report rule violations with PHPMD (mess detector) -->
@@ -118,7 +119,15 @@
     <exec command="eslint -c ${srcdir}/.eslintrc.js ${srcdir}/themes/bootstrap3/js/*.js --fix" escape="false" passthru="true" />
   </target>
   <target name="eslint-report">
-    <exec command="eslint -c ${srcdir}/.eslintrc.js ${srcdir}/themes/bootstrap3/js/*.js --format checkstyle -o ${builddir}/reports/eslint.xml" escape="false" />
+    <exec command="eslint -c ${srcdir}/.eslintrc.js ${srcdir}/themes/bootstrap3/js/*.js --format checkstyle -o ${builddir}/reports/eslint-checkstyle.xml" escape="false" />
+  </target>
+
+  <!-- JSHint -->
+  <target name="jshint">
+    <exec command="jshint --config=${srcdir}/tests/jshint.json --exclude=themes/*/js/vendor ${srcdir}/themes" checkreturn="true" passthru="true" />
+  </target>
+  <target name="jshint-report">
+    <exec command="jshint --config=${srcdir}/tests/jshint.json --exclude=themes/*/js/vendor --reporter=checkstyle ${srcdir}/themes &gt; ${builddir}/reports/jshint-checkstyle.xml" />
   </target>
 
   <!-- PHP API Documentation -->
diff --git a/tests/jshint.json b/tests/jshint.json
new file mode 100644
index 00000000000..ebcf84e417e
--- /dev/null
+++ b/tests/jshint.json
@@ -0,0 +1,4 @@
+{
+  "latedef": true,
+  "laxbreak": true
+}
-- 
GitLab