From 46d5d1dccb7156f5d4ce51b9279826db7293edbc Mon Sep 17 00:00:00 2001 From: Tom Robinson <tlrobinson@gmail.com> Date: Tue, 9 Jun 2015 11:09:49 -0700 Subject: [PATCH] Linting fixes/workarounds (we should switch to ESLint) --- lint_js.sh | 4 ++-- resources/frontend_client/app/card/card.charting.js | 11 +++++++++-- resources/frontend_client/app/card/card.directives.js | 6 +----- .../app/query_builder/gui_query_editor.react.js | 5 ++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lint_js.sh b/lint_js.sh index 6edd4946495..a9ec8aa9511 100755 --- a/lint_js.sh +++ b/lint_js.sh @@ -3,8 +3,8 @@ # Simple shell script for running jshint and nicely formatting the output :heart_eyes_cat: JS_HINT=./node_modules/jsxhint/cli.js -JS_HINT_OPTS='--babel --es6module --config .jshintrc' -JS_FILES=`find resources/frontend_client/app -name "*.js" | grep -v 'app/test/' | grep -v '\#' | grep -v 'app/dist/'` +JS_HINT_OPTS='--babel --es6module --verbose --config .jshintrc' +JS_FILES=`find resources/frontend_client/app -name "*.js" | grep -v bower_components | grep -v 'app/test/' | grep -v '\#' | grep -v 'app/dist/'` BOLD='\033[1;30m' RED='\033[0;31m' # \e doesn't work on OS X but \033 works on either diff --git a/resources/frontend_client/app/card/card.charting.js b/resources/frontend_client/app/card/card.charting.js index 0ac34fae196..07660327c15 100644 --- a/resources/frontend_client/app/card/card.charting.js +++ b/resources/frontend_client/app/card/card.charting.js @@ -2,11 +2,18 @@ /*jslint browser:true */ /*global document,_,google,console,vs*/ -import $ from 'jquery'; import d3 from 'd3'; -import crossfilter from 'crossfilter'; import dc from 'dc'; +// JSXHint workarounds: https://github.com/STRML/JSXHint/issues/69 +import _$ from 'jquery'; +var $ = _$; +import _crossfilter from 'crossfilter'; +var crossfilter = _crossfilter; + +// var crossfilter = require('crossfilter'); +// var $ = require('jquery'); + // ---------------------------------------- TODO - Maybe. Lots of these things never worked in the first place. ---------------------------------------- // IMPORTANT // - 'titles' (tooltips) diff --git a/resources/frontend_client/app/card/card.directives.js b/resources/frontend_client/app/card/card.directives.js index 8b13c1b743b..aebb5dfd763 100644 --- a/resources/frontend_client/app/card/card.directives.js +++ b/resources/frontend_client/app/card/card.directives.js @@ -1,8 +1,6 @@ 'use strict'; /*global setTimeout, React */ -import $ from 'jquery'; - import { CardRenderer } from './card.charting'; var CardDirectives = angular.module('corvus.card.directives', []); @@ -456,9 +454,7 @@ CardDirectives.directive('cvLatlongHeatmap', ['CardRenderer', function(CardRende scope.$watch('cvLatlongHeatmap', function(value) { if (value) { - $(function() { - CardRenderer.latlongHeatmap('map-canvas', 'whatever', value); - }); + CardRenderer.latlongHeatmap('map-canvas', 'whatever', value); } }); } diff --git a/resources/frontend_client/app/query_builder/gui_query_editor.react.js b/resources/frontend_client/app/query_builder/gui_query_editor.react.js index d6877ad6be6..861da034cb0 100644 --- a/resources/frontend_client/app/query_builder/gui_query_editor.react.js +++ b/resources/frontend_client/app/query_builder/gui_query_editor.react.js @@ -121,11 +121,10 @@ export default React.createClass({ }, canRun: function() { - var canRun = false; if (this.hasValidAggregation()) { - canRun = true; + return true; } - return canRun; + return false; }, runQuery: function() { -- GitLab