Switch to eslint.
This ports over changes made in openstack-health to convert the project from jshint to eslint, with the eslint-config-openstack plugin. Change-Id: Iaa0490d07603e2481e1c738136f9fda1be95dea8
This commit is contained in:
parent
42b83c81da
commit
7eab971d3f
8
.eslintignore
Normal file
8
.eslintignore
Normal file
@ -0,0 +1,8 @@
|
||||
cover
|
||||
build
|
||||
node_modules
|
||||
coverage
|
||||
doc
|
||||
app/vendor-js
|
||||
app/js/templates.js
|
||||
gulp
|
14
.eslintrc
Normal file
14
.eslintrc
Normal file
@ -0,0 +1,14 @@
|
||||
# Use eslint-config-openstack
|
||||
extends: openstack
|
||||
|
||||
# Set up globals
|
||||
globals:
|
||||
angular: false
|
||||
module: false
|
||||
|
||||
env:
|
||||
browser: true
|
||||
jasmine: true
|
||||
|
||||
rules:
|
||||
module-setter: 0
|
20
.jshintrc
20
.jshintrc
@ -1,20 +0,0 @@
|
||||
{
|
||||
"node": true,
|
||||
"jasmine": true,
|
||||
"browser": true,
|
||||
"esnext": true,
|
||||
"bitwise": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"indent": 2,
|
||||
"latedef": true,
|
||||
"noarg": true,
|
||||
"regexp": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
"smarttabs": true,
|
||||
"newcap": false
|
||||
}
|
7
app/.eslintrc
Normal file
7
app/.eslintrc
Normal file
@ -0,0 +1,7 @@
|
||||
# Enable eslint-plugin-angular
|
||||
plugins:
|
||||
- angular
|
||||
|
||||
rules:
|
||||
angular/module-setter: 0
|
||||
angular/module-getter: 0
|
@ -96,7 +96,7 @@ var getDstatLanes = function(data, mins, maxes) {
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
function timeline(datasetService) {
|
||||
function timeline($log, datasetService) {
|
||||
var link = function(scope, el, attrs) {
|
||||
var data = [];
|
||||
var dstat = {};
|
||||
@ -578,7 +578,7 @@ function timeline(datasetService) {
|
||||
// (dstat may not exist, but that's okay)
|
||||
initData(raw, dstat);
|
||||
}).catch(function(ex) {
|
||||
console.error(ex);
|
||||
$log.error(ex);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -12,8 +12,6 @@ require('./services/_index');
|
||||
require('./directives/_index');
|
||||
require('./filters/_index');
|
||||
|
||||
var bootstrap = function() {
|
||||
|
||||
var requires = [
|
||||
'ui.router',
|
||||
'ui.bootstrap',
|
||||
@ -25,20 +23,14 @@ var bootstrap = function() {
|
||||
'picardy.fontawesome'
|
||||
];
|
||||
|
||||
// mount on window for testing
|
||||
window.app = angular.module('app', requires);
|
||||
angular.module('app', requires);
|
||||
|
||||
angular.module('app').constant('AppSettings', require('./constants'));
|
||||
|
||||
angular.module('app').config(require('./on_config'));
|
||||
var onConfig = require('./on_config');
|
||||
angular.module('app').config(onConfig);
|
||||
|
||||
var onRun = require('./on_run');
|
||||
angular.module('app').run(require('./on_run'));
|
||||
|
||||
angular.bootstrap(document, ['app']);
|
||||
|
||||
window.bootstrap = null;
|
||||
};
|
||||
|
||||
// create and bootstrap application
|
||||
angular.element(document).ready(bootstrap);
|
||||
window.bootstrap = bootstrap;
|
||||
|
@ -6,7 +6,7 @@
|
||||
function OnRun($rootScope, AppSettings) {
|
||||
|
||||
// change page title based on state
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
||||
var disable = $rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
||||
$rootScope.pageTitle = '';
|
||||
|
||||
if (toState.title) {
|
||||
@ -17,6 +17,8 @@ function OnRun($rootScope, AppSettings) {
|
||||
$rootScope.pageTitle += AppSettings.appTitle;
|
||||
});
|
||||
|
||||
$rootScope.$on('$destroy', disable);
|
||||
|
||||
}
|
||||
|
||||
module.exports = OnRun;
|
@ -1,11 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../config');
|
||||
var gulp = require('gulp');
|
||||
var jshint = require('gulp-jshint');
|
||||
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src([config.scripts.src, '!app/js/templates.js'])
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter('jshint-stylish'));
|
||||
});
|
@ -6,7 +6,6 @@ var gulp = require('gulp');
|
||||
gulp.task('watch', ['browserSync', 'server'], function() {
|
||||
|
||||
// Scripts are automatically watched and rebundled by Watchify inside Browserify task
|
||||
gulp.watch(config.scripts.src, ['lint']);
|
||||
gulp.watch(config.styles.src, ['styles']);
|
||||
gulp.watch(config.images.src, ['images']);
|
||||
gulp.watch(config.fonts.src, ['fonts']);
|
||||
|
@ -23,8 +23,9 @@
|
||||
"d3": "^3.5.6",
|
||||
"debowerify": "^1.2.0",
|
||||
"del": "^0.1.3",
|
||||
"eslint": "^0.23.0",
|
||||
"eslint-config-openstack": "1.2.0",
|
||||
"eslint": "1.5.1",
|
||||
"eslint-config-openstack": "1.2.2",
|
||||
"eslint-plugin-angular": "0.12.0",
|
||||
"express": "^4.7.2",
|
||||
"gulp": "^3.8.8",
|
||||
"gulp-angular-templatecache": "^1.3.0",
|
||||
@ -34,7 +35,6 @@
|
||||
"gulp-gzip": "^0.0.8",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-imagemin": "^1.1.0",
|
||||
"gulp-jshint": "^1.8.3",
|
||||
"gulp-karma": "0.0.4",
|
||||
"gulp-notify": "^2.0.0",
|
||||
"gulp-protractor": "0.0.11",
|
||||
@ -49,7 +49,6 @@
|
||||
"jasmine-ajax": "^3.1.1",
|
||||
"jasmine-core": "^2.3.4",
|
||||
"jasmine-fixture": "^1.3.2",
|
||||
"jshint-stylish": "^1.0.0",
|
||||
"karma": "~0.12.0",
|
||||
"karma-babel-preprocessor": "^4.0.1",
|
||||
"karma-browserify": "^4.0.0",
|
||||
@ -71,7 +70,7 @@
|
||||
"scripts": {
|
||||
"postinstall": "if [ ! -d .venv ]; then tox -epy27 --notest; fi",
|
||||
"test": "gulp unit",
|
||||
"lint": "eslint --no-color stackviz/static"
|
||||
"lint": "eslint ./"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
window.bootstrap && window.bootstrap();
|
||||
|
||||
describe('Unit: HomeCtrl', function() {
|
||||
|
||||
var ctrl;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
window.bootstrap && window.bootstrap();
|
||||
|
||||
describe('Unit: DatasetService', function() {
|
||||
|
||||
var service, httpBackend;
|
||||
|
Loading…
x
Reference in New Issue
Block a user