diff --git a/.eslintignore b/.eslintignore index 7c384b23a..989e613fb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,8 @@ /js/tests/* /js/vendor/* /js/node_modules/* +/js/public/* /karma.conf.js /tests/* /l10n/* + diff --git a/js/Gruntfile.js b/js/Gruntfile.js index 1d7956ebd..bb9034ef0 100644 --- a/js/Gruntfile.js +++ b/js/Gruntfile.js @@ -20,6 +20,7 @@ * */ +/* global module */ module.exports = function(grunt) { 'use strict'; diff --git a/js/controller/BoardController.js b/js/controller/BoardController.js index d49f973c6..181008578 100644 --- a/js/controller/BoardController.js +++ b/js/controller/BoardController.js @@ -48,9 +48,9 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St StackService.clear(); //FIXME: Is this still needed? $scope.$watch(function () { - return BoardService.getCurrent().title; - }, function() { - $scope.setPageTitle(); + return BoardService.getCurrent().title; + }, function () { + $scope.setPageTitle(); }); $scope.setPageTitle = function () { @@ -100,8 +100,9 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St // filter cards here, as ng-sortable will not work nicely with html-inline filters $scope.filterData = function (order, text) { - if ($scope.stacks === undefined) - {return;} + if ($scope.stacks === undefined) { + return; + } angular.copy(StackService.getData(), $scope.stacks); $scope.stacks = $filter('orderBy')($scope.stacks, 'order'); angular.forEach($scope.stacks, function (value, key) { diff --git a/js/filters/orderObjectBy.js b/js/filters/orderObjectBy.js index 4aee41067..a6ebee97e 100644 --- a/js/filters/orderObjectBy.js +++ b/js/filters/orderObjectBy.js @@ -22,10 +22,14 @@ app.filter('orderObjectBy', function(){ return function(input, attribute) { - if (!angular.isObject(input)) {return input;} + if (!angular.isObject(input)) { + return input; + } var array = []; for(var objectKey in input) { - array.push(input[objectKey]); + if ({}.hasOwnProperty.call(input, objectKey)) { + array.push(input[objectKey]); + } } array.sort(function(a, b){ diff --git a/js/filters/textColorFilter.js b/js/filters/textColorFilter.js index 2d7c77c5a..5fb6e5715 100644 --- a/js/filters/textColorFilter.js +++ b/js/filters/textColorFilter.js @@ -37,7 +37,7 @@ app.filter('textColorFilter', function () { var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, l = (max + min) / 2; - if (max == min) { + if (max === min) { h = s = 0; // achromatic } else { var d = max - min; diff --git a/js/service/CardService.js b/js/service/CardService.js index b09bb3845..64997ba9f 100644 --- a/js/service/CardService.js +++ b/js/service/CardService.js @@ -132,6 +132,6 @@ app.factory('CardService', function (ApiService, $http, $q) { return deferred.promise; }; - service = new CardService($http, 'cards', $q); + var service = new CardService($http, 'cards', $q); return service; }); \ No newline at end of file diff --git a/js/service/StackService.js b/js/service/StackService.js index 32bc3a4f3..daf2f3c5c 100644 --- a/js/service/StackService.js +++ b/js/service/StackService.js @@ -103,7 +103,7 @@ app.factory('StackService', function (ApiService, $http, $q) { var self = this; var cards = this.data[entity.stackId].cards; for (var i = 0; i < cards.length; i++) { - if (cards[i].id == entity.id) { + if (cards[i].id === entity.id) { cards[i] = entity; } } @@ -112,13 +112,13 @@ app.factory('StackService', function (ApiService, $http, $q) { var self = this; var cards = this.data[entity.stackId].cards; for (var i = 0; i < cards.length; i++) { - if (cards[i].id == entity.id) { + if (cards[i].id === entity.id) { cards.splice(i, 1); } } }; - service = new StackService($http, 'stacks', $q); + var service = new StackService($http, 'stacks', $q); return service; }); diff --git a/run-eslint.sh b/run-eslint.sh index aec72454c..25804a1ba 100755 --- a/run-eslint.sh +++ b/run-eslint.sh @@ -12,4 +12,5 @@ find -name "*.js" -not -path '*js/node_modules*' \ -not -path '*l10n/*' \ -not -path '*js/vendor*' \ -not -path '*js/tests*' \ - -print0 | xargs -0 $ESLINT --quiet + -not -path '*js/public*' \ + -print0 | xargs -0 $ESLINT