Replace JsHint by Eslint

This commit is contained in:
Damien CORNEAU 2016-07-19 18:40:00 +09:00
parent 4e6c7990cc
commit 7b1da053cc
8 changed files with 56 additions and 37 deletions

36
zeppelin-web/.eslintrc Normal file
View file

@ -0,0 +1,36 @@
{
"env": {
"browser": true,
"jasmine": true,
"node": true
},
"globals": {
"angular": false,
"_": false,
"jQuery": false,
"hljs": false,
"confirm": false,
"alert": false,
"nv": false,
"ace": false,
"d3": false,
"BootstrapDialog": false,
"Handsontable": false,
"moment": false
},
"rules": {
"no-bitwise": 2,
"camelcase": 2,
"curly": 2,
"eqeqeq": 2,
"wrap-iife": [2, "any"],
"no-use-before-define": 0,
"new-cap": 2,
"no-caller": 2,
"quotes": [2, "single"],
"no-shadow": 0,
"no-undef": 2,
"no-unused-vars": [2, { "vars": "local", "args": "none" }],
"strict": [2, "global"]
}
}

View file

@ -127,7 +127,7 @@ module.exports = function(grunt) {
'<%= yeoman.app %>/app/**/*.js',
'<%= yeoman.app %>/components/**/*.js'
],
tasks: ['newer:jshint:all', 'newer:jscs:all'],
tasks: ['newer:eslint:all', 'newer:jscs:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
@ -140,7 +140,7 @@ module.exports = function(grunt) {
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
tasks: ['newer:eslint:test', 'newer:jscs:test', 'karma']
},
styles: {
files: [
@ -234,13 +234,7 @@ module.exports = function(grunt) {
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporterOutput: '',
reporter: require('jshint-stylish')
},
eslint: {
all: {
src: [
'Gruntfile.js',
@ -249,9 +243,6 @@ module.exports = function(grunt) {
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
@ -524,7 +515,7 @@ module.exports = function(grunt) {
grunt.registerTask('build', [
'jscs',
'jshint:all',
'eslint',
'htmlhint',
'clean:dist',
'wiredep',

View file

@ -18,12 +18,13 @@
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.9.0",
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-eslint": "^18.1.0",
"grunt-filerev": "^0.2.1",
"grunt-goog-webfont-dl": "^0.1.2",
"grunt-htmlhint": "^0.9.13",
"grunt-jscs": "^2.1.0",
"grunt-karma": "~0.8.3",
"grunt-newer": "^0.7.0",
"grunt-ng-annotate": "^0.10.0",
@ -31,8 +32,6 @@
"grunt-svgmin": "^0.4.0",
"grunt-usemin": "^2.1.1",
"grunt-wiredep": "~2.0.0",
"grunt-jscs": "^2.1.0",
"jshint-stylish": "^0.2.0",
"karma": "~0.12.23",
"karma-coverage": "^0.5.1",
"karma-jasmine": "~0.1.5",

View file

@ -17,7 +17,7 @@
angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $route, $routeParams, $location,
$rootScope, $http, websocketMsgSrv,
baseUrlSrv, $timeout, SaveAsService) {
baseUrlSrv, $timeout, saveAsService) {
$scope.note = null;
$scope.showEditor = false;
$scope.editorToggled = false;
@ -142,7 +142,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
//Export notebook
$scope.exportNotebook = function() {
var jsonContent = JSON.stringify($scope.note);
SaveAsService.SaveAs(jsonContent, $scope.note.name, 'json');
saveAsService.saveAs(jsonContent, $scope.note.name, 'json');
};
//Clone note

View file

@ -17,7 +17,7 @@
angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $rootScope, $route, $window,
$routeParams, $location, $timeout, $compile,
$http, websocketMsgSrv, baseUrlSrv, ngToast,
SaveAsService) {
saveAsService) {
var ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_';
$scope.parentNote = null;
$scope.paragraph = null;
@ -774,10 +774,6 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
bodyEl.scrollTo(scrollTargetPos, {axis: 'y', interrupt: true, duration: 100});
};
var setEditorHeight = function(id, height) {
angular.element('#' + id).height(height.toString() + 'px');
};
$scope.getEditorValue = function() {
return $scope.editor.getValue();
};
@ -1101,12 +1097,12 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
} catch (ignoreErr) {
}
var chartEl = d3.select('#p' + $scope.paragraph.id + '_' + type + ' svg')
.attr('height', $scope.paragraph.config.graph.height)
.datum(d3g)
.transition()
.duration(animationDuration)
.call($scope.chart[type]);
d3.select('#p' + $scope.paragraph.id + '_' + type + ' svg')
.attr('height', $scope.paragraph.config.graph.height)
.datum(d3g)
.transition()
.duration(animationDuration)
.call($scope.chart[type]);
d3.select('#p' + $scope.paragraph.id + '_' + type + ' svg').style.height = height + 'px';
nv.utils.windowResize($scope.chart[type].update);
};
@ -1313,7 +1309,6 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
for (var i = 0; i < data.rows.length; i++) {
var row = data.rows[i];
var newRow = {};
var s = schema;
var p = rows;
@ -1845,7 +1840,6 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
};
$scope.exportToDSV = function(delimiter) {
var data = $scope.paragraph.result;
var dsv = '';
for (var titleIndex in $scope.paragraph.result.columnNames) {
dsv += $scope.paragraph.result.columnNames[titleIndex].name + delimiter;
@ -1865,7 +1859,7 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
} else if (delimiter === ',') {
extension = 'csv';
}
SaveAsService.SaveAs(dsv, 'data', extension);
saveAsService.saveAs(dsv, 'data', extension);
};
// Helium ---------------------------------------------
@ -1877,7 +1871,6 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
$scope.suggestion = {};
$scope.switchApp = function(appId) {
var app = _.find($scope.apps, {id: appId});
var config = $scope.paragraph.config;
var settings = $scope.paragraph.settings;

View file

@ -13,9 +13,9 @@
*/
'use strict';
angular.module('zeppelinWebApp').service('SaveAsService', function(browserDetectService) {
angular.module('zeppelinWebApp').service('saveAsService', function(browserDetectService) {
this.SaveAs = function(content, filename, extension) {
this.saveAs = function(content, filename, extension) {
var BOM = '\uFEFF';
if (browserDetectService.detectIE()) {
angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>');

View file

@ -135,7 +135,7 @@ limitations under the License.
<script src="bower_components/angular-xeditable/dist/js/xeditable.js"></script>
<script src="bower_components/highlightjs/highlight.pack.js"></script>
<script src="bower_components/lodash/lodash.js"></script>
<script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
<script src="bower_components/angular-filter/dist/angular-filter.js"></script>
<script src="bower_components/ngtoast/dist/ngToast.js"></script>
<script src="bower_components/ng-focus-if/focusIf.js"></script>
<script src="bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js"></script>

View file

@ -55,7 +55,7 @@ module.exports = function(config) {
'bower_components/angular-xeditable/dist/js/xeditable.js',
'bower_components/highlightjs/highlight.pack.js',
'bower_components/lodash/lodash.js',
'bower_components/angular-filter/dist/angular-filter.min.js',
'bower_components/angular-filter/dist/angular-filter.js',
'bower_components/ngtoast/dist/ngToast.js',
'bower_components/ng-focus-if/focusIf.js',
'bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js',