mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Merge pull request #5017 from spalger/chore/eslintMocha
[eslint] update and add mocha plugin
This commit is contained in:
commit
145464138f
6 changed files with 70 additions and 41 deletions
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
parser: babel-eslint
|
||||
|
||||
plugins:
|
||||
- mocha
|
||||
|
||||
env:
|
||||
es6: true
|
||||
amd: true
|
||||
|
@ -67,3 +70,6 @@ rules:
|
|||
valid-typeof: 2
|
||||
wrap-iife: [ 2, outside ]
|
||||
yoda: 0
|
||||
|
||||
mocha/no-exclusive-tests: 2
|
||||
mocha/handle-done-callback: 2
|
||||
|
|
11
package.json
11
package.json
|
@ -43,7 +43,9 @@
|
|||
"start": "./bin/kibana --dev",
|
||||
"precommit": "grunt lintStagedFiles",
|
||||
"karma": "karma start",
|
||||
"elasticsearch": "grunt esvm:dev:keepalive"
|
||||
"elasticsearch": "grunt esvm:dev:keepalive",
|
||||
"lint": "grunt eslint:source",
|
||||
"lintroller": "grunt eslint:fixSource"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -122,11 +124,13 @@
|
|||
"zeroclipboard": "2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"Nonsense": "0.1.2",
|
||||
"angular-mocks": "1.2.28",
|
||||
"auto-release-sinon": "1.0.3",
|
||||
"babel-eslint": "4.1.1",
|
||||
"babel-eslint": "4.1.3",
|
||||
"chokidar": "1.0.5",
|
||||
"eslint": "1.3.1",
|
||||
"eslint": "1.5.1",
|
||||
"eslint-plugin-mocha": "1.0.0",
|
||||
"expect.js": "0.3.1",
|
||||
"faker": "1.1.0",
|
||||
"glob": "4.5.3",
|
||||
|
@ -158,7 +162,6 @@
|
|||
"marked-text-renderer": "0.1.0",
|
||||
"mocha": "2.3.0",
|
||||
"nock": "2.10.0",
|
||||
"Nonsense": "0.1.2",
|
||||
"npm": "2.11.0",
|
||||
"portscanner": "1.0.0",
|
||||
"simple-git": "1.8.0",
|
||||
|
|
|
@ -5,11 +5,11 @@ define(function (require) {
|
|||
require('ui/modules')
|
||||
.get('kibana')
|
||||
.filter('moment', function (config) {
|
||||
return function (datetime) {
|
||||
var format = config.get('dateFormat');
|
||||
if (moment.isMoment(datetime)) return datetime.format(format);
|
||||
if (_.isDate(datetime)) return moment(datetime).format(format);
|
||||
return datetime;
|
||||
};
|
||||
});
|
||||
return function (datetime) {
|
||||
var format = config.get('dateFormat');
|
||||
if (moment.isMoment(datetime)) return datetime.format(format);
|
||||
if (_.isDate(datetime)) return moment(datetime).format(format);
|
||||
return datetime;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,14 +4,14 @@ define(function (require) {
|
|||
var diff = Private(require('ui/utils/diff_time_picker_vals'));
|
||||
|
||||
return function (self) {
|
||||
var oldTime = _.clone(self.time);
|
||||
return function () {
|
||||
if (diff(self.time, oldTime)) {
|
||||
self.emit('update');
|
||||
self.emit('fetch');
|
||||
}
|
||||
oldTime = _.clone(self.time);
|
||||
};
|
||||
var oldTime = _.clone(self.time);
|
||||
return function () {
|
||||
if (diff(self.time, oldTime)) {
|
||||
self.emit('update');
|
||||
self.emit('fetch');
|
||||
}
|
||||
oldTime = _.clone(self.time);
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -63,34 +63,36 @@ describe('Vislib Color Module Test Suite', function () {
|
|||
}).to.throwError();
|
||||
});
|
||||
|
||||
it('should throw an error if array is not composed of numbers, strings, or ' +
|
||||
'undefined values', function () {
|
||||
expect(function () {
|
||||
getColors(arrayOfObjects);
|
||||
}).to.throwError();
|
||||
context('when array is not composed of numbers, strings, or undefined values', function () {
|
||||
it('should throw an error', function () {
|
||||
expect(function () {
|
||||
getColors(arrayOfObjects);
|
||||
}).to.throwError();
|
||||
|
||||
expect(function () {
|
||||
getColors(arrayOfBooleans);
|
||||
}).to.throwError();
|
||||
expect(function () {
|
||||
getColors(arrayOfBooleans);
|
||||
}).to.throwError();
|
||||
|
||||
expect(function () {
|
||||
getColors(arrayOfNullValues);
|
||||
}).to.throwError();
|
||||
expect(function () {
|
||||
getColors(arrayOfNullValues);
|
||||
}).to.throwError();
|
||||
});
|
||||
});
|
||||
|
||||
it('should not throw an error if input is an array of strings, numbers, or' +
|
||||
' undefined values', function () {
|
||||
expect(function () {
|
||||
getColors(arr);
|
||||
}).to.not.throwError();
|
||||
context('when input is an array of strings, numbers, or undefined values', function () {
|
||||
it('should not throw an error', function () {
|
||||
expect(function () {
|
||||
getColors(arr);
|
||||
}).to.not.throwError();
|
||||
|
||||
expect(function () {
|
||||
getColors(arrayOfNumbers);
|
||||
}).to.not.throwError();
|
||||
expect(function () {
|
||||
getColors(arrayOfNumbers);
|
||||
}).to.not.throwError();
|
||||
|
||||
expect(function () {
|
||||
getColors(arrayOfUndefinedValues);
|
||||
}).to.not.throwError();
|
||||
expect(function () {
|
||||
getColors(arrayOfUndefinedValues);
|
||||
}).to.not.throwError();
|
||||
});
|
||||
});
|
||||
|
||||
it('should be a function', function () {
|
||||
|
|
|
@ -1,7 +1,25 @@
|
|||
var resolve = require('path').resolve;
|
||||
|
||||
module.exports = function (grunt) {
|
||||
return {
|
||||
// just lint the source dir
|
||||
source: {
|
||||
options: {
|
||||
cache: resolve(grunt.config.get('root'), '.eslint.fixSource.cache')
|
||||
},
|
||||
|
||||
files: {
|
||||
src: '<%= lintThese %>'
|
||||
}
|
||||
},
|
||||
|
||||
// lint the source and fix any fixable errors
|
||||
fixSource: {
|
||||
options: {
|
||||
cache: resolve(grunt.config.get('root'), '.eslint.fixSource.cache'),
|
||||
fix: true
|
||||
},
|
||||
|
||||
files: {
|
||||
src: '<%= lintThese %>'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue