[eslint-config-kibana] Apply AirBnB spacing rules (#14522)

* Add AirBnB key-spacing rule.
* Add AirBnB comma-spacing rule.
This commit is contained in:
CJ Cenizal 2017-10-25 15:08:05 -07:00 committed by GitHub
parent 417a650cb3
commit 05cbb92965
127 changed files with 367 additions and 366 deletions

View file

@ -213,7 +213,7 @@
"yauzl": "2.7.0"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "0.12.0",
"@elastic/eslint-config-kibana": "0.13.0",
"@elastic/eslint-import-resolver-kibana": "0.8.1",
"@elastic/eslint-plugin-kibana-custom": "1.0.3",
"angular-mocks": "1.4.7",

View file

@ -26,6 +26,7 @@ module.exports = {
'block-scoped-var': 'error',
camelcase: [ 'error', { properties: 'never' } ],
'comma-dangle': 'off',
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': [ 'error', 'last' ],
'consistent-return': 'off',
curly: [ 'error', 'multi-line' ],
@ -34,7 +35,7 @@ module.exports = {
eqeqeq: [ 'error', 'allow-null' ],
'guard-for-in': 'error',
indent: [ 'error', 2, { SwitchCase: 1 } ],
'key-spacing': [ 'off', { align: 'value' } ],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'max-len': [ 'error', 140, 2, { ignoreComments: true, ignoreUrls: true } ],
'new-cap': [ 'error', { capIsNewExceptions: [ 'Private' ] } ],
'no-bitwise': 'off',

View file

@ -1,6 +1,6 @@
{
"name": "@elastic/eslint-config-kibana",
"version": "0.12.0",
"version": "0.13.0",
"description": "The eslint config used by the kibana team",
"main": ".eslintrc.js",
"scripts": {

View file

@ -169,7 +169,7 @@ export default function (api) {
});
api.addEndpointDescription('_get_index_settings', {
methods: ['GET',],
methods: ['GET', ],
patterns: [
"{indices}/_settings",
],
@ -179,7 +179,7 @@ export default function (api) {
});
api.addEndpointDescription('_get_index', {
methods: ['GET',],
methods: ['GET', ],
patterns: [
"{indices}",
"{indices}/{feature}"

View file

@ -16,48 +16,48 @@ export function ScriptHighlightRules() {
regex: "\\/\\/.*$"
},
{
token : "script.string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
token: "script.string.regexp",
regex: "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
},
{
token : "script.string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
token: "script.string", // single line
regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
},
{
token : "script.constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
token: "script.constant.numeric", // hex
regex: "0[xX][0-9a-fA-F]+\\b"
},
{
token : "script.constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
token: "script.constant.numeric", // float
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
},
{
token : "script.constant.language.boolean",
regex : "(?:true|false)\\b"
token: "script.constant.language.boolean",
regex: "(?:true|false)\\b"
},
{
token: "script.keyword",
regex: painlessKeywords
},
{
token : "script.text",
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
token: "script.text",
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
},
{
token : "script.keyword.operator",
regex : "\\?\\.|\\*\\.|=~|==~|!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|->|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|typeof|void)"
token: "script.keyword.operator",
regex: "\\?\\.|\\*\\.|=~|==~|!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|->|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|typeof|void)"
},
{
token : "script.lparen",
regex : "[[({]"
token: "script.lparen",
regex: "[[({]"
},
{
token : "script.rparen",
regex : "[\\])}]"
token: "script.rparen",
regex: "[\\])}]"
},
{
token : "script.text",
regex : "\\s+"
token: "script.text",
regex: "\\s+"
}
]
}

View file

@ -210,7 +210,7 @@ define('ace/lib/oop', ['require', 'exports', 'module' ], function (require, expo
};
});
define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function (require, exports) {
define('ace/worker/mirror', ['require', 'exports', 'module', 'ace/document', 'ace/lib/lang'], function (require, exports) {
"use strict";
var Document = require("../document").Document;
@ -259,7 +259,7 @@ define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'a
});
define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter',
define('ace/document', ['require', 'exports', 'module', 'ace/lib/oop', 'ace/lib/event_emitter',
'ace/range', 'ace/anchor'], function (require, exports) {
"use strict";
@ -988,7 +988,7 @@ define('ace/range', ['require', 'exports', 'module' ], function (require, export
exports.Range = Range;
});
define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function (require, exports) {
define('ace/anchor', ['require', 'exports', 'module', 'ace/lib/oop', 'ace/lib/event_emitter'], function (require, exports) {
"use strict";
var oop = require("./lib/oop");
@ -1738,7 +1738,7 @@ define("sense_editor/mode/worker_parser", ['require', 'exports', 'module' ], fun
});
define("sense_editor/mode/worker", ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror',
define("sense_editor/mode/worker", ['require', 'exports', 'module', 'ace/lib/oop', 'ace/worker/mirror',
'sense_editor/mode/worker_parser'], function (require, exports) {
"use strict";

View file

@ -106,6 +106,6 @@ export function addToRules(otherRules, embedUnder) {
otherRules.embedRules(ScriptHighlightRules, "script-", [{
token: "punctuation.end_triple_quote",
regex: '"""',
next : "pop",
next: "pop",
}]);
}

View file

@ -40,7 +40,7 @@ utils.reformatData = function (data, indent) {
};
utils.collapseLiteralStrings = function (data) {
return data.replace(/"""(?:\s*\r?\n)?((?:.|\r?\n)*?)(?:\r?\n\s*)?"""/g,function (match, literal) {
return data.replace(/"""(?:\s*\r?\n)?((?:.|\r?\n)*?)(?:\r?\n\s*)?"""/g, function (match, literal) {
return JSON.stringify(literal);
});
}

View file

@ -103,7 +103,7 @@ describe('plugins/elasticsearch', () => {
// call the server extension
const reply = sinon.stub();
const [,handler] = server.ext.firstCall.args;
const [, handler] = server.ext.firstCall.args;
handler({}, reply);
// ensure that the handler called reply and unregistered the time

View file

@ -124,7 +124,7 @@ export default function PointSeriesVisType(Private) {
group: 'metrics',
name: 'metric',
title: 'Y-Axis',
aggFilter: ['!geo_centroid','!geo_bounds'],
aggFilter: ['!geo_centroid', '!geo_bounds'],
min: 1,
defaults: [
{ schema: 'metric', type: 'count' }

View file

@ -18,7 +18,7 @@ export default function GaugeVisType(Private) {
category: CATEGORY.DATA,
visConfig: {
defaults: {
type:'gauge',
type: 'gauge',
addTooltip: true,
addLegend: true,
@ -78,7 +78,7 @@ export default function GaugeVisType(Private) {
min: 1,
aggFilter: [
'!std_dev', '!geo_centroid', '!percentiles', '!percentile_ranks',
'!derivative', '!serial_diff', '!moving_avg', '!cumulative_sum','!geo_bounds'],
'!derivative', '!serial_diff', '!moving_avg', '!cumulative_sum', '!geo_bounds'],
defaults: [
{ schema: 'metric', type: 'count' }
]

View file

@ -72,7 +72,7 @@ export default function GoalVisType(Private) {
min: 1,
aggFilter: [
'!std_dev', '!geo_centroid', '!percentiles', '!percentile_ranks',
'!derivative', '!serial_diff', '!moving_avg', '!cumulative_sum','!geo_bounds'],
'!derivative', '!serial_diff', '!moving_avg', '!cumulative_sum', '!geo_bounds'],
defaults: [
{ schema: 'metric', type: 'count' }
]

View file

@ -126,7 +126,7 @@ export default function PointSeriesVisType(Private) {
name: 'metric',
title: 'Y-Axis',
min: 1,
aggFilter: ['!geo_centroid','!geo_bounds'],
aggFilter: ['!geo_centroid', '!geo_bounds'],
defaults: [
{ schema: 'metric', type: 'count' }
]

View file

@ -126,7 +126,7 @@ export default function PointSeriesVisType(Private) {
name: 'metric',
title: 'Y-Axis',
min: 1,
aggFilter: ['!geo_centroid','!geo_bounds'],
aggFilter: ['!geo_centroid', '!geo_bounds'],
defaults: [
{ schema: 'metric', type: 'count' }
]

View file

@ -69,7 +69,7 @@ export default function MetricVisType(Private) {
name: 'metric',
title: 'Metric',
min: 1,
aggFilter: ['!derivative', '!geo_centroid','!geo_bounds'],
aggFilter: ['!derivative', '!geo_centroid', '!geo_bounds'],
defaults: [
{ schema: 'metric', type: 'count' }
]

View file

@ -42,7 +42,7 @@ describe('Boolean Format', function () {
expected: 'true'
},
{
input: ' True ',//should handle trailing and mixed case
input: ' True ', //should handle trailing and mixed case
expected: 'true'
}
].forEach((test)=> {

View file

@ -10,6 +10,6 @@ describe('SavedDashboards Service', function () {
}));
it('delete returns a native promise', function () {
expect(savedDashboardLoader.delete(['1','2'])).to.be.a(Promise);
expect(savedDashboardLoader.delete(['1', '2'])).to.be.a(Promise);
});
});

View file

@ -51,7 +51,7 @@ uiRoutes
}
})
.catch(courier.redirectWhenMissing({
'dashboard' : DashboardConstants.LANDING_PAGE_PATH
'dashboard': DashboardConstants.LANDING_PAGE_PATH
}));
}
}

View file

@ -120,7 +120,7 @@ export class PanelOptionsMenu extends React.Component {
PanelOptionsMenu.propTypes = {
onEditPanel: PropTypes.func.isRequired,
onToggleExpandPanel: PropTypes.func.isRequired,
onToggleExpandPanel: PropTypes.func.isRequired,
isExpanded: PropTypes.bool.isRequired,
onDeletePanel: PropTypes.func, // Not available when the panel is expanded.
};

View file

@ -21,7 +21,7 @@ describe('hide dev tools', function () {
beforeEach(function () {
navlinks = {};
sinon.stub(chrome, 'getNavLinkById',function () {
sinon.stub(chrome, 'getNavLinkById', function () {
return navlinks;
});
});

View file

@ -7,7 +7,7 @@ uiModules
return {
restrict: 'E',
scope : {
scope: {
data: '='
},
link: function ($scope, elem) {

View file

@ -46,7 +46,7 @@ describe('Boolean Format', function () {
expected: 'true'
},
{
input: ' True ',//should handle trailing and mixed case
input: ' True ', //should handle trailing and mixed case
expected: 'true'
}
].forEach((test)=> {

View file

@ -26,7 +26,7 @@ uiModules.get('apps/management')
{ title: 'type' },
{ title: 'format' },
{ title: 'searchable', info: 'These fields can be used in the filter bar' },
{ title: 'aggregatable' , info: 'These fields can be used in visualization aggregations' },
{ title: 'aggregatable', info: 'These fields can be used in visualization aggregations' },
{ title: 'excluded', info: 'Fields that are excluded from _source when it is fetched' },
{ title: 'controls', sortable: false }
];

View file

@ -3,15 +3,15 @@ import _ from 'lodash';
export function dateScripts(indexPattern) {
const dateScripts = {};
const scripts = {
__dayOfMonth: 'dayOfMonth',
__dayOfWeek: 'dayOfWeek',
__dayOfYear: 'dayOfYear',
__hourOfDay: 'hourOfDay',
__minuteOfDay: 'minuteOfDay',
__dayOfMonth: 'dayOfMonth',
__dayOfWeek: 'dayOfWeek',
__dayOfYear: 'dayOfYear',
__hourOfDay: 'hourOfDay',
__minuteOfDay: 'minuteOfDay',
__minuteOfHour: 'minuteOfHour',
__monthOfYear: 'monthOfYear',
__weekOfYear: 'weekOfWeekyear',
__year: 'year'
__monthOfYear: 'monthOfYear',
__weekOfYear: 'weekOfWeekyear',
__year: 'year'
};
_.each(indexPattern.fields.byType.date, function (field) {

View file

@ -225,7 +225,7 @@ uiModules.get('apps/management')
obj.id = doc._id;
return obj.applyESResp(doc)
.then(() => {
return obj.save({ confirmOverwrite : !overwriteAll });
return obj.save({ confirmOverwrite: !overwriteAll });
})
.catch((err) => {
if (err instanceof SavedObjectNotFound && err.savedObjectType === 'index-pattern') {
@ -276,7 +276,7 @@ uiModules.get('apps/management')
return;
}
return obj.hydrateIndexPattern(newIndexId)
.then(() => obj.save({ confirmOverwrite : !overwriteAll }));
.then(() => obj.save({ confirmOverwrite: !overwriteAll }));
}
).then(refreshData);
},

View file

@ -3,7 +3,7 @@ import visDataRoutes from './server/routes/vis';
export default function (kibana) {
return new kibana.Plugin({
require: ['kibana','elasticsearch'],
require: ['kibana', 'elasticsearch'],
uiExports: {
visTypes: [

View file

@ -18,7 +18,7 @@ describe('collection actions', () => {
handleChange.call(null, props, { id: 1, title: 'bar' });
expect(fn.calledOnce).to.equal(true);
expect(fn.firstCall.args[0]).to.eql({
test: [{ id:1, title: 'bar' }]
test: [{ id: 1, title: 'bar' }]
});
});
@ -34,7 +34,7 @@ describe('collection actions', () => {
expect(fn.calledOnce).to.equal(true);
expect(newItemFn.calledOnce).to.equal(true);
expect(fn.firstCall.args[0]).to.eql({
test: [{ id:1, title: 'foo' }, { id: 2, title: 'example' }]
test: [{ id: 1, title: 'foo' }, { id: 2, title: 'example' }]
});
});

View file

@ -24,7 +24,7 @@ function sortSeries(visData, model) {
});
const direction = item.terms_direction || 'desc';
if (item.terms_order_by === '_term') return acc.concat(itemSeries);
return acc.concat(sortByDirection(itemSeries, direction , s => getLastValue(s.data)));
return acc.concat(sortByDirection(itemSeries, direction, s => getLastValue(s.data)));
}, []);
}

View file

@ -50,7 +50,7 @@ export default function MetricsVisProvider(Private) {
interval: 'auto',
axis_position: 'left',
axis_formatter: 'number',
show_legend:1,
show_legend: 1,
show_grid: 1
},
component: require('../components/vis_editor')

View file

@ -8,12 +8,12 @@ describe('getLastValue(data)', () => {
});
it('returns the last value', () => {
const data = [[1,1]];
const data = [[1, 1]];
expect(getLastValue(data)).to.equal(1);
});
it('returns the second to last value if the last value is null (default)', () => {
const data = [[1,4], [2, null]];
const data = [[1, 4], [2, null]];
expect(getLastValue(data)).to.equal(4);
});
@ -23,7 +23,7 @@ describe('getLastValue(data)', () => {
});
it('returns the N to last value if the last N-1 values are null (default)', () => {
const data = [[1,4], [2, null], [3, null]];
const data = [[1, 4], [2, null], [3, null]];
expect(getLastValue(data, 3)).to.equal(4);
});

View file

@ -4,7 +4,7 @@ export default (row, metric) => {
// Extended Stats
if (_.includes(extendStatsTypes, metric.type)) {
const isStdDeviation = /^std_deviation/.test(metric.type);
const modeIsBounds = ~['upper','lower'].indexOf(metric.mode);
const modeIsBounds = ~['upper', 'lower'].indexOf(metric.mode);
if (isStdDeviation && modeIsBounds) {
return _.get(row, `${metric.id}.std_deviation_bounds.${metric.mode}`);
}

View file

@ -24,7 +24,7 @@ export default (id, metrics) => {
case 'std_deviation':
case 'variance':
case 'sum_of_squares':
if (/^std_deviation/.test(metric.type) && ~['upper','lower'].indexOf(metric.mode)) {
if (/^std_deviation/.test(metric.type) && ~['upper', 'lower'].indexOf(metric.mode)) {
bucketsPath += `[std_${metric.mode}]`;
} else {
bucketsPath += `[${metric.type}]`;

View file

@ -6,8 +6,8 @@ export default function getSplitColors(inputColor, size = 10, style = 'gradient'
if (style === 'rainbow') {
return [
'#68BC00', '#009CE0', '#B0BC00', '#16A5A5', '#D33115', '#E27300', '#FCC400','#7B64FF', '#FA28FF', '#333333', '#808080',
'#194D33', '#0062B1', '#808900', '#0C797D', '#9F0500', '#C45100', '#FB9E00','#653294', '#AB149E', '#0F1419', '#666666'
'#68BC00', '#009CE0', '#B0BC00', '#16A5A5', '#D33115', '#E27300', '#FCC400', '#7B64FF', '#FA28FF', '#333333', '#808080',
'#194D33', '#0062B1', '#808900', '#0C797D', '#9F0500', '#C45100', '#FB9E00', '#653294', '#AB149E', '#0F1419', '#666666'
];
} else {
colors.push(color.hex());

View file

@ -6,7 +6,7 @@ export default function dateHistogram(req, panel, annotation) {
const timeField = annotation.time_field;
const { bucketSize, intervalString } = getBucketSize(req, 'auto');
const { from, to } = getTimerange(req);
const { timezone:time_zone } = req.payload.timerange;
const { timezone: time_zone } = req.payload.timerange;
_.set(doc, `aggs.${annotation.id}.date_histogram`, {
field: timeField,
interval: intervalString,

View file

@ -7,7 +7,7 @@ export default function dateHistogram(req, panel, series) {
const { timeField, interval } = getIntervalAndTimefield(panel, series);
const { intervalString } = getBucketSize(req, interval);
const { from, to } = offsetTime(req, series.offset_time);
const { timezone:time_zone } = req.payload.timerange;
const { timezone: time_zone } = req.payload.timerange;
set(doc, `aggs.${series.id}.aggs.timeseries.date_histogram`, {
field: timeField,

View file

@ -3,33 +3,33 @@ import seriesAgg from '../_series_agg';
describe('seriesAgg', () => {
const series = [
[[0,2],[1,1],[2,3]],
[[0,4],[1,2],[2,3]],
[[0,2],[1,1],[2,3]]
[[0, 2], [1, 1], [2, 3]],
[[0, 4], [1, 2], [2, 3]],
[[0, 2], [1, 1], [2, 3]]
];
describe('basic', () => {
it('returns the series sum', () => {
expect(seriesAgg.sum(series)).to.eql([
[[0,8], [1,4], [2,9]]
[[0, 8], [1, 4], [2, 9]]
]);
});
it('returns the series max', () => {
expect(seriesAgg.max(series)).to.eql([
[[0,4], [1,2], [2,3]]
[[0, 4], [1, 2], [2, 3]]
]);
});
it('returns the series min', () => {
expect(seriesAgg.min(series)).to.eql([
[[0,2], [1,1], [2,3]]
[[0, 2], [1, 1], [2, 3]]
]);
});
it('returns the series mean', () => {
expect(seriesAgg.mean(series)).to.eql([
[[0,(8 / 3)], [1,(4 / 3)], [2,3]]
[[0, (8 / 3)], [1, (4 / 3)], [2, 3]]
]);
});
});
@ -37,26 +37,26 @@ describe('seriesAgg', () => {
describe('overall', () => {
it('returns the series overall sum', () => {
expect(seriesAgg.overall_sum(series)).to.eql([
[[0,21], [1,21], [2,21]]
[[0, 21], [1, 21], [2, 21]]
]);
});
it('returns the series overall max', () => {
expect(seriesAgg.overall_max(series)).to.eql([
[[0,4], [1,4], [2,4]]
[[0, 4], [1, 4], [2, 4]]
]);
});
it('returns the series overall min', () => {
expect(seriesAgg.overall_min(series)).to.eql([
[[0,1], [1,1], [2,1]]
[[0, 1], [1, 1], [2, 1]]
]);
});
it('returns the series overall mean', () => {
const value = ((8) + (4) + 9) / 3;
expect(seriesAgg.overall_avg(series)).to.eql([
[[0,value], [1,value], [2,value]]
[[0, value], [1, value], [2, value]]
]);
});
@ -65,7 +65,7 @@ describe('seriesAgg', () => {
describe('cumlative sum', () => {
it('returns the series cumlative sum', () => {
expect(seriesAgg.cumlative_sum(series)).to.eql([
[[0,8], [1,12], [2,21]]
[[0, 8], [1, 12], [2, 21]]
]);
});
});

View file

@ -86,8 +86,8 @@ describe('percentile(resp, panel, series)', () => {
expect(results[0]).to.have.property('points');
expect(results[0].points).to.eql({ show: false });
expect(results[0].data).to.eql([
[1,1],
[2,1.2]
[1, 1],
[2, 1.2]
]);
expect(results[1]).to.have.property('id', '10-90:test:90');
@ -103,8 +103,8 @@ describe('percentile(resp, panel, series)', () => {
expect(results[1]).to.have.property('points');
expect(results[1].points).to.eql({ show: false });
expect(results[1].data).to.eql([
[1,5],
[2,5.3]
[1, 5],
[2, 5.3]
]);
expect(results[2]).to.have.property('id', '50:test');
@ -127,8 +127,8 @@ describe('percentile(resp, panel, series)', () => {
expect(results[2]).to.have.property('points');
expect(results[2].points).to.eql({ show: true, lineWidth: 1, radius: 1 });
expect(results[2].data).to.eql([
[1,2.5],
[2,2.7]
[1, 2.5],
[2, 2.7]
]);

View file

@ -75,7 +75,7 @@ describe('stdMetric(resp, panel, series)', () => {
expect(results[0]).to.have.property('stack');
expect(results[0]).to.have.property('bars');
expect(results[0]).to.have.property('points');
expect(results[0].data).to.eql([ [1,1], [2,2] ]);
expect(results[0].data).to.eql([ [1, 1], [2, 2] ]);
});
});

View file

@ -58,7 +58,7 @@ function TableVisTypeProvider(Private) {
group: 'metrics',
name: 'metric',
title: 'Metric',
aggFilter: ['!geo_centroid','!geo_bounds'],
aggFilter: ['!geo_centroid', '!geo_bounds'],
min: 1,
defaults: [
{ type: 'count', schema: 'metric' }

View file

@ -41,7 +41,7 @@ VisTypesRegistryProvider.register(function TagCloudProvider(Private) {
title: 'Tag Size',
min: 1,
max: 1,
aggFilter: ['!std_dev', '!percentiles', '!percentile_ranks', '!derivative','!geo_bounds','!geo_centroid'],
aggFilter: ['!std_dev', '!percentiles', '!percentile_ranks', '!derivative', '!geo_bounds', '!geo_centroid'],
defaults: [
{ schema: 'metric', type: 'count' }
]

View file

@ -56,7 +56,7 @@ describe('kibana_map tests', function () {
[
{
options: { mapType: 'Scaled Circle Markers' },
options: { mapType: 'Scaled Circle Markers' },
expected: scaledCircleMarkersPng
},
{

View file

@ -37,7 +37,7 @@ describe('kibana_map tests', function () {
kibanaMap = new KibanaMap(domNode, {
minZoom: 1,
maxZoom: 10,
center: [0,0],
center: [0, 0],
zoom: 0
});
});
@ -86,7 +86,7 @@ describe('kibana_map tests', function () {
kibanaMap = new KibanaMap(domNode, {
minZoom: 1,
maxZoom: 10,
center: [0,0],
center: [0, 0],
zoom: 2
});
});
@ -106,7 +106,7 @@ describe('kibana_map tests', function () {
kibanaMap = new KibanaMap(noHeightNode, {
minZoom: 1,
maxZoom: 10,
center: [0,0],
center: [0, 0],
zoom: 10
});
});
@ -130,7 +130,7 @@ describe('kibana_map tests', function () {
kibanaMap = new KibanaMap(noWidthNode, {
minZoom: 1,
maxZoom: 10,
center: [0,0],
center: [0, 0],
zoom: 10
});
});
@ -199,7 +199,7 @@ describe('kibana_map tests', function () {
kibanaMap = new KibanaMap(domNode, {
minZoom: 1,
maxZoom: 10,
center: [0,0],
center: [0, 0],
zoom: 0
});
});

View file

@ -330,7 +330,7 @@ export function MapsVisualizationProvider(serviceSettings, Notifier, getAppState
searchSource.aggs(function () {
const geoBoundsAgg = new AggConfig(agg.vis, {
type: 'geo_bounds',
enabled:true,
enabled: true,
params: {
field: agg.getField()
},

View file

@ -21,7 +21,7 @@ function baseTickFormatter(value, axis) {
export default function tickFormatters() {
const formatters = {
'bits': function (val) {
const labels = ['b','kb','mb','gb','tb','pb'];
const labels = ['b', 'kb', 'mb', 'gb', 'tb', 'pb'];
let index = 0;
while (val >= 1000 && index < labels.length) {
val /= 1000;
@ -30,7 +30,7 @@ export default function tickFormatters() {
return (Math.round(val * 100) / 100) + labels[index];
},
'bits/s': function (val) {
const labels = ['b/s','kb/s','mb/s','gb/s','tb/s','pb/s'];
const labels = ['b/s', 'kb/s', 'mb/s', 'gb/s', 'tb/s', 'pb/s'];
let index = 0;
while (val >= 1000 && index < labels.length) {
val /= 1000;
@ -39,7 +39,7 @@ export default function tickFormatters() {
return (Math.round(val * 100) / 100) + labels[index];
},
'bytes': function (val) {
const labels = ['B','KB','MB','GB','TB','PB'];
const labels = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
let index = 0;
while (val >= 1024 && index < labels.length) {
val /= 1024;
@ -48,7 +48,7 @@ export default function tickFormatters() {
return (Math.round(val * 100) / 100) + labels[index];
},
'bytes/s': function (val) {
const labels = ['B/s','KB/s','MB/s','GB/s','TB/s','PB/s'];
const labels = ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s'];
let index = 0;
while (val >= 1024 && index < labels.length) {
val /= 1024;

View file

@ -93,7 +93,7 @@ export default function chainRunner(tlConfig) {
}
return promise.then(function (result) {
return invokeChain({ type:'chain', chain: chain }, [result]);
return invokeChain({ type: 'chain', chain: chain }, [result]);
});
}

View file

@ -10,7 +10,7 @@ export default function (server) {
const body = {
index: uiSettings['es.default_index'],
fields:timefield
fields: timefield
};
callWithRequest(request, 'fieldStats', body).then(function (resp) {

View file

@ -23,7 +23,7 @@ describe(filename, () => {
const expected = ['#000000', '#111111', '#222222', '#333333'];
const fourLongList = {
type: 'seriesList',
list: seriesList.list.slice(0,4)
list: seriesList.list.slice(0, 4)
};
return invoke(fn, [fourLongList, '#000:#333']).then((r) => {
const colors = _.map(r.output.list, 'color');

View file

@ -12,7 +12,7 @@ describe(filename, function () {
let seriesList;
beforeEach(function () {
seriesList = require('./fixtures/seriesList.js')();
comparable = getSeriesList('',[
comparable = getSeriesList('', [
[moment.utc('1980-01-01T00:00:00.000Z'), 12],
[moment.utc('1981-01-01T00:00:00.000Z'), 33],
[moment.utc('1982-01-01T00:00:00.000Z'), 82],

View file

@ -16,7 +16,7 @@ import invoke from './helpers/invoke_series_fn.js';
function stubResponse(response) {
return {
server: {
plugins:{
plugins: {
elasticsearch: {
getCluster: sinon.stub().withArgs('data').returns({
callWithRequest: function () {
@ -153,7 +153,7 @@ describe(filename, () => {
from: 1,
to: 5,
},
request: { payload: { extended: { es: { filter:{
request: { payload: { extended: { es: { filter: {
bool: {
must: [
{ query: { query_string: { query: 'foo' } } }
@ -229,7 +229,7 @@ describe(filename, () => {
];
expect(fn(buckets)).to.eql({
count:[[1000,3],[2000,14],[3000,15]]
count: [[1000, 3], [2000, 14], [3000, 15]]
});
});
@ -241,8 +241,8 @@ describe(filename, () => {
];
expect(fn(buckets)).to.eql({
count:[[1000,3],[2000,14],[3000,15]],
max: [[1000,92],[2000,65],[3000,35]]
count: [[1000, 3], [2000, 14], [3000, 15]],
max: [[1000, 92], [2000, 65], [3000, 35]]
});
});
});
@ -250,82 +250,82 @@ describe(filename, () => {
it('should throw an error', () => {
expect(aggResponse.default(esResponse.aggregations, config)).to.eql([
{
data: [[1000,264],[2000,264]],
data: [[1000, 264], [2000, 264]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueA > FieldB:Value2A > MetricA',
type: 'series',
},{
data: [[1000,398],[2000,1124]],
}, {
data: [[1000, 398], [2000, 1124]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueA > FieldB:Value2A > MetricB',
type: 'series',
},{
data: [[1000,699],[2000,110]],
}, {
data: [[1000, 699], [2000, 110]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueA > FieldB:Value2B > MetricA',
type: 'series',
},{
data: [[1000,457],[2000,506]],
}, {
data: [[1000, 457], [2000, 506]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueA > FieldB:Value2B > MetricB',
type: 'series',
},{
data: [[1000,152],[2000,518]],
}, {
data: [[1000, 152], [2000, 518]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueB > FieldB:Value2B > MetricA',
type: 'series',
},{
data: [[1000,61],[2000,77]],
}, {
data: [[1000, 61], [2000, 77]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueB > FieldB:Value2B > MetricB',
type: 'series',
},{
data: [[1000,114],[2000,264]],
}, {
data: [[1000, 114], [2000, 264]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueB > FieldB:Value2A > MetricA',
type: 'series',
},{
data: [[1000,23],[2000,45]],
}, {
data: [[1000, 23], [2000, 45]],
fit: 'nearest',
label: 'q:QueryA > FieldA:ValueB > FieldB:Value2A > MetricB',
type: 'series',
},{
data: [[1000,621],[2000,751]],
}, {
data: [[1000, 621], [2000, 751]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueA > FieldB:Value2B > MetricA',
type: 'series',
},{
data: [[1000,12],[2000,12]],
}, {
data: [[1000, 12], [2000, 12]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueA > FieldB:Value2B > MetricB',
type: 'series',
},{
data: [[1000,110],[2000,648]],
}, {
data: [[1000, 110], [2000, 648]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueA > FieldB:Value2A > MetricA',
type: 'series',
},{
data: [[1000,11],[2000,12]],
}, {
data: [[1000, 11], [2000, 12]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueA > FieldB:Value2A > MetricB',
type: 'series',
},{
data: [[1000,755],[2000,713]],
}, {
data: [[1000, 755], [2000, 713]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueC > FieldB:Value2C > MetricA',
type: 'series',
},{
data: [[1000,10],[2000,18]],
}, {
data: [[1000, 10], [2000, 18]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueC > FieldB:Value2C > MetricB',
type: 'series',
},{
data: [[1000,391],[2000,802]],
}, {
data: [[1000, 391], [2000, 802]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueC > FieldB:Value2A > MetricA',
type: 'series',
},{
data: [[1000,4],[2000,4]],
}, {
data: [[1000, 4], [2000, 4]],
fit: 'nearest',
label: 'q:QueryB > FieldA:ValueC > FieldB:Value2A > MetricB',
type: 'series',

View file

@ -10,7 +10,7 @@ describe(filename, function () {
describe('carry', function () {
it('should maintain the previous value until it changes', function () {
const seriesList = getSeriesList('',[
const seriesList = getSeriesList('', [
[moment.utc('1980-01-01T00:00:00.000Z'), 5],
[moment.utc('1981-01-01T00:00:00.000Z'), null],
[moment.utc('1982-01-01T00:00:00.000Z'), 3.4],
@ -27,7 +27,7 @@ describe(filename, function () {
describe('nearest', function () {
it('should use the closest temporal value to fill the null', function () {
const seriesList = getSeriesList('',[
const seriesList = getSeriesList('', [
[moment.utc('1980-01-01T00:00:00.000Z'), 5],
[moment.utc('1981-01-01T00:00:00.000Z'), null],
[moment.utc('1981-05-01T00:00:00.000Z'), 3.4],
@ -46,7 +46,7 @@ describe(filename, function () {
describe('average', function () {
it('should produce a smooth, straight line between points', function () {
const seriesList = getSeriesList('',[
const seriesList = getSeriesList('', [
[moment.utc('1980-01-01T00:00:00.000Z'), 10],
[moment.utc('1981-07-01T00:00:00.000Z'), null],
[moment.utc('1982-01-01T00:00:00.000Z'), null],

View file

@ -3,7 +3,7 @@ import _ from 'lodash';
export default function getSeries(name, buckets, points) {
const fill = _.partial(_.zip, _.map(buckets, function (bucket) { return bucket.valueOf(); }));
return {
data: fill(points),
data: fill(points),
type: 'series',
label: name
};

View file

@ -14,7 +14,7 @@ describe(filename, () => {
it('should create the _global object if it does not exist', () => {
expect(seriesList.list[0]._global).to.equal(undefined);
return invoke(fn, [seriesList, 'nw', 3]).then((r) => {
expect(r.output.list[0]._global).to.eql({ legend:{ noColumns: 3, position: 'nw' } });
expect(r.output.list[0]._global).to.eql({ legend: { noColumns: 3, position: 'nw' } });
});
});

View file

@ -66,7 +66,7 @@ describe(filename, function () {
});
it('should throw an error is passed an unsupported interval', function () {
return invoke(fn, [], { time:{ interval:'2d' } })
return invoke(fn, [], { time: { interval: '2d' } })
.then(expect.fail)
.catch(function (r) {
expect(r).to.be.an('error');
@ -74,7 +74,7 @@ describe(filename, function () {
});
it('should use the configured API key when talking to quandl', function () {
return invoke(fn, [], { settings:{ 'timelion:quandl.key': 'bEeR' } }).then(function () {
return invoke(fn, [], { settings: { 'timelion:quandl.key': 'bEeR' } }).then(function () {
expect(calledWith.params.auth_token).to.eql('bEeR');
});
});

View file

@ -5,7 +5,7 @@ export default function buildRequest(config, tlConfig) {
const bool = { must: [] };
const timeFilter = { range:{} };
const timeFilter = { range: {} };
timeFilter.range[config.timefield] = { gte: tlConfig.time.from, lte: tlConfig.time.to, format: 'epoch_millis' };
bool.must.push(timeFilter);
@ -19,7 +19,7 @@ export default function buildRequest(config, tlConfig) {
meta: { type: 'split' },
filters: {
filters: _.chain(config.q).map(function (q) {
return [q, { query_string:{ query: q } }];
return [q, { query_string: { query: q } }];
}).zipObject().value(),
},
aggs: {}

View file

@ -19,7 +19,7 @@ export default new Datasource ('graphite', {
const time = {
min: moment(tlConfig.time.from).format('HH:mm[_]YYYYMMDD'),
max: moment(tlConfig.time.to).format('HH:mm[_]YYYYMMDD')
max: moment(tlConfig.time.to).format('HH:mm[_]YYYYMMDD')
};
const URL = tlConfig.settings['timelion:graphite.url'] + '/render/' +

View file

@ -19,7 +19,7 @@ export default new Chainable('label', {
}
],
help: 'Change the label of the series. Use %s reference the existing label',
fn: function labelFn(args) {
fn: function labelFn(args) {
const config = args.byName;
return alter(args, function (eachSeries) {
if (config.regex) {

View file

@ -67,13 +67,13 @@ export default new Chainable('movingaverage', {
eachSeries.data = _.map(pairs, function (point, i) {
const cursor = i + 1;
if (cursor < _window) return [point[0], null];
return toPoint(point, pairs.slice(cursor - _window , cursor));
return toPoint(point, pairs.slice(cursor - _window, cursor));
});
} else if (_position === 'right') {
eachSeries.data = _.map(pairs, function (point, i) {
if (i > pairsLen - _window) return [point[0], null];
return toPoint(point, pairs.slice(i , i + _window));
return toPoint(point, pairs.slice(i, i + _window));
});
}

View file

@ -49,7 +49,7 @@ export default new Datasource ('quandl', {
const time = {
min: moment.utc(tlConfig.time.from).format('YYYY-MM-DD'),
max: moment.utc(tlConfig.time.to).format('YYYY-MM-DD')
max: moment.utc(tlConfig.time.to).format('YYYY-MM-DD')
};
// POSITIONS
@ -74,7 +74,7 @@ export default new Datasource ('quandl', {
return {
type: 'seriesList',
list: [{
data: data,
data: data,
type: 'series',
fit: 'nearest',
label: resp.name

View file

@ -28,7 +28,7 @@ export default new Datasource ('worldbank', {
const time = {
min: moment(tlConfig.time.from).format('YYYY'),
max: moment(tlConfig.time.to).format('YYYY')
max: moment(tlConfig.time.to).format('YYYY')
};
const URL = 'http://api.worldbank.org/' + config.code +
@ -60,7 +60,7 @@ export default new Datasource ('worldbank', {
return {
type: 'seriesList',
list: [{
data: data,
data: data,
type: 'series',
label: description,
_meta: {

View file

@ -2,13 +2,13 @@ import _ from 'lodash';
import alter from '../lib/alter.js';
import Chainable from '../lib/classes/chainable';
const tickFormatters = {
'bits':'bits',
'bits/s':'bits/s',
'bytes':'bytes',
'bytes/s':'bytes/s',
'currency':'currency(:ISO 4217 currency code)',
'percent':'percent',
'custom':'custom(:prefix:suffix)'
'bits': 'bits',
'bits/s': 'bits/s',
'bytes': 'bytes',
'bytes/s': 'bytes/s',
'currency': 'currency(:ISO 4217 currency code)',
'percent': 'percent',
'custom': 'custom(:prefix:suffix)'
};
export default new Chainable('yaxis', {

View file

@ -11,7 +11,7 @@ import {
import { createFormatArchiveStreams } from '../format';
const INPUTS = [1, 2, { foo: 'bar' }, [1,2]];
const INPUTS = [1, 2, { foo: 'bar' }, [1, 2]];
const INPUT_JSON = INPUTS.map(i => JSON.stringify(i, null, 2)).join('\n\n');
describe('esArchiver createFormatArchiveStreams', () => {
@ -55,7 +55,7 @@ describe('esArchiver createFormatArchiveStreams', () => {
it('streams consume js values and produces buffers', async () => {
const output = await createPromiseFromStreams([
createListStream([1, 2, { foo: 'bar' }, [1,2]]),
createListStream([1, 2, { foo: 'bar' }, [1, 2]]),
...createFormatArchiveStreams({ gzip: true }),
createConcatStream([])
]);

View file

@ -76,7 +76,7 @@ describe('esArchiver createParseArchiveStreams', () => {
expect(await receivedPromise).to.eql({ a: 1 });
input.write(Buffer.from('{"a": 2}'));
input.end();
expect(await finalPromise).to.eql([{ a: 1 }, { a:2 }]);
expect(await finalPromise).to.eql([{ a: 1 }, { a: 2 }]);
});
});

View file

@ -9,8 +9,8 @@ export default {
failed: 0
},
hits: {
total : 49487,
max_score : 1.0,
total: 49487,
max_score: 1.0,
hits: hits
}
};

View file

@ -1,4 +1,4 @@
import _ , { partial } from 'lodash';
import _, { partial } from 'lodash';
import { createTransform, Deprecations } from '../../deprecation';
const { rename, unused } = Deprecations;

View file

@ -515,7 +515,7 @@ describe('SavedObjectsClient', () => {
it('reports error on missed objects', async () => {
callAdminCluster.returns(Promise.resolve({
docs:[{
docs: [{
_type: 'doc',
_id: 'config:good',
found: true,

View file

@ -41,7 +41,7 @@ describe('Control Group', function () {
expect(cpuStat).to.eql({
number_of_elapsed_periods: 0,
number_of_times_throttled: 10,
time_throttled_nanos: 20
time_throttled_nanos: 20
});
});
@ -52,7 +52,7 @@ describe('Control Group', function () {
expect(cpuStat).to.eql({
number_of_elapsed_periods: -1,
number_of_times_throttled: -1,
time_throttled_nanos: -1
time_throttled_nanos: -1
});
});
});

View file

@ -30,7 +30,7 @@ export class Metrics {
process: {
mem: {
heap_max_in_bytes: get(hapiEvent, 'psmem.heapTotal'),
heap_used_in_bytes: get(hapiEvent, 'psmem.heapUsed')
heap_used_in_bytes: get(hapiEvent, 'psmem.heapUsed')
}
},
os: {
@ -43,10 +43,10 @@ export class Metrics {
}
},
response_times: {
avg_in_millis: get(hapiEvent, ['responseTimes', port, 'avg']),
avg_in_millis: get(hapiEvent, ['responseTimes', port, 'avg']),
max_in_millis: get(hapiEvent, ['responseTimes', port, 'max'])
},
requests: keysToSnakeCaseShallow(get(hapiEvent, ['requests', port])),
requests: keysToSnakeCaseShallow(get(hapiEvent, ['requests', port])),
concurrent_connections: get(hapiEvent, ['concurrents', port])
};
}

View file

@ -27,7 +27,7 @@ describe('ui/i18n module', function () {
describe('getTranslations', function () {
it('should return the translations for en locale as registered' , function () {
it('should return the translations for en locale as registered', function () {
const languageTag = ['en'];
const expectedTranslationJson = {
'test_plugin_1-NO_SSL': 'Dont run the dev server using HTTPS',
@ -38,7 +38,7 @@ describe('ui/i18n module', function () {
return checkTranslations(expectedTranslationJson, languageTag, i18nObj);
});
it('should return the translations for de locale as registered' , function () {
it('should return the translations for de locale as registered', function () {
const languageTag = ['de'];
const expectedTranslationJson = {
'test_plugin_1-NO_SSL': 'Dont run the DE dev server using HTTPS',
@ -47,7 +47,7 @@ describe('ui/i18n module', function () {
return checkTranslations(expectedTranslationJson, languageTag, i18nObj);
});
it('should pick the highest priority language for which translations exist' , function () {
it('should pick the highest priority language for which translations exist', function () {
const languageTags = ['es-ES', 'de', 'en'];
const expectedTranslations = {
'test_plugin_1-NO_SSL': 'Dont run the DE dev server using HTTPS',
@ -56,16 +56,16 @@ describe('ui/i18n module', function () {
return checkTranslations(expectedTranslations, languageTags, i18nObj);
});
it('should return translations for highest priority locale where best case match is chosen from registered locales' , function () {
it('should return translations for highest priority locale where best case match is chosen from registered locales', function () {
const languageTags = ['es', 'de'];
const expectedTranslations = {
'test_plugin_1-NO_SSL': 'Dont run the es-ES dev server using HTTPS! I am regsitered afterwards!'
};
i18nObj.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_1','es-ES.json'));
i18nObj.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_1', 'es-ES.json'));
return checkTranslations(expectedTranslations, languageTags, i18nObj);
});
it('should return an empty object for locales with no translations' , function () {
it('should return an empty object for locales with no translations', function () {
const languageTags = ['ja-JA', 'fr'];
return checkTranslations({}, languageTags, i18nObj);
});
@ -74,7 +74,7 @@ describe('ui/i18n module', function () {
describe('getTranslationsForDefaultLocale', function () {
it('should return translations for default locale which is set to the en locale' , function () {
it('should return translations for default locale which is set to the en locale', function () {
const i18nObj1 = new I18n('en');
const expectedTranslations = {
'test_plugin_1-NO_SSL': 'Dont run the dev server using HTTPS',
@ -82,17 +82,17 @@ describe('ui/i18n module', function () {
'test_plugin_1-NO_RUN_SERVER': 'Dont run the dev server',
'test_plugin_1-HOME': 'Run along home now!'
};
i18nObj1.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_1','en.json'));
i18nObj1.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_1', 'en.json'));
return checkTranslationsForDefaultLocale(expectedTranslations, i18nObj1);
});
it('should return translations for default locale which is set to the de locale' , function () {
it('should return translations for default locale which is set to the de locale', function () {
const i18nObj1 = new I18n('de');
const expectedTranslations = {
'test_plugin_1-NO_SSL': 'Dont run the DE dev server using HTTPS',
'test_plugin_1-DEV': 'Run the DE server with development mode defaults',
};
i18nObj1.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_1','de.json'));
i18nObj1.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_1', 'de.json'));
return checkTranslationsForDefaultLocale(expectedTranslations, i18nObj1);
});
@ -100,7 +100,7 @@ describe('ui/i18n module', function () {
describe('getAllTranslations', function () {
it('should return all translations' , function () {
it('should return all translations', function () {
const expectedTranslations = {
de: {
'test_plugin_1-NO_SSL': 'Dont run the DE dev server using HTTPS',
@ -142,7 +142,7 @@ describe('ui/i18n module', function () {
describe('getTranslations', function () {
it('should return the translations for en locale as registered' , function () {
it('should return the translations for en locale as registered', function () {
const languageTag = ['en'];
const expectedTranslationJson = {
'test_plugin_1-NO_SSL': 'Dont run the dev server using HTTPS',
@ -157,7 +157,7 @@ describe('ui/i18n module', function () {
return checkTranslations(expectedTranslationJson, languageTag, i18nObj);
});
it('should return the translations for de locale as registered' , function () {
it('should return the translations for de locale as registered', function () {
const languageTag = ['de'];
const expectedTranslationJson = {
'test_plugin_1-NO_SSL': 'Dont run the DE dev server using HTTPS',
@ -166,7 +166,7 @@ describe('ui/i18n module', function () {
return checkTranslations(expectedTranslationJson, languageTag, i18nObj);
});
it('should return the most recently registered translation for a key that has multiple translations' , function () {
it('should return the most recently registered translation for a key that has multiple translations', function () {
i18nObj.registerTranslations(join(FIXTURES, 'translations', 'test_plugin_2', 'de.json'));
const languageTag = ['de'];
const expectedTranslationJson = {

View file

@ -30,7 +30,7 @@ describe('ui/errors', () => {
new SearchTimeout(),
new RequestFailure('an error', { }),
new FetchFailure({ }),
new ShardFailure({ '_shards' : 5 }),
new ShardFailure({ '_shards': 5 }),
new VersionConflict({ }),
new MappingConflict({ }),
new RestrictedMapping('field', 'indexPattern'),

View file

@ -86,7 +86,7 @@ describe('getPoint', function () {
});
it ('adds the aggConfig to the points', function () {
const seriesAspect = { i: 1, agg: truthFormatted };
const seriesAspect = { i: 1, agg: truthFormatted };
const point = getPoint(xAspect, seriesAspect, yScale, row, yAspect);
expect(point).to.have.property('aggConfig', truthFormatted);

View file

@ -119,7 +119,7 @@ describe('AggTable Directive', function () {
{ type: 'min', schema: 'metric', params: { field: '@timestamp' } },
{ type: 'terms', schema: 'bucket', params: { field: 'extension' } },
{ type: 'date_histogram', schema: 'bucket', params: { field: '@timestamp', interval: 'd' } },
{ type: 'derivative', schema: 'metric', params: { metricAgg: 'custom', customMetric: { id:'5-orderAgg', type: 'count' } } },
{ type: 'derivative', schema: 'metric', params: { metricAgg: 'custom', customMetric: { id: '5-orderAgg', type: 'count' } } },
{ type: 'top_hits', schema: 'metric', params: { field: 'bytes', aggregate: { val: 'min' }, size: 1 } }
]
});

View file

@ -33,7 +33,7 @@ describe('editor', function () {
render = function (params) {
vis = new Vis(indexPattern, {
type: 'histogram',
aggs:[
aggs: [
{ schema: 'metric', type: 'avg', params: { field: 'bytes' } },
{ schema: 'segment', type: 'date_histogram', params: params || {} }
]

View file

@ -79,7 +79,7 @@ describe('parent pipeline aggs', function () {
init({
metricAgg: 'custom',
customMetric: {
id:'1-orderAgg',
id: '1-orderAgg',
type: 'max',
params: { field: 'bytes' },
schema: 'orderAgg'
@ -92,12 +92,12 @@ describe('parent pipeline aggs', function () {
init({
metricAgg: 'custom',
customMetric: {
id:'2-orderAgg',
id: '2-orderAgg',
type: metric.name,
params: {
buckets_path: 'custom',
customMetric: {
id:'2-orderAgg-orderAgg',
id: '2-orderAgg-orderAgg',
type: 'count',
schema: 'orderAgg'
}
@ -112,7 +112,7 @@ describe('parent pipeline aggs', function () {
init({
metricAgg: 'custom',
customMetric: {
id:'2-metric',
id: '2-metric',
type: 'max',
params: { field: 'bytes' },
schema: 'orderAgg'
@ -126,12 +126,12 @@ describe('parent pipeline aggs', function () {
init({
metricAgg: 'custom',
customMetric: {
id:'2-metric',
id: '2-metric',
type: metric.name,
params: {
buckets_path: 'custom',
customMetric: {
id:'2-metric-metric',
id: '2-metric-metric',
type: 'max',
params: { field: 'bytes' },
schema: 'orderAgg'
@ -155,12 +155,12 @@ describe('parent pipeline aggs', function () {
init({
metricAgg: 'custom',
customMetric: {
id:'2-metric',
id: '2-metric',
type: metric.name,
params: {
buckets_path: 'custom',
customMetric: {
id:'2-metric-metric',
id: '2-metric-metric',
type: 'max',
params: { field: 'bytes' },
schema: 'orderAgg'

View file

@ -128,7 +128,7 @@ export function AggTypesBucketsGeoHashProvider(Private, config) {
aggs.push(new AggConfig(agg.vis, {
type: 'filter',
id: 'filter_agg',
enabled:true,
enabled: true,
params: {
geo_bounding_box: boundingBox
},
@ -144,7 +144,7 @@ export function AggTypesBucketsGeoHashProvider(Private, config) {
if (agg.params.useGeocentroid) {
aggs.push(new AggConfig(agg.vis, {
type: 'geo_centroid',
enabled:true,
enabled: true,
params: {
field: agg.getField()
},

View file

@ -85,7 +85,7 @@ describe('Saved Object', function () {
describe('with confirmOverwrite', function () {
function stubConfirmOverwrite() {
window.confirm = sinon.stub().returns(true);
sinon.stub(esDataStub, 'create').returns(BluebirdPromise.reject({ status : 409 }));
sinon.stub(esDataStub, 'create').returns(BluebirdPromise.reject({ status: 409 }));
}
describe('when true', function () {
@ -100,7 +100,7 @@ describe('Saved Object', function () {
savedObject.lastSavedTitle = 'original title';
savedObject.title = 'new title';
return savedObject.save({ confirmOverwrite : true })
return savedObject.save({ confirmOverwrite: true })
.then(() => {
expect(window.confirm.called).to.be(true);
expect(savedObject.id).to.be('myId');
@ -120,7 +120,7 @@ describe('Saved Object', function () {
savedObject.lastSavedTitle = 'original title';
savedObject.title = 'new title';
return savedObject.save({ confirmOverwrite : true })
return savedObject.save({ confirmOverwrite: true })
.then(() => {
expect(savedObject.id).to.be('HI');
expect(savedObject.isSaving).to.be(false);
@ -157,7 +157,7 @@ describe('Saved Object', function () {
sinon.stub(savedObjectsClientStub, 'create').returns(BluebirdPromise.resolve({ id: 'myId' }));
return savedObject.save({ confirmOverwrite : false }).then(() => {
return savedObject.save({ confirmOverwrite: false }).then(() => {
expect(window.confirm.called).to.be(false);
});
});

View file

@ -38,7 +38,7 @@ describe('ui/courier/fetch/request/segmented/_createQueue', () => {
it('relies on indexPattern.toDetailedIndexList to generate queue', async function () {
const source = new MockSource();
const ip = source.get('index');
const indices = [1,2,3];
const indices = [1, 2, 3];
sinon.stub(ip, 'toDetailedIndexList').returns(Promise.resolve(indices));
const req = new SegmentedReq(source);
@ -50,7 +50,7 @@ describe('ui/courier/fetch/request/segmented/_createQueue', () => {
const source = new MockSource();
const ip = source.get('index');
const req = new SegmentedReq(source);
sinon.stub(ip, 'toDetailedIndexList').returns(Promise.resolve([1,2,3]));
sinon.stub(ip, 'toDetailedIndexList').returns(Promise.resolve([1, 2, 3]));
req.setDirection('asc');
await req._createQueue();

View file

@ -30,14 +30,14 @@ const init = function () {
// Add some parameters to it
const timefilter = {
time : {
time: {
from: moment().subtract(15, 'minutes'),
to: moment(),
mode: undefined
},
refreshInterval : {
value : 0,
display : 'Off'
refreshInterval: {
value: 0,
display: 'Off'
}
};
$parentScope.timefilter = timefilter;
@ -101,19 +101,19 @@ describe('timepicker directive', function () {
});
it('should have a $scope.setRefreshInterval() that calls handler', function () {
$scope.setRefreshInterval({ value : 10000 });
$scope.setRefreshInterval({ value: 10000 });
sinon.assert.calledOnce($parentScope.updateInterval);
expect($parentScope.updateInterval.firstCall.args[0]).to.have.property('value', 10000);
});
it('should unpause when setRefreshInterval is called without pause:true', function () {
$scope.setRefreshInterval({ value : 1000, pause: true });
$scope.setRefreshInterval({ value: 1000, pause: true });
expect($parentScope.updateInterval.getCall(0).args[0]).to.have.property('pause', true);
$scope.setRefreshInterval({ value : 1000, pause: false });
$scope.setRefreshInterval({ value: 1000, pause: false });
expect($parentScope.updateInterval.getCall(1).args[0]).to.have.property('pause', false);
$scope.setRefreshInterval({ value : 1000 });
$scope.setRefreshInterval({ value: 1000 });
expect($parentScope.updateInterval.getCall(2).args[0]).to.have.property('pause', false);
});

View file

@ -38,7 +38,7 @@ describe('doc table filter actions', function () {
expect(filterManager.add.calledWith(...args)).to.be(true);
});
it('should add an operator style "is" function to kuery queries' , function () {
it('should add an operator style "is" function to kuery queries', function () {
const state = {
query: { query: '', language: 'kuery' }
};
@ -46,7 +46,7 @@ describe('doc table filter actions', function () {
expect(state.query.query).to.be('"foo":"bar"');
});
it('should combine the new clause with any existing query clauses using an implicit "and"' , function () {
it('should combine the new clause with any existing query clauses using an implicit "and"', function () {
const state = {
query: { query: 'foo', language: 'kuery' }
};
@ -54,7 +54,7 @@ describe('doc table filter actions', function () {
expect(state.query.query).to.be('foo "foo":"bar"');
});
it('should support creation of negated clauses' , function () {
it('should support creation of negated clauses', function () {
const state = {
query: { query: 'foo', language: 'kuery' }
};
@ -62,7 +62,7 @@ describe('doc table filter actions', function () {
expect(state.query.query).to.be('foo !"foo":"bar"');
});
it('should add an exists query when the provided field name is "_exists_"' , function () {
it('should add an exists query when the provided field name is "_exists_"', function () {
const state = {
query: { query: 'foo', language: 'kuery' }
};

View file

@ -25,7 +25,7 @@ describe('Filter Bar pushFilter()', function () {
let filter;
beforeEach(ngMock.inject(function () {
$state = { $newFilters:[] };
$state = { $newFilters: [] };
pushFilter = pushFilterFn($state);
filter = { query: { query_string: { query: '' } } };
}));

View file

@ -22,7 +22,7 @@ describe('Filter Bar Directive', function () {
it('should return the matching filter for the defualt time field', function (done) {
const filters = [
{ meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } },
{ meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } },
{ meta: { index: 'logstash-*' }, range: { 'time': { gt: 1388559600000, lt: 1388646000000 } } }
];
extractTimeFilter(filters).then(function (filter) {
@ -34,7 +34,7 @@ describe('Filter Bar Directive', function () {
it('should not return the non-matching filter for the defualt time field', function (done) {
const filters = [
{ meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } },
{ meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } },
{ meta: { index: 'logstash-*' }, range: { '@timestamp': { gt: 1388559600000, lt: 1388646000000 } } }
];
extractTimeFilter(filters).then(function (filter) {

View file

@ -23,7 +23,7 @@ describe('Filter Bar Directive', function () {
it('should return the matching filter for the defualt time field', function (done) {
const filters = [
{ meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } },
{ meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } },
{ meta: { index: 'logstash-*' }, range: { 'time': { gt: 1388559600000, lt: 1388646000000 } } }
];
filterOutTimeBasedFilter(filters).then(function (results) {

View file

@ -457,7 +457,7 @@ describe('index pattern', function () {
expect(notif).to.have.property('type', 'warning');
expect(notif.content).to.match(MARKDOWN_LINK_RE);
const [,text,url] = notif.content.match(MARKDOWN_LINK_RE);
const [, text, url] = notif.content.match(MARKDOWN_LINK_RE);
expect(text).to.contain(indexPattern.title);
expect(url).to.contain(indexPattern.id);
expect(url).to.contain('management/kibana/indices');

View file

@ -6,7 +6,7 @@ import { IndexedArray } from 'ui/indexed_array';
// this is generally a data-structure that IndexedArray is good for managing
const users = [
{ name: 'John', id: 69, username: 'beast', group: 'admins' },
{ name: 'Anon', id: 0, username: 'shhhh', group: 'secret' },
{ name: 'Anon', id: 0, username: 'shhhh', group: 'secret' },
{ name: 'Fern', id: 42, username: 'kitty', group: 'editor' },
{ name: 'Mary', id: 55, username: 'sheep', group: 'editor' }
];

View file

@ -7,7 +7,7 @@ export function buildNodeParams(fieldName) {
}
export function toElasticsearchQuery(node, indexPattern) {
const { arguments: [ fieldNameArg ] } = node;
const { arguments: [ fieldNameArg ] } = node;
const fieldName = literal.toElasticsearchQuery(fieldNameArg);
const field = indexPattern.fields.byName[fieldName];

View file

@ -17,7 +17,7 @@ export function buildNodeParams(fieldName, value, serializeStyle = 'operator') {
}
export function toElasticsearchQuery(node, indexPattern) {
const { arguments: [ fieldNameArg, valueArg ] } = node;
const { arguments: [ fieldNameArg, valueArg ] } = node;
const fieldName = literal.toElasticsearchQuery(fieldNameArg);
const field = indexPattern.fields.byName[fieldName];
const value = !_.isUndefined(valueArg) ? literal.toElasticsearchQuery(valueArg) : valueArg;
@ -61,7 +61,7 @@ export function toKueryExpression(node) {
throw new Error(`Cannot serialize "is" function as "${node.serializeStyle}"`);
}
const { arguments: [ fieldNameArg, valueArg ] } = node;
const { arguments: [ fieldNameArg, valueArg ] } = node;
const fieldName = literal.toKueryExpression(fieldNameArg);
const value = !_.isUndefined(valueArg) ? literal.toKueryExpression(valueArg) : valueArg;

View file

@ -21,10 +21,10 @@ describe('formatESMsg', function () {
it('should return the root_cause if passed an extended elasticsearch', function () {
const err = new Error('This is an elasticsearch error');
err.resp = {
error : {
root_cause : [
error: {
root_cause: [
{
reason : 'I am the detailed message'
reason: 'I am the detailed message'
}
]
}
@ -38,13 +38,13 @@ describe('formatESMsg', function () {
it('should combine the reason messages if more than one is returned.', function () {
const err = new Error('This is an elasticsearch error');
err.resp = {
error : {
root_cause : [
error: {
root_cause: [
{
reason : 'I am the detailed message 1'
reason: 'I am the detailed message 1'
},
{
reason : 'I am the detailed message 2'
reason: 'I am the detailed message 2'
}
]
}

View file

@ -39,11 +39,11 @@ describe('formatMsg', function () {
it('should handle an extended elasticsearch error', function () {
const err = {
resp : {
error : {
root_cause : [
resp: {
error: {
root_cause: [
{
reason : 'I am the detailed message'
reason: 'I am the detailed message'
}
]
}

View file

@ -14,7 +14,7 @@ describe('Notifier', function () {
const customText = 'fooMarkup';
const customParams = {
title: 'fooTitle',
actions:[{
actions: [{
text: 'Cancel',
callback: sinon.spy()
}, {
@ -449,7 +449,7 @@ describe('Directive Notification', function () {
};
const customParams = {
title: 'fooTitle',
actions:[{
actions: [{
text: 'Cancel',
callback: sinon.spy()
}, {

View file

@ -114,7 +114,7 @@ describe('Promise service', function () {
expect(time).to.not.be.greaterThan(2000);
});
it('allows non-promises in the array', async () => {
expect(await Promise.race([1,2,3])).to.be(1);
expect(await Promise.race([1, 2, 3])).to.be(1);
});
describe('argument is undefined', () => {
it('rejects the promise', async () => {

View file

@ -89,7 +89,7 @@ uiModules
if (timefield) {
const bounds = this.getBounds();
filter = { range : {} };
filter = { range: {} };
filter.range[timefield.name] = {
gte: range ? range.min.valueOf() : bounds.min.valueOf(),
lte: range ? range.max.valueOf() : bounds.max.valueOf(),

View file

@ -2,21 +2,21 @@ import { uiModules } from 'ui/modules';
const module = uiModules.get('kibana');
module.constant('refreshIntervals', [
{ value : 0, display: 'Off', section: 0 },
{ value: 0, display: 'Off', section: 0 },
{ value : 5000, display: '5 seconds', section: 1 },
{ value : 10000, display: '10 seconds', section: 1 },
{ value : 30000, display: '30 seconds', section: 1 },
{ value : 45000, display: '45 seconds', section: 1 },
{ value: 5000, display: '5 seconds', section: 1 },
{ value: 10000, display: '10 seconds', section: 1 },
{ value: 30000, display: '30 seconds', section: 1 },
{ value: 45000, display: '45 seconds', section: 1 },
{ value : 60000, display: '1 minute', section: 2 },
{ value : 300000, display: '5 minutes', section: 2 },
{ value : 900000, display: '15 minutes', section: 2 },
{ value : 1800000, display: '30 minutes', section: 2 },
{ value: 60000, display: '1 minute', section: 2 },
{ value: 300000, display: '5 minutes', section: 2 },
{ value: 900000, display: '15 minutes', section: 2 },
{ value: 1800000, display: '30 minutes', section: 2 },
{ value : 3600000, display: '1 hour', section: 3 },
{ value : 7200000, display: '2 hour', section: 3 },
{ value : 43200000, display: '12 hour', section: 3 },
{ value : 86400000, display: '1 day', section: 3 }
{ value: 3600000, display: '1 hour', section: 3 },
{ value: 7200000, display: '2 hour', section: 3 },
{ value: 43200000, display: '12 hour', section: 3 },
{ value: 86400000, display: '1 day', section: 3 }
]);

View file

@ -181,7 +181,7 @@ module.directive('kbnTimepicker', function (timeUnits, refreshIntervals) {
$scope.applyRelative = function () {
$scope.onFilterSelect({
from: getRelativeString('from'),
to: getRelativeString('to')
to: getRelativeString('to')
});
};

View file

@ -27,7 +27,7 @@ describe('brushEvent', function () {
let brushEvent;
const baseState = {
filters:[],
filters: [],
};
const baseEvent = {
@ -169,7 +169,7 @@ describe('brushEvent', function () {
it('by creating a new filter', function () {
const event = _.cloneDeep(numberEvent);
event.range = [1,2,3,4];
event.range = [1, 2, 3, 4];
brushEvent(event);
expect($state)
.to.have.property('$newFilters');
@ -186,7 +186,7 @@ describe('brushEvent', function () {
it('by updating the existing range filter', function () {
const event = _.cloneDeep(numberEvent);
event.range = [3,7];
event.range = [3, 7];
$state.filters.push({
meta: {
key: 'numberField'
@ -206,7 +206,7 @@ describe('brushEvent', function () {
it('by updating the existing scripted filter', function () {
const event = _.cloneDeep(numberEvent);
event.range = [3,7];
event.range = [3, 7];
$state.filters.push({
meta: {
key: 'numberField'

View file

@ -32,7 +32,7 @@ describe('Scanner', function () {
let search;
let scroll;
let scanner;
const mockSearch = { '_scroll_id':'abc','took':1,'timed_out':false,'_shards':{ 'total':1,'successful':1,'failed':0 },'hits':{ 'total':2,'max_score':0.0,'hits':[] } }; // eslint-disable-line max-len
const mockSearch = { '_scroll_id': 'abc', 'took': 1, 'timed_out': false, '_shards': { 'total': 1, 'successful': 1, 'failed': 0 }, 'hits': { 'total': 2, 'max_score': 0.0, 'hits': [] } }; // eslint-disable-line max-len
const hits = [{
_id: 'one',
_type: 'config',
@ -42,7 +42,7 @@ describe('Scanner', function () {
_type: 'config',
_source: { title: 'Second title' }
}];
const mockScroll = { 'took':1,'timed_out':false,'_shards':{ 'total':1,'successful':1,'failed':0 },'hits':{ 'total':2,'max_score':0.0,'hits':hits } }; // eslint-disable-line max-len
const mockScroll = { 'took': 1, 'timed_out': false, '_shards': { 'total': 1, 'successful': 1, 'failed': 0 }, 'hits': { 'total': 2, 'max_score': 0.0, 'hits': hits } }; // eslint-disable-line max-len
beforeEach(function () {
scanner = new Scanner(http, {
@ -103,7 +103,7 @@ describe('Scanner', function () {
});
it('should scroll across multiple pages', function () {
const oneResult = { 'took':1,'timed_out':false,'_shards':{ 'total':1,'successful':1,'failed':0 },'hits':{ 'total':2,'max_score':0.0,'hits':['one'] } }; // eslint-disable-line max-len
const oneResult = { 'took': 1, 'timed_out': false, '_shards': { 'total': 1, 'successful': 1, 'failed': 0 }, 'hits': { 'total': 2, 'max_score': 0.0, 'hits': ['one'] } }; // eslint-disable-line max-len
scroll = sinon.stub().returns(Promise.resolve({ data: oneResult }));
return scanner.scanAndMap(null, { pageSize: 1 })
.then(function (response) {

View file

@ -289,7 +289,7 @@ describe('AggConfig', function () {
}
]
}
},{
}, {
config1: {
type: 'metric',
aggs: [

View file

@ -178,7 +178,7 @@ describe('service_settings (FKA tilemaptest)', function () {
it('should load manifest', async function () {
serviceSettings.addQueryParams({ foo:'bar' });
serviceSettings.addQueryParams({ foo: 'bar' });
const fileLayers = await serviceSettings.getFileLayers();
fileLayers.forEach(function (fileLayer, index) {
const expected = vectorManifest.layers[index];
@ -189,7 +189,7 @@ describe('service_settings (FKA tilemaptest)', function () {
expect(expected.created_at).to.eql(fileLayer.created_at);
const urlObject = url.parse(fileLayer.url, true);
Object.keys({ foo:'bar', elastic_tile_service_tos: 'agree' }).forEach(key => {
Object.keys({ foo: 'bar', elastic_tile_service_tos: 'agree' }).forEach(key => {
expect(urlObject.query).to.have.property(key, expected[key]);
});

View file

@ -17,15 +17,15 @@ describe('Vislib Split Function Test Suite', function () {
const data = {
rows: [
{
hits : 621,
label : '',
ordered : {
date : true,
hits: 621,
label: '',
ordered: {
date: true,
interval: 30000,
max : 1408734982458,
min : 1408734082458
max: 1408734982458,
min: 1408734082458
},
series : [
series: [
{
values: [
{
@ -75,15 +75,15 @@ describe('Vislib Split Function Test Suite', function () {
yAxisLabel: 'Count'
},
{
hits : 621,
label : '',
ordered : {
date : true,
hits: 621,
label: '',
ordered: {
date: true,
interval: 30000,
max : 1408734982458,
min : 1408734082458
max: 1408734982458,
min: 1408734082458
},
series : [
series: [
{
values: [
{

View file

@ -13,15 +13,15 @@ describe('Vislib Gauge Split Function Test Suite', function () {
const data = {
rows: [
{
hits : 621,
label : '',
ordered : {
date : true,
hits: 621,
label: '',
ordered: {
date: true,
interval: 30000,
max : 1408734982458,
min : 1408734082458
max: 1408734982458,
min: 1408734082458
},
series : [
series: [
{
values: [
{
@ -71,15 +71,15 @@ describe('Vislib Gauge Split Function Test Suite', function () {
yAxisLabel: 'Count'
},
{
hits : 621,
label : '',
ordered : {
date : true,
hits: 621,
label: '',
ordered: {
date: true,
interval: 30000,
max : 1408734982458,
min : 1408734082458
max: 1408734982458,
min: 1408734082458
},
series : [
series: [
{
values: [
{

View file

@ -14,15 +14,15 @@ describe('Vislib _chart Test Suite', function () {
let myChart;
let config;
const data = {
hits : 621,
label : '',
ordered : {
hits: 621,
label: '',
ordered: {
date: true,
interval: 30000,
max : 1408734982458,
min : 1408734082458
max: 1408734982458,
min: 1408734082458
},
series : [
series: [
{
values: [
{

View file

@ -84,9 +84,9 @@ export function VislibTypesPointSeries() {
type: config.scale,
setYExtents: config.setYExtents,
defaultYExtents: config.defaultYExtents,
min : isUserDefinedYAxis ? config.yAxis.min : undefined,
max : isUserDefinedYAxis ? config.yAxis.max : undefined,
mode : mode
min: isUserDefinedYAxis ? config.yAxis.min : undefined,
max: isUserDefinedYAxis ? config.yAxis.max : undefined,
mode: mode
},
labels: {
axisFormatter: data.data.yAxisFormatter || data.get('yAxisFormatter')
@ -196,7 +196,7 @@ export function VislibTypesPointSeries() {
},
labels: {
filter: false,
axisFormatter: function (val) { return val; }
axisFormatter: function (val) { return val; }
},
style: {
rangePadding: 0,

Some files were not shown because too many files have changed in this diff Show more