Skip to content

Commit

Permalink
rockstor#1623 Init commit with eslint and gulp
Browse files Browse the repository at this point in the history
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
  • Loading branch information
MFlyer committed Feb 13, 2017
1 parent 1bec304 commit 5f4e739
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
test/*
conf/*
src/rockstor/fs/*
src/rockstor/cli/*
src/rockstor/templates/*
src/rockstor/rest_framework_custom/*
src/rockstor/system/*
src/rockstor/scripts/*
77 changes: 77 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright (c) 2012-2017 RockStor, Inc. <http://rockstor.com>
* This file is part of RockStor.
*
* RockStor is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* RockStor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
*
*/


module.exports = {
'env': {
'browser': true,
'jquery': true,
'es6': true
},
'extends': 'eslint:recommended',
'rules': {
'strict': 'off',
'no-unused-vars': 'off',
'no-undef': 'off',
'indent': [
'error',
4
],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
],
'no-console': [
'error',
{
'allow': [
'log'
]
}
]
},
'globals': {
// Rockstor jslibs dependencies
'Backbone': false,
'Handlebars': false,
'_': false,
'd3': false,
'humanize': false,
'io': false,
'moment': false,
'Chart': false,
'options': true
}
};
63 changes: 63 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright (c) 2012-2017 RockStor, Inc. <http://rockstor.com>
* This file is part of RockStor.
*
* RockStor is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* RockStor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
*
*/

var gulp = require('gulp');
var eslint = require('gulp-eslint');


gulp.task('lint', lintJob);
gulp.task('default', ['lint']);

function lintJob() {

var jssrc = 'src/rockstor/storageadmin/static/storageadmin/js/';
var jsfiles = [
'license.js',
'socket_listen.js',
'rockstor.js',
'rockstor_widgets.js',
'rockstor_logger.js',
'paginated_collection.js',
'router.js',
'graph.js',
'd3.slider2.js',
'models/models.js',
'views/common/*.js',
'views/*.js',
'views/pool/**/*.js',
'views/dashboard/*.js'
];
jsfiles = jsfiles.map(function(element) {
return jssrc + element
});


return gulp.src(jsfiles)
.pipe(eslint('./.eslintrc.js'))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}

0 comments on commit 5f4e739

Please sign in to comment.