[gnome-code-assistance] [backends/js] Autodetect running of jshint



commit bed45891a71d760fdfc2b7125d008eae93a3998f
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sun Jan 11 11:44:35 2015 +0100

    [backends/js] Autodetect running of jshint

 backends/js/main.js |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/backends/js/main.js b/backends/js/main.js
index f30774a..0b1fe73 100644
--- a/backends/js/main.js
+++ b/backends/js/main.js
@@ -180,10 +180,12 @@ Service.prototype = {
     },
 
     _jshint: function(doc, contents, options) {
-        if (!options.jshint) {
+        if (options.jshint !== undefined && !options.jshint) {
             return;
         }
 
+        var enabled = !!options.jshint || !!contents.match(/(\/\/|\/\*)\s*jshint/g);
+
         // Setup jshint options
         let searchPaths = this._jshintrcSearchPaths(doc);
         let rcopts = {
@@ -199,12 +201,17 @@ Service.prototype = {
                 let opts = this._jshintOptions(rc);
 
                 if (opts) {
+                    enabled = true;
                     rcopts = opts;
                     break;
                 }
             }
         }
 
+        if (!enabled) {
+            return;
+        }
+
         if (JsHint(contents)) {
             return;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]