diff --git a/.eslintignore b/.eslintignore index 0de6d839dc2ba..5977eaa26a1f9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,6 @@ - -test/fixtures/scenarios -optimize +/optimize +src/fixtures/vislib/mock_data +src/ui/public/angular-bootstrap test/fixtures/scenarios +src/core_plugins/console +src/ui/public/utils/decode_geo_hash.js diff --git a/.eslintrc b/.eslintrc index 7a623df06a6ca..5926c4051ea4f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,2 +1,5 @@ --- extends: '@elastic/kibana' + +rules: + object-curly-spacing: [error, always] diff --git a/Gruntfile.js b/Gruntfile.js index 02d9ae9a78452..69aefb22577f4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,4 +1,3 @@ -const camelCase = require('lodash').camelCase; require('babel/register')(require('./src/optimize/babel_options').node); module.exports = function (grunt) { @@ -41,12 +40,12 @@ module.exports = function (grunt) { lintThese: [ 'Gruntfile.js', - '<%= root %>/tasks/**/*.js', - '<%= root %>/test/**/*.js', - '<%= src %>/**/*.js', - '!<%= src %>/ui/public/angular-bootstrap/**/*.js', - '!<%= src %>/fixtures/**/*.js', - '!<%= root %>/test/fixtures/scenarios/**/*.js' + 'bin', + 'config', + 'src', + 'tasks', + 'test', + 'utilities', ], deepModules: { 'caniuse-db': '1.0.30000265', diff --git a/package.json b/package.json index 683d4fed98ec9..2449a1f49b8a7 100644 --- a/package.json +++ b/package.json @@ -154,16 +154,16 @@ "wreck": "6.2.0" }, "devDependencies": { - "@elastic/eslint-config-kibana": "0.0.3", + "@elastic/eslint-config-kibana": "0.2.0", "Nonsense": "0.1.2", "angular-mocks": "1.4.7", "auto-release-sinon": "1.0.3", - "babel-eslint": "4.1.8", + "babel-eslint": "6.1.2", "chokidar": "1.6.0", "chromedriver": "2.22.1", "elasticdump": "2.1.1", - "eslint": "1.10.3", - "eslint-plugin-mocha": "1.1.0", + "eslint": "3.3.1", + "eslint-plugin-mocha": "4.4.0", "event-stream": "3.3.2", "expect.js": "0.3.1", "faker": "1.1.0", @@ -177,7 +177,7 @@ "grunt-karma": "2.0.0", "grunt-run": "0.6.0", "grunt-simple-mocha": "0.4.0", - "gruntify-eslint": "1.0.1", + "gruntify-eslint": "3.0.0", "handlebars": "4.0.5", "husky": "0.8.1", "image-diff": "1.6.0", diff --git a/src/cli/cli.js b/src/cli/cli.js index f25608dec1cf7..b53dc922b67b0 100644 --- a/src/cli/cli.js +++ b/src/cli/cli.js @@ -27,7 +27,7 @@ program program .command('*', null, { noHelp: true }) -.action(function (cmd, options) { +.action(function (cmd) { program.error(`unknown command ${cmd}`); }); diff --git a/src/cli/cluster/__tests__/_mock_cluster_fork.js b/src/cli/cluster/__tests__/_mock_cluster_fork.js index 2671ca08bdb9a..0915d172a4cd6 100644 --- a/src/cli/cluster/__tests__/_mock_cluster_fork.js +++ b/src/cli/cluster/__tests__/_mock_cluster_fork.js @@ -24,7 +24,7 @@ export default class MockClusterFork extends EventEmitter { dead = true; this.emit('exit'); cluster.emit('exit', this, this.exitCode || 0); - }()); + })(); }), }, isDead: sinon.spy(() => dead), @@ -39,6 +39,6 @@ export default class MockClusterFork extends EventEmitter { await wait(); dead = false; this.emit('online'); - }()); + })(); } } diff --git a/src/cli/cluster/__tests__/cluster_manager.js b/src/cli/cluster/__tests__/cluster_manager.js index ae9ef7080981a..13184056c2b28 100644 --- a/src/cli/cluster/__tests__/cluster_manager.js +++ b/src/cli/cluster/__tests__/cluster_manager.js @@ -1,8 +1,7 @@ import expect from 'expect.js'; import sinon from 'auto-release-sinon'; import cluster from 'cluster'; -import { ChildProcess } from 'child_process'; -import { sample, difference } from 'lodash'; +import { sample } from 'lodash'; import ClusterManager from '../cluster_manager'; import Worker from '../worker'; diff --git a/src/cli/cluster/__tests__/worker.js b/src/cli/cluster/__tests__/worker.js index 4d8f4f53af148..b84b92d76e460 100644 --- a/src/cli/cluster/__tests__/worker.js +++ b/src/cli/cluster/__tests__/worker.js @@ -1,9 +1,7 @@ import expect from 'expect.js'; import sinon from 'auto-release-sinon'; import cluster from 'cluster'; -import { ChildProcess } from 'child_process'; -import { difference, findIndex, sample } from 'lodash'; -import { fromNode as fn } from 'bluebird'; +import { findIndex } from 'lodash'; import MockClusterFork from './_mock_cluster_fork'; import Worker from '../worker'; @@ -96,7 +94,7 @@ describe('CLI cluster manager', function () { describe('#parseIncomingMessage()', function () { context('on a started worker', function () { - it(`is bound to fork's message event`, async function () { + it('is bound to fork\'s message event', async function () { const worker = setup(); await worker.start(); sinon.assert.calledWith(worker.fork.on, 'message'); @@ -135,7 +133,6 @@ describe('CLI cluster manager', function () { context('when sent WORKER_LISTENING message', function () { it('sets the listening flag and emits the listening event', function () { const worker = setup(); - const data = {}; const stub = sinon.stub(worker, 'emit'); expect(worker).to.have.property('listening', false); worker.onMessage('WORKER_LISTENING'); diff --git a/src/cli/cluster/base_path_proxy.js b/src/cli/cluster/base_path_proxy.js index 803afeffdc36e..0db4afe2a2f8b 100644 --- a/src/cli/cluster/base_path_proxy.js +++ b/src/cli/cluster/base_path_proxy.js @@ -1,6 +1,6 @@ import { Server } from 'hapi'; import { notFound } from 'boom'; -import { merge, sample } from 'lodash'; +import { sample } from 'lodash'; import { format as formatUrl } from 'url'; import { map, fromNode } from 'bluebird'; import { Agent as HttpsAgent } from 'https'; @@ -103,9 +103,9 @@ export default class BasePathProxy { server.route({ method: '*', - path: `/{oldBasePath}/{kbnPath*}`, + path: '/{oldBasePath}/{kbnPath*}', handler(req, reply) { - const {oldBasePath, kbnPath = ''} = req.params; + const { oldBasePath, kbnPath = '' } = req.params; const isGet = req.method === 'get'; const isBasePath = oldBasePath.length === 3; diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index 685c64db1246f..e4aecc1595dce 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -1,8 +1,13 @@ -import cluster from 'cluster'; -const { join, resolve } = require('path'); -const { format: formatUrl } = require('url'); -import Hapi from 'hapi'; -const { debounce, compact, get, invoke, bindAll, once, sample, uniq } = require('lodash'); +const { + resolve +} = require('path'); +const { + debounce, + invoke, + bindAll, + once, + uniq +} = require('lodash'); import Log from '../log'; import Worker from './worker'; @@ -85,19 +90,16 @@ module.exports = class ClusterManager { const chokidar = require('chokidar'); const fromRoot = require('../../utils/from_root'); - const watchPaths = uniq( - [ - fromRoot('src/core_plugins'), - fromRoot('src/server'), - fromRoot('src/ui'), - fromRoot('src/utils'), - fromRoot('config'), - ...extraPaths - ] - .map(path => resolve(path)) - ); - - this.watcher = chokidar.watch(watchPaths, { + const watchPaths = [ + fromRoot('src/core_plugins'), + fromRoot('src/server'), + fromRoot('src/ui'), + fromRoot('src/utils'), + fromRoot('config'), + ...extraPaths + ].map(path => resolve(path)); + + this.watcher = chokidar.watch(uniq(watchPaths), { cwd: fromRoot('.'), ignored: /[\\\/](\..*|node_modules|bower_components|public|__tests__)[\\\/]/ }); @@ -126,7 +128,7 @@ module.exports = class ClusterManager { rl.setPrompt(''); rl.prompt(); - rl.on('line', line => { + rl.on('line', () => { nls = nls + 1; if (nls >= 2) { diff --git a/src/cli/cluster/worker.js b/src/cli/cluster/worker.js index 4108627edea65..2c16ecf411154 100644 --- a/src/cli/cluster/worker.js +++ b/src/cli/cluster/worker.js @@ -1,20 +1,19 @@ import _ from 'lodash'; import cluster from 'cluster'; -import { resolve } from 'path'; import { EventEmitter } from 'events'; import { BinderFor, fromRoot } from '../../utils'; -let cliPath = fromRoot('src/cli'); -let baseArgs = _.difference(process.argv.slice(2), ['--no-watch']); -let baseArgv = [process.execPath, cliPath].concat(baseArgs); +const cliPath = fromRoot('src/cli'); +const baseArgs = _.difference(process.argv.slice(2), ['--no-watch']); +const baseArgv = [process.execPath, cliPath].concat(baseArgs); cluster.setupMaster({ exec: cliPath, silent: false }); -let dead = fork => { +const dead = fork => { return fork.isDead() || fork.killed; }; @@ -40,7 +39,7 @@ module.exports = class Worker extends EventEmitter { this.clusterBinder = new BinderFor(cluster); this.processBinder = new BinderFor(process); - let argv = _.union(baseArgv, opts.argv || []); + const argv = _.union(baseArgv, opts.argv || []); this.env = { kbnWorkerType: this.type, kbnWorkerArgv: JSON.stringify(argv) @@ -124,8 +123,8 @@ module.exports = class Worker extends EventEmitter { } flushChangeBuffer() { - let files = _.unique(this.changes.splice(0)); - let prefix = files.length > 1 ? '\n - ' : ''; + const files = _.unique(this.changes.splice(0)); + const prefix = files.length > 1 ? '\n - ' : ''; return files.reduce(function (list, file) { return `${list || ''}${prefix}"${file}"`; }, ''); diff --git a/src/cli/command.js b/src/cli/command.js index 135d03e32b6c1..27e65a4e832d0 100644 --- a/src/cli/command.js +++ b/src/cli/command.js @@ -3,7 +3,6 @@ import _ from 'lodash'; import help from './help'; import { Command } from 'commander'; import { red } from './color'; -import { yellow } from './color'; Command.prototype.error = function (err) { if (err && err.message) err = err.message; @@ -40,15 +39,15 @@ Command.prototype.unknownArgv = function (argv) { * @return {[type]} [description] */ Command.prototype.collectUnknownOptions = function () { - let title = `Extra ${this._name} options`; + const title = `Extra ${this._name} options`; this.allowUnknownOption(); this.getUnknownOptions = function () { - let opts = {}; - let unknowns = this.unknownArgv(); + const opts = {}; + const unknowns = this.unknownArgv(); while (unknowns.length) { - let opt = unknowns.shift().split('='); + const opt = unknowns.shift().split('='); if (opt[0].slice(0, 2) !== '--') { this.error(`${title} "${opt[0]}" must start with "--"`); } @@ -75,14 +74,14 @@ Command.prototype.collectUnknownOptions = function () { }; Command.prototype.parseOptions = _.wrap(Command.prototype.parseOptions, function (parse, argv) { - let opts = parse.call(this, argv); + const opts = parse.call(this, argv); this.unknownArgv(opts.unknown); return opts; }); Command.prototype.action = _.wrap(Command.prototype.action, function (action, fn) { return action.call(this, function (...args) { - let ret = fn.apply(this, args); + const ret = fn.apply(this, args); if (ret && typeof ret.then === 'function') { ret.then(null, function (e) { console.log('FATAL CLI ERROR', e.stack); diff --git a/src/cli/help.js b/src/cli/help.js index 89bc90a24cbd6..b5078aad458fe 100644 --- a/src/cli/help.js +++ b/src/cli/help.js @@ -5,12 +5,12 @@ module.exports = function (command, spaces) { return command.outputHelp(); } - let defCmd = _.find(command.commands, function (cmd) { + const defCmd = _.find(command.commands, function (cmd) { return cmd._name === 'serve'; }); - let desc = !command.description() ? '' : command.description(); - let cmdDef = !defCmd ? '' : `=${defCmd._name}`; + const desc = !command.description() ? '' : command.description(); + const cmdDef = !defCmd ? '' : `=${defCmd._name}`; return ( ` @@ -31,11 +31,11 @@ function indent(str, n) { } function commandsSummary(program) { - let cmds = _.compact(program.commands.map(function (cmd) { - let name = cmd._name; + const cmds = _.compact(program.commands.map(function (cmd) { + const name = cmd._name; if (name === '*') return; - let opts = cmd.options.length ? ' [options]' : ''; - let args = cmd._args.map(function (arg) { + const opts = cmd.options.length ? ' [options]' : ''; + const args = cmd._args.map(function (arg) { return humanReadableArgName(arg); }).join(' '); @@ -45,7 +45,7 @@ function commandsSummary(program) { ]; })); - let cmdLColWidth = cmds.reduce(function (width, cmd) { + const cmdLColWidth = cmds.reduce(function (width, cmd) { return Math.max(width, cmd[0].length); }, 0); @@ -69,6 +69,6 @@ ${indent(cmd.optionHelp(), 2)} } function humanReadableArgName(arg) { - let nameOutput = arg.name + (arg.variadic === true ? '...' : ''); + const nameOutput = arg.name + (arg.variadic === true ? '...' : ''); return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']'; } diff --git a/src/cli/log.js b/src/cli/log.js index bbbe3f2f21e89..584c27d5f9857 100644 --- a/src/cli/log.js +++ b/src/cli/log.js @@ -1,7 +1,6 @@ import _ from 'lodash'; -import ansicolors from 'ansicolors'; -let log = _.restParam(function (color, label, rest1) { +const log = _.restParam(function (color, label, rest1) { console.log.apply(console, [color(` ${_.trim(label)} `)].concat(rest1)); }); diff --git a/src/cli/serve/__tests__/read_yaml_config.js b/src/cli/serve/__tests__/read_yaml_config.js index 29b620b27dbb0..e5743445f7f87 100644 --- a/src/cli/serve/__tests__/read_yaml_config.js +++ b/src/cli/serve/__tests__/read_yaml_config.js @@ -9,7 +9,7 @@ function fixture(name) { describe('cli/serve/read_yaml_config', function () { it('reads a single config file', function () { - const config = readYamlConfig(fixture('one.yml')); + readYamlConfig(fixture('one.yml')); expect(readYamlConfig(fixture('one.yml'))).to.eql({ foo: 1, diff --git a/src/cli/serve/__tests__/reload_logging_config.js b/src/cli/serve/__tests__/reload_logging_config.js index 721ebad27b84b..d0c7a032c889a 100644 --- a/src/cli/serve/__tests__/reload_logging_config.js +++ b/src/cli/serve/__tests__/reload_logging_config.js @@ -1,13 +1,13 @@ import { spawn } from 'child_process'; -import { writeFileSync, readFile } from 'fs'; +import { writeFileSync } from 'fs'; import { relative, resolve } from 'path'; import { safeDump } from 'js-yaml'; import es from 'event-stream'; import readYamlConfig from '../read_yaml_config'; import expect from 'expect.js'; -const testConfigFile = follow(`fixtures/reload_logging_config/kibana.test.yml`); -const cli = follow(`../../../../bin/kibana`); +const testConfigFile = follow('fixtures/reload_logging_config/kibana.test.yml'); +const cli = follow('../../../../bin/kibana'); function follow(file) { return relative(process.cwd(), resolve(__dirname, file)); @@ -22,19 +22,19 @@ function setLoggingJson(enabled) { return conf; } -describe(`Server logging configuration`, function () { +describe('Server logging configuration', function () { const isWindows = /^win/.test(process.platform); if (isWindows) { it('SIGHUP is not a feature of Windows.'); } else { - it(`should be reloadable via SIGHUP process signaling`, function (done) { + it('should be reloadable via SIGHUP process signaling', function (done) { this.timeout(60000); let asserted = false; let json = Infinity; - const conf = setLoggingJson(true); - const child = spawn(cli, [`--config`, testConfigFile]); + setLoggingJson(true); + const child = spawn(cli, ['--config', testConfigFile]); child.on('error', err => { done(new Error(`error in child process while attempting to reload config. ${err.stack || err.message || err}`)); @@ -62,7 +62,7 @@ describe(`Server logging configuration`, function () { function parseJsonLogLine(line) { try { const data = JSON.parse(line); - const listening = data.tags.indexOf(`listening`) !== -1; + const listening = data.tags.indexOf('listening') !== -1; if (listening) { switchToPlainTextLog(); } @@ -74,13 +74,13 @@ describe(`Server logging configuration`, function () { function switchToPlainTextLog() { json = 3; // ignore both "reloading" messages + ui settings status message setLoggingJson(false); - child.kill(`SIGHUP`); // reload logging config + child.kill('SIGHUP'); // reload logging config } function expectPlainTextLogLine(line) { // assert - const tags = `[\u001b[32minfo\u001b[39m][\u001b[36mconfig\u001b[39m]`; - const status = `Reloaded logging configuration due to SIGHUP.`; + const tags = '[\u001b[32minfo\u001b[39m][\u001b[36mconfig\u001b[39m]'; + const status = 'Reloaded logging configuration due to SIGHUP.'; const expected = `${tags} ${status}`; const actual = line.slice(-expected.length); expect(actual).to.eql(expected); diff --git a/src/cli/serve/deprecated_config.js b/src/cli/serve/deprecated_config.js index d0ec271a8cee8..d5203ada10c78 100644 --- a/src/cli/serve/deprecated_config.js +++ b/src/cli/serve/deprecated_config.js @@ -1,4 +1,4 @@ -import { forOwn, has, noop } from 'lodash'; +import { has, noop } from 'lodash'; // deprecated settings are still allowed, but will be removed at a later time. They // are checked for after the config object is prepared and known, so legacySettings diff --git a/src/cli/serve/read_yaml_config.js b/src/cli/serve/read_yaml_config.js index 18e3a4520e875..4cf1f2c2a3d9b 100644 --- a/src/cli/serve/read_yaml_config.js +++ b/src/cli/serve/read_yaml_config.js @@ -1,9 +1,8 @@ -import { chain, isArray, isPlainObject, forOwn, memoize, set, transform } from 'lodash'; +import { isArray, isPlainObject, forOwn, memoize, set, transform } from 'lodash'; import { readFileSync as read } from 'fs'; import { safeLoad } from 'js-yaml'; import { red } from 'ansicolors'; -import { fromRoot } from '../../utils'; import { rewriteLegacyConfig } from './legacy_config'; import { checkForDeprecatedConfig } from './deprecated_config'; diff --git a/src/cli_plugin/cli.js b/src/cli_plugin/cli.js index 5a09416a9cb1a..5d3dd2f702267 100644 --- a/src/cli_plugin/cli.js +++ b/src/cli_plugin/cli.js @@ -5,8 +5,8 @@ import listCommand from './list'; import installCommand from './install'; import removeCommand from './remove'; -let argv = process.env.kbnWorkerArgv ? JSON.parse(process.env.kbnWorkerArgv) : process.argv.slice(); -let program = new Command('bin/kibana-plugin'); +const argv = process.env.kbnWorkerArgv ? JSON.parse(process.env.kbnWorkerArgv) : process.argv.slice(); +const program = new Command('bin/kibana-plugin'); program .version(pkg.version) @@ -23,19 +23,19 @@ program .command('help ') .description('get the help for a specific command') .action(function (cmdName) { - let cmd = _.find(program.commands, { _name: cmdName }); + const cmd = _.find(program.commands, { _name: cmdName }); if (!cmd) return program.error(`unknown command ${cmdName}`); cmd.help(); }); program .command('*', null, { noHelp: true }) -.action(function (cmd, options) { +.action(function (cmd) { program.error(`unknown command ${cmd}`); }); // check for no command name -let subCommand = argv[2] && !String(argv[2][0]).match(/^-|^\.|\//); +const subCommand = argv[2] && !String(argv[2][0]).match(/^-|^\.|\//); if (!subCommand) { program.defaultHelp(); } diff --git a/src/cli_plugin/install/__tests__/cleanup.js b/src/cli_plugin/install/__tests__/cleanup.js index c8812c8dedf8f..ca50f9bd81229 100644 --- a/src/cli_plugin/install/__tests__/cleanup.js +++ b/src/cli_plugin/install/__tests__/cleanup.js @@ -16,21 +16,14 @@ describe('kibana cli', function () { }; describe('cleanPrevious', function () { - let cleaner; let errorStub; let logger; - let progress; - let request; beforeEach(function () { errorStub = sinon.stub(); logger = new Logger(settings); sinon.stub(logger, 'log'); sinon.stub(logger, 'error'); - request = { - abort: sinon.stub(), - emit: sinon.stub() - }; }); afterEach(function () { @@ -50,7 +43,7 @@ describe('kibana cli', function () { return cleanPrevious(settings, logger) .catch(errorStub) - .then(function (data) { + .then(function () { expect(errorStub.called).to.be(false); }); }); @@ -76,7 +69,7 @@ describe('kibana cli', function () { return cleanPrevious(settings, logger) .catch(errorStub) - .then(function (data) { + .then(function () { expect(logger.log.calledWith('Found previous install attempt. Deleting...')).to.be(true); }); }); @@ -101,20 +94,13 @@ describe('kibana cli', function () { return cleanPrevious(settings, logger) .catch(errorStub) - .then(function (data) { + .then(function () { expect(errorStub.called).to.be(false); }); }); - }); describe('cleanArtifacts', function () { - let logger; - - beforeEach(function () { - logger = new Logger(settings); - }); - afterEach(function () { rimraf.sync.restore(); }); @@ -133,7 +119,6 @@ describe('kibana cli', function () { expect(cleanArtifacts).withArgs(settings).to.not.throwError(); }); - }); }); diff --git a/src/cli_plugin/install/__tests__/download.js b/src/cli_plugin/install/__tests__/download.js index d38728fe25578..eb2b52de1325e 100644 --- a/src/cli_plugin/install/__tests__/download.js +++ b/src/cli_plugin/install/__tests__/download.js @@ -62,7 +62,7 @@ describe('kibana cli', function () { describe('http downloader', function () { it('should throw an ENOTFOUND error for a http ulr that returns 404', function () { - const couchdb = nock('http://example.com') + nock('http://example.com') .get('/plugin.tar.gz') .reply(404); @@ -88,7 +88,7 @@ describe('kibana cli', function () { it('should download a file from a valid http url', function () { const filePath = join(__dirname, 'replies/banana.jpg'); - const couchdb = nock('http://example.com') + nock('http://example.com') .defaultReplyHeaders({ 'content-length': '341965', 'content-type': 'application/zip' @@ -143,7 +143,7 @@ describe('kibana cli', function () { 'http://example.com/goodfile.tar.gz' ]; - const couchdb = nock('http://example.com') + nock('http://example.com') .defaultReplyHeaders({ 'content-length': '10' }) @@ -173,7 +173,7 @@ describe('kibana cli', function () { 'http://example.com/badfile3.tar.gz' ]; - const couchdb = nock('http://example.com') + nock('http://example.com') .defaultReplyHeaders({ 'content-length': '10' }) @@ -202,7 +202,7 @@ describe('kibana cli', function () { 'http://example.com/badfile3.tar.gz' ]; - const couchdb = nock('http://example.com') + nock('http://example.com') .defaultReplyHeaders({ 'content-length': '10' }) diff --git a/src/cli_plugin/install/__tests__/index.js b/src/cli_plugin/install/__tests__/index.js index 470d9452a1c12..701247a49492e 100644 --- a/src/cli_plugin/install/__tests__/index.js +++ b/src/cli_plugin/install/__tests__/index.js @@ -8,7 +8,7 @@ describe('kibana cli', function () { describe('commander options', function () { - let program = { + const program = { command: function () { return program; }, description: function () { return program; }, option: function () { return program; }, diff --git a/src/cli_plugin/install/__tests__/pack.js b/src/cli_plugin/install/__tests__/pack.js index 433df5bc0a0db..9bcd3f4bb9365 100644 --- a/src/cli_plugin/install/__tests__/pack.js +++ b/src/cli_plugin/install/__tests__/pack.js @@ -139,7 +139,7 @@ describe('kibana cli', function () { it('throw an error if there is no kibana plugin', function () { return copyReplyFile('test_plugin_no_kibana.zip') - .then((data) => { + .then(() => { return getPackData(settings, logger); }) .then(shouldReject, (err) => { @@ -149,7 +149,7 @@ describe('kibana cli', function () { it('throw an error with a corrupt zip', function () { return copyReplyFile('corrupt.zip') - .then((data) => { + .then(() => { return getPackData(settings, logger); }) .then(shouldReject, (err) => { @@ -159,7 +159,7 @@ describe('kibana cli', function () { it('throw an error if there an invalid plugin name', function () { return copyReplyFile('invalid_name.zip') - .then((data) => { + .then(() => { return getPackData(settings, logger); }) .then(shouldReject, (err) => { diff --git a/src/cli_plugin/install/__tests__/progress.js b/src/cli_plugin/install/__tests__/progress.js index 15f4fd9a1bc18..40f0c60b6f88a 100644 --- a/src/cli_plugin/install/__tests__/progress.js +++ b/src/cli_plugin/install/__tests__/progress.js @@ -10,7 +10,6 @@ describe('kibana cli', function () { describe('progressReporter', function () { let logger; let progress; - let request; beforeEach(function () { logger = new Logger({ silent: false, quiet: false }); @@ -87,7 +86,6 @@ describe('kibana cli', function () { }); }); - }); }); diff --git a/src/cli_plugin/install/__tests__/settings.js b/src/cli_plugin/install/__tests__/settings.js index b72d96c986c15..fa7b7e8380691 100644 --- a/src/cli_plugin/install/__tests__/settings.js +++ b/src/cli_plugin/install/__tests__/settings.js @@ -1,8 +1,7 @@ -import path from 'path'; import expect from 'expect.js'; import { fromRoot } from '../../../utils'; import { resolve } from 'path'; -import { parseMilliseconds, parse, getPlatform } from '../settings'; +import { parseMilliseconds, parse } from '../settings'; describe('kibana cli', function () { diff --git a/src/cli_plugin/install/__tests__/zip.js b/src/cli_plugin/install/__tests__/zip.js index f6e61d320f6aa..8bb3345e0c531 100644 --- a/src/cli_plugin/install/__tests__/zip.js +++ b/src/cli_plugin/install/__tests__/zip.js @@ -20,7 +20,7 @@ describe('kibana cli', function () { workingPath: testWorkingPath, tempArchiveFile: tempArchiveFilePath, plugin: 'test-plugin', - setPlugin: function (plugin) {} + setPlugin: function () {} }; function shouldReject() { diff --git a/src/cli_plugin/install/cleanup.js b/src/cli_plugin/install/cleanup.js index 5e8f6fec58b30..e6b6a899126de 100644 --- a/src/cli_plugin/install/cleanup.js +++ b/src/cli_plugin/install/cleanup.js @@ -19,7 +19,7 @@ export function cleanPrevious(settings, logger) { resolve(); } }); -}; +} export function cleanArtifacts(settings) { // delete the working directory. @@ -29,4 +29,4 @@ export function cleanArtifacts(settings) { rimraf.sync(settings.plugins[0].path); } catch (e) {} // eslint-disable-line no-empty -}; +} diff --git a/src/cli_plugin/install/download.js b/src/cli_plugin/install/download.js index 871b170628fe8..9083d38a338ea 100644 --- a/src/cli_plugin/install/download.js +++ b/src/cli_plugin/install/download.js @@ -42,4 +42,4 @@ export function download(settings, logger) { } return tryNext(); -}; +} diff --git a/src/cli_plugin/install/downloaders/file.js b/src/cli_plugin/install/downloaders/file.js index 505a103755e66..6a89f4c60338d 100644 --- a/src/cli_plugin/install/downloaders/file.js +++ b/src/cli_plugin/install/downloaders/file.js @@ -1,9 +1,9 @@ import Progress from '../progress'; -import { createWriteStream, createReadStream, unlinkSync, statSync } from 'fs'; +import { createWriteStream, createReadStream, statSync } from 'fs'; function openSourceFile({ sourcePath }) { try { - let fileInfo = statSync(sourcePath); + const fileInfo = statSync(sourcePath); const readStream = createReadStream(sourcePath); diff --git a/src/cli_plugin/install/downloaders/http.js b/src/cli_plugin/install/downloaders/http.js index 40069c4cd063e..f8c28d65b7733 100644 --- a/src/cli_plugin/install/downloaders/http.js +++ b/src/cli_plugin/install/downloaders/http.js @@ -1,7 +1,7 @@ import Wreck from 'wreck'; import Progress from '../progress'; import { fromNode as fn } from 'bluebird'; -import { createWriteStream, unlinkSync } from 'fs'; +import { createWriteStream } from 'fs'; function sendRequest({ sourceUrl, timeout }) { const maxRedirects = 11; //Because this one goes to 11. @@ -53,7 +53,7 @@ export default async function downloadUrl(logger, sourceUrl, targetPath, timeout const { req, resp } = await sendRequest({ sourceUrl, timeout }); try { - let totalSize = parseFloat(resp.headers['content-length']) || 0; + const totalSize = parseFloat(resp.headers['content-length']) || 0; const progress = new Progress(logger); progress.init(totalSize); diff --git a/src/cli_plugin/install/index.js b/src/cli_plugin/install/index.js index 78547d1db006b..204ce01ee14ae 100644 --- a/src/cli_plugin/install/index.js +++ b/src/cli_plugin/install/index.js @@ -1,11 +1,9 @@ import { fromRoot } from '../../utils'; -import fs from 'fs'; import install from './install'; import Logger from '../lib/logger'; import pkg from '../../utils/package_json'; import { getConfig } from '../../server/path'; import { parse, parseMilliseconds } from './settings'; -import { find } from 'lodash'; function processCommand(command, options) { let settings; @@ -47,4 +45,4 @@ export default function pluginInstall(program) { install file:///Path/to/my/x-pack.zip install https://path.to/my/x-pack.zip`) .action(processCommand); -}; +} diff --git a/src/cli_plugin/install/kibana.js b/src/cli_plugin/install/kibana.js index 065808f658eaa..750c722fa8163 100644 --- a/src/cli_plugin/install/kibana.js +++ b/src/cli_plugin/install/kibana.js @@ -47,7 +47,7 @@ export async function rebuildCache(settings, logger) { export function assertVersion(settings) { if (!settings.plugins[0].version) { - throw new Error (`Plugin version not found. Check package.json in archive`); + throw new Error ('Plugin version not found. Check package.json in archive'); } const actual = cleanVersion(settings.plugins[0].version); diff --git a/src/cli_plugin/install/pack.js b/src/cli_plugin/install/pack.js index 5df302d5a86ff..ea108f4eecfef 100644 --- a/src/cli_plugin/install/pack.js +++ b/src/cli_plugin/install/pack.js @@ -17,7 +17,7 @@ async function listPackages(settings) { .map(file => file.replace(/\\/g, '/')) .map(file => file.match(regExp)) .compact() - .map(([ file, _, folder ]) => ({ file, folder })) + .map(([ file,, folder ]) => ({ file, folder })) .uniq() .value(); } @@ -134,4 +134,4 @@ export async function extract(settings, logger) { logger.error(err); throw new Error('Error extracting plugin archive'); } -}; +} diff --git a/src/cli_plugin/install/progress.js b/src/cli_plugin/install/progress.js index dca7f9a2b88fc..f0e8424852b5e 100644 --- a/src/cli_plugin/install/progress.js +++ b/src/cli_plugin/install/progress.js @@ -32,7 +32,7 @@ export default class Progress { } complete() { - this.logger.log(`Transfer complete`, false); + this.logger.log('Transfer complete', false); } } diff --git a/src/cli_plugin/install/settings.js b/src/cli_plugin/install/settings.js index 0113affe2ec91..f0a016f6409b8 100644 --- a/src/cli_plugin/install/settings.js +++ b/src/cli_plugin/install/settings.js @@ -1,7 +1,5 @@ import expiry from 'expiry-js'; -import { intersection } from 'lodash'; import { resolve } from 'path'; -import { arch, platform } from 'os'; function generateUrls({ version, plugin }) { return [ @@ -21,7 +19,7 @@ export function parseMilliseconds(val) { } return result; -}; +} export function parse(command, options, kbnPackage) { const settings = { @@ -44,4 +42,4 @@ export function parse(command, options, kbnPackage) { }; return settings; -}; +} diff --git a/src/cli_plugin/install/version.js b/src/cli_plugin/install/version.js index a2a37d0dd23b4..b2afa572f8798 100644 --- a/src/cli_plugin/install/version.js +++ b/src/cli_plugin/install/version.js @@ -1,5 +1,3 @@ -import semver from 'semver'; - export function versionSatisfies(cleanActual, cleanExpected) { try { return (cleanActual === cleanExpected); diff --git a/src/cli_plugin/lib/errors.js b/src/cli_plugin/lib/errors.js index 9bcdac145ca55..3a06950c5af8a 100644 --- a/src/cli_plugin/lib/errors.js +++ b/src/cli_plugin/lib/errors.js @@ -1 +1 @@ -export class UnsupportedProtocolError extends Error {}; +export class UnsupportedProtocolError extends Error {} diff --git a/src/cli_plugin/lib/logger.js b/src/cli_plugin/lib/logger.js index 16bc15f33e026..13adcd2201cec 100644 --- a/src/cli_plugin/lib/logger.js +++ b/src/cli_plugin/lib/logger.js @@ -41,6 +41,6 @@ export default class Logger { } process.stderr.write(`${data}\n`); this.previousLineEnded = true; - }; + } } diff --git a/src/cli_plugin/list/__tests__/settings.js b/src/cli_plugin/list/__tests__/settings.js index ebfb245dc8c29..433037c12114b 100644 --- a/src/cli_plugin/list/__tests__/settings.js +++ b/src/cli_plugin/list/__tests__/settings.js @@ -1,8 +1,6 @@ -import path from 'path'; import expect from 'expect.js'; import fromRoot from '../../../utils/from_root'; -import { resolve } from 'path'; -import { parseMilliseconds, parse } from '../settings'; +import { parse } from '../settings'; describe('kibana cli', function () { diff --git a/src/cli_plugin/list/index.js b/src/cli_plugin/list/index.js index 102eec3f1825c..9e13dd2c0f859 100644 --- a/src/cli_plugin/list/index.js +++ b/src/cli_plugin/list/index.js @@ -27,4 +27,4 @@ export default function pluginList(program) { ) .description('list installed plugins') .action(processCommand); -}; +} diff --git a/src/cli_plugin/list/settings.js b/src/cli_plugin/list/settings.js index f372bfc0d35eb..b4f59581c08f0 100644 --- a/src/cli_plugin/list/settings.js +++ b/src/cli_plugin/list/settings.js @@ -1,9 +1,7 @@ -import { resolve } from 'path'; - -export function parse(command, options) { +export function parse(command) { const settings = { pluginDir: command.pluginDir || '' }; return settings; -}; +} diff --git a/src/cli_plugin/remove/__tests__/settings.js b/src/cli_plugin/remove/__tests__/settings.js index f29aa9d6e33c6..0d031f820829f 100644 --- a/src/cli_plugin/remove/__tests__/settings.js +++ b/src/cli_plugin/remove/__tests__/settings.js @@ -1,8 +1,6 @@ -import path from 'path'; import expect from 'expect.js'; import fromRoot from '../../../utils/from_root'; -import { resolve } from 'path'; -import { parseMilliseconds, parse } from '../settings'; +import { parse } from '../settings'; describe('kibana cli', function () { diff --git a/src/cli_plugin/remove/index.js b/src/cli_plugin/remove/index.js index 9cc99fc534004..2bc98376f301d 100644 --- a/src/cli_plugin/remove/index.js +++ b/src/cli_plugin/remove/index.js @@ -37,4 +37,4 @@ export default function pluginRemove(program) { `common examples: remove x-pack`) .action(processCommand); -}; +} diff --git a/src/cli_plugin/remove/settings.js b/src/cli_plugin/remove/settings.js index 7e7ed37d2e5a9..105902687b355 100644 --- a/src/cli_plugin/remove/settings.js +++ b/src/cli_plugin/remove/settings.js @@ -12,4 +12,4 @@ export function parse(command, options) { settings.pluginPath = resolve(settings.pluginDir, settings.plugin); return settings; -}; +} diff --git a/src/core_plugins/console/.eslintrc b/src/core_plugins/console/.eslintrc index c5fcfc4ff6fda..a0436102317b2 100644 --- a/src/core_plugins/console/.eslintrc +++ b/src/core_plugins/console/.eslintrc @@ -1,34 +1,37 @@ --- root: true -extends: '@elastic/kibana' +extends: '../../../.eslintrc' rules: - block-scoped-var: [0] - camelcase: [0] - curly: [0] - dot-location: [0] - dot-notation: [0] - eqeqeq: [0] - guard-for-in: [0] - indent: [0] - max-len: [0] - new-cap: [0] - no-caller: [0] - no-empty: [0] - no-extend-native: [0] - no-loop-func: [0] - no-multi-str: [0] - no-nested-ternary: [0] - no-proto: [0] - no-sequences: [0] - no-undef: [0] - no-use-before-define: [0] - one-var: [0] - quotes: [0] - space-before-blocks: [0] - space-in-parens: [0] - space-infix-ops: [0] - semi: [0] - strict: [0] - wrap-iife: [0] + block-scoped-var: off + camelcase: off + curly: off + dot-location: off + dot-notation: off + eqeqeq: off + guard-for-in: off + indent: off + max-len: off + new-cap: off + no-caller: off + no-empty: off + no-extend-native: off + no-loop-func: off + no-multi-str: off + no-nested-ternary: off + no-proto: off + no-sequences: off + no-undef: off + no-use-before-define: off + one-var: off + quotes: off + space-before-blocks: off + space-in-parens: off + space-infix-ops: off + semi: off + strict: off + wrap-iife: off + no-var: off + prefer-const: off + no-unused-vars: off diff --git a/src/core_plugins/console/api_server/es_5_0.js b/src/core_plugins/console/api_server/es_5_0.js index 99c9b1c25b6f8..d91f986fba8a0 100644 --- a/src/core_plugins/console/api_server/es_5_0.js +++ b/src/core_plugins/console/api_server/es_5_0.js @@ -28,7 +28,7 @@ function ES_5_0() { }, this); } -ES_5_0.prototype = _.create(Api.prototype, {'constructor': ES_5_0}); +ES_5_0.prototype = _.create(Api.prototype, { 'constructor': ES_5_0 }); (function (cls) { cls.addEndpointDescription = function (endpoint, description) { diff --git a/src/core_plugins/console/api_server/es_5_0/aggregations.js b/src/core_plugins/console/api_server/es_5_0/aggregations.js index 5dbd0ee21b8ac..aa653f1beec75 100644 --- a/src/core_plugins/console/api_server/es_5_0/aggregations.js +++ b/src/core_plugins/console/api_server/es_5_0/aggregations.js @@ -1,12 +1,12 @@ var simple_metric = { - __template: {field: ""}, + __template: { field: "" }, field: "{field}", missing: 0, script: { // populated by a global rule } }, field_metric = { - __template: {field: ""}, + __template: { field: "" }, field: "{field}" }, gap_policy = { __one_of: ["skip", "insert_zeros"] @@ -51,9 +51,9 @@ var rules = { } }, "filters": { - "*": {__scope_link: "GLOBAL.filter"} + "*": { __scope_link: "GLOBAL.filter" } }, - "other_bucket": {__one_of: [true, false]}, + "other_bucket": { __one_of: [true, false] }, "other_bucket_key": "" }, "missing": field_metric, @@ -81,9 +81,9 @@ var rules = { __template: { "_term": "asc" }, - "_term": {__one_of: ["asc", "desc"]}, - "_count": {__one_of: ["asc", "desc"]}, - "*": {__one_of: ["asc", "desc"]} + "_term": { __one_of: ["asc", "desc"] }, + "_count": { __one_of: ["asc", "desc"] }, + "*": { __one_of: ["asc", "desc"] } }, "min_doc_count": 10, "script": { @@ -91,9 +91,9 @@ var rules = { }, "include": ".*", "exclude": ".*", - "execution_hint": {__one_of: ["map", "global_ordinals", "global_ordinals_hash", "global_ordinals_low_cardinality"]}, - "show_term_doc_count_error": {__one_of: [true, false]}, - "collect_mode": {__one_of: ["depth_first", "breadth_first"]}, + "execution_hint": { __one_of: ["map", "global_ordinals", "global_ordinals_hash", "global_ordinals_low_cardinality"] }, + "show_term_doc_count_error": { __one_of: [true, false] }, + "collect_mode": { __one_of: ["depth_first", "breadth_first"] }, "missing": "" }, "significant_terms": { @@ -105,22 +105,22 @@ var rules = { "shard_size": 10, "shard_min_doc_count": 10, "min_doc_count": 10, - "include": {__one_of: ["*", {pattern: "", flags: ""}]}, - "exclude": {__one_of: ["*", {pattern: "", flags: ""}]}, - "execution_hint": {__one_of: ["map", "global_ordinals", "global_ordinals_hash"]}, + "include": { __one_of: ["*", { pattern: "", flags: "" }] }, + "exclude": { __one_of: ["*", { pattern: "", flags: "" }] }, + "execution_hint": { __one_of: ["map", "global_ordinals", "global_ordinals_hash"] }, "background_filter": { __scope_link: "GLOBAL.filter" }, "mutual_information": { - "include_negatives": {__one_of: [true, false]} + "include_negatives": { __one_of: [true, false] } }, "chi_square": { - "include_negatives": {__one_of: [true, false]}, - "background_is_superset": {__one_of: [true, false]} + "include_negatives": { __one_of: [true, false] }, + "background_is_superset": { __one_of: [true, false] } }, "percentage": {}, "gnd": { - "background_is_superset": {__one_of: [true, false]} + "background_is_superset": { __one_of: [true, false] } }, "script_heuristic": { __template: { @@ -135,14 +135,14 @@ var rules = { __template: { "field": "", "ranges": [ - {"from": 50, "to": 100}, + { "from": 50, "to": 100 }, ] }, "field": "{field}", "ranges": [ - {"to": 50, "from": 100, "key": ""} + { "to": 50, "from": 100, "key": "" } ], - "keyed": {__one_of: [true, false]}, + "keyed": { __one_of: [true, false] }, "script": { // populated by a global rule } @@ -151,15 +151,15 @@ var rules = { __template: { "field": "", "ranges": [ - {"from": "now-10d/d", "to": "now"}, + { "from": "now-10d/d", "to": "now" }, ] }, "field": "{field}", "format": "MM-yyy", "ranges": [ - {"to": "", "from": "", "key": ""} + { "to": "", "from": "", "key": "" } ], - "keyed": {__one_of: [true, false]}, + "keyed": { __one_of: [true, false] }, "script": { // populated by a global rule } @@ -168,15 +168,15 @@ var rules = { __template: { "field": "", "ranges": [ - {"from": "10.0.0.5", "to": "10.0.0.10"}, + { "from": "10.0.0.5", "to": "10.0.0.10" }, ] }, "field": "{field}", "format": "MM-yyy", "ranges": [ - {"to": "", "from": "", "key": "", "mask": "10.0.0.127/25"} + { "to": "", "from": "", "key": "", "mask": "10.0.0.127/25" } ], - "keyed": {__one_of: [true, false]}, + "keyed": { __one_of: [true, false] }, "script": { // populated by a global rule } @@ -193,11 +193,11 @@ var rules = { __template: { "_key": "asc" }, - "_key": {__one_of: ["asc", "desc"]}, - "_count": {__one_of: ["asc", "desc"]}, - "*": {__one_of: ["asc", "desc"]} + "_key": { __one_of: ["asc", "desc"] }, + "_count": { __one_of: ["asc", "desc"] }, + "*": { __one_of: ["asc", "desc"] } }, - "keyed": {__one_of: [true, false]}, + "keyed": { __one_of: [true, false] }, "missing": 0 }, "date_histogram": { @@ -206,20 +206,20 @@ var rules = { "interval": "month" }, "field": "{field}", - "interval": {__one_of: ["year", "quarter", "week", "day", "hour", "minute", "second"]}, + "interval": { __one_of: ["year", "quarter", "week", "day", "hour", "minute", "second"] }, "min_doc_count": 0, "order": { __template: { "_key": "asc" }, - "_key": {__one_of: ["asc", "desc"]}, - "_count": {__one_of: ["asc", "desc"]}, - "*": {__one_of: ["asc", "desc"]} + "_key": { __one_of: ["asc", "desc"] }, + "_count": { __one_of: ["asc", "desc"] }, + "*": { __one_of: ["asc", "desc"] } }, - "keyed": {__one_of: [true, false]}, + "keyed": { __one_of: [true, false] }, "pre_zone": "-01:00", "post_zone": "-01:00", - "pre_zone_adjust_large_interval": {__one_of: [true, false]}, + "pre_zone_adjust_large_interval": { __one_of: [true, false] }, "factor": 1000, "pre_offset": "1d", "post_offset": "1d", @@ -230,18 +230,18 @@ var rules = { "geo_distance": { __template: { "field": "location", - "origin": {"lat": 52.3760, "lon": 4.894}, + "origin": { "lat": 52.3760, "lon": 4.894 }, "ranges": [ - {"from": 100, "to": 300}, + { "from": 100, "to": 300 }, ] }, "field": "{field}", - "origin": {"lat": 0.0, "lon": 0.0}, - "unit": {__one_of: ["mi", "km", "in", "yd", "m", "cm", "mm"]}, + "origin": { "lat": 0.0, "lon": 0.0 }, + "unit": { __one_of: ["mi", "km", "in", "yd", "m", "cm", "mm"] }, "ranges": [ - {"from": 50, "to": 100} + { "from": 50, "to": 100 } ], - "distance_type": {__one_of: ["arc", "sloppy_arc", "plane"]} + "distance_type": { __one_of: ["arc", "sloppy_arc", "plane"] } }, "geohash_grid": { @@ -250,7 +250,7 @@ var rules = { "precision": 3 }, "field": "{field}", - "precision": {__one_of: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]}, + "precision": { __one_of: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] }, "size": 10, "shard_size": 10 }, @@ -269,7 +269,7 @@ var rules = { // populated by a global rule }, "compression": 100, - "method": {__one_of: ["hdr", "tdigest"]}, + "method": { __one_of: ["hdr", "tdigest"] }, missing: 0 }, "cardinality": { @@ -311,7 +311,7 @@ var rules = { field: "" }, field: "{field}", - wrap_longitude: {__one_of: [true, false]} + wrap_longitude: { __one_of: [true, false] } }, "top_hits": { __template: { @@ -324,7 +324,7 @@ var rules = { __scope_link: "_search.sort" }, highlight: {}, - explain: {__one_of: [true, false]}, + explain: { __one_of: [true, false] }, _source: { __template: "", __scope_link: "_search._source" @@ -333,7 +333,7 @@ var rules = { __scope_link: "_search.script_fields" }, docvalue_fields: ["{field}"], - version: {__one_of: [true, false]} + version: { __one_of: [true, false] } }, "percentile_ranks": { __template: { @@ -346,7 +346,7 @@ var rules = { // populated by a global rule }, "compression": 100, - "method": {__one_of: ["hdr", "tdigest"]}, + "method": { __one_of: ["hdr", "tdigest"] }, missing: 0 }, "sampler": { @@ -357,7 +357,7 @@ var rules = { }, "shard_size": 100, "max_docs_per_value": 3, - "execution_hint": {__one_of: ["map", "global_ordinals", "bytes_hash"]} + "execution_hint": { __one_of: ["map", "global_ordinals", "bytes_hash"] } }, "children": { __template: { @@ -378,9 +378,9 @@ var rules = { format: "", gap_policy: gap_policy, "window": 5, - model: {__one_of: ["simple", "linear", "ewma", "holt", "holt_winters"]}, + model: { __one_of: ["simple", "linear", "ewma", "holt", "holt_winters"] }, settings: { - type: {__one_of: ["add", "mult"]}, + type: { __one_of: ["add", "mult"] }, alpha: 0.5, beta: 0.5, gamma: 0.5, diff --git a/src/core_plugins/console/api_server/es_5_0/aliases.js b/src/core_plugins/console/api_server/es_5_0/aliases.js index 832a1ed8a3ae0..c17dee4aa0bd7 100644 --- a/src/core_plugins/console/api_server/es_5_0/aliases.js +++ b/src/core_plugins/console/api_server/es_5_0/aliases.js @@ -7,7 +7,7 @@ module.exports = function (api) { data_autocomplete_rules: { 'actions': { __template: [ - {'add': {'index': 'test1', 'alias': 'alias1'}} + { 'add': { 'index': 'test1', 'alias': 'alias1' } } ], __any_of: [ { diff --git a/src/core_plugins/console/api_server/es_5_0/cat.js b/src/core_plugins/console/api_server/es_5_0/cat.js index af8a496d63e4e..0da08cd066e0c 100644 --- a/src/core_plugins/console/api_server/es_5_0/cat.js +++ b/src/core_plugins/console/api_server/es_5_0/cat.js @@ -1,7 +1,7 @@ let _ = require("lodash"); function addSimpleCat(endpoint, api, params, patterns) { - var url_params = {"help": "__flag__", "v": "__flag__", "bytes": ["b"]}; + var url_params = { "help": "__flag__", "v": "__flag__", "bytes": ["b"] }; _.each(params || [], function (p) { if (_.isString(p)) { url_params[p] = "__flag__"; @@ -37,10 +37,10 @@ module.exports = function (api) { addSimpleCat('_cat/allocation', api, null, ['_cat/allocation', '_cat/allocation/{nodes}']); addSimpleCat('_cat/count', api); addSimpleCat('_cat/health', api, [ - {"ts": ["false", "true"]} + { "ts": ["false", "true"] } ]); addSimpleCat('_cat/indices', api, [ - {h: []}, + { h: [] }, "pri", ], ['_cat/indices', '_cat/indices/{indices}']); diff --git a/src/core_plugins/console/api_server/es_5_0/cluster.js b/src/core_plugins/console/api_server/es_5_0/cluster.js index a6519e81ed6e4..a29e45c6e1db2 100644 --- a/src/core_plugins/console/api_server/es_5_0/cluster.js +++ b/src/core_plugins/console/api_server/es_5_0/cluster.js @@ -38,11 +38,11 @@ module.exports = function (api) { persistent: { cluster: { routing: { - 'allocation.enable': {__one_of: ["all", "primaries", "new_primaries", "none"]}, - 'allocation.disk.threshold_enabled': {__one_of: [false, true]}, + 'allocation.enable': { __one_of: ["all", "primaries", "new_primaries", "none"] }, + 'allocation.disk.threshold_enabled': { __one_of: [false, true] }, 'allocation.disk.watermark.low': '85%', 'allocation.disk.watermark.high': '90%', - 'allocation.disk.include_relocations': {__one_of: [true, false]}, + 'allocation.disk.include_relocations': { __one_of: [true, false] }, 'allocation.disk.reroute_interval': '60s', 'allocation.exclude': { '_ip': "", @@ -68,11 +68,11 @@ module.exports = function (api) { 'values': [] } }, - 'allocation.allow_rebalance': {__one_of: ['always', 'indices_primaries_active', 'indices_all_active']}, + 'allocation.allow_rebalance': { __one_of: ['always', 'indices_primaries_active', 'indices_all_active'] }, 'allocation.cluster_concurrent_rebalance': 2, 'allocation.node_initial_primaries_recoveries': 4, 'allocation.node_concurrent_recoveries': 2, - 'allocation.same_shard.host': {__one_of: [false, true]} + 'allocation.same_shard.host': { __one_of: [false, true] } } }, indices: { @@ -121,7 +121,7 @@ module.exports = function (api) { index: "{index}", shard: 0, node: "{node}", - allow_primary: {__one_of: [true, false]} + allow_primary: { __one_of: [true, false] } }, allocate: { __template: { @@ -132,11 +132,11 @@ module.exports = function (api) { index: "{index}", shard: 0, node: "{node}", - allow_primary: {__one_of: [true, false]} + allow_primary: { __one_of: [true, false] } } } ], - dry_run: {__one_of: [true, false]} + dry_run: { __one_of: [true, false] } } }); }; diff --git a/src/core_plugins/console/api_server/es_5_0/document.js b/src/core_plugins/console/api_server/es_5_0/document.js index caf36cb33a5ac..47762ef5b757e 100644 --- a/src/core_plugins/console/api_server/es_5_0/document.js +++ b/src/core_plugins/console/api_server/es_5_0/document.js @@ -114,7 +114,7 @@ module.exports = function (api) { }, "doc": {}, "upsert": {}, - "scripted_upsert": {__one_of: [true, false]} + "scripted_upsert": { __one_of: [true, false] } } }); @@ -159,13 +159,13 @@ module.exports = function (api) { fields: [ "{field}" ], - offsets: {__one_of: [false, true]}, - payloads: {__one_of: [false, true]}, - positions: {__one_of: [false, true]}, - term_statistics: {__one_of: [true, false]}, - field_statistics: {__one_of: [false, true]}, + offsets: { __one_of: [false, true] }, + payloads: { __one_of: [false, true] }, + positions: { __one_of: [false, true] }, + term_statistics: { __one_of: [true, false] }, + field_statistics: { __one_of: [false, true] }, per_field_analyzer: { - __template: {"FIELD": ""}, + __template: { "FIELD": "" }, "{field}": "" }, routing: "", @@ -206,14 +206,14 @@ module.exports = function (api) { fields: [ "{field}" ], - offsets: {__one_of: [false, true]}, - payloads: {__one_of: [false, true]}, - positions: {__one_of: [false, true]}, - term_statistics: {__one_of: [true, false]}, - field_statistics: {__one_of: [false, true]}, - dfs: {__one_of: [true, false]}, + offsets: { __one_of: [false, true] }, + payloads: { __one_of: [false, true] }, + positions: { __one_of: [false, true] }, + term_statistics: { __one_of: [true, false] }, + field_statistics: { __one_of: [false, true] }, + dfs: { __one_of: [true, false] }, per_field_analyzer: { - __template: {"FIELD": ""}, + __template: { "FIELD": "" }, "{field}": "" }, routing: "", diff --git a/src/core_plugins/console/api_server/es_5_0/filter.js b/src/core_plugins/console/api_server/es_5_0/filter.js index 877c0495fc40a..bcaae01055144 100644 --- a/src/core_plugins/console/api_server/es_5_0/filter.js +++ b/src/core_plugins/console/api_server/es_5_0/filter.js @@ -260,7 +260,7 @@ filters.range = { lt: 20, time_zone: "+1:00", "format": "dd/MM/yyyy||yyyy", - execution: {__one_of: ["index", "fielddata"]} + execution: { __one_of: ["index", "fielddata"] } } }; diff --git a/src/core_plugins/console/api_server/es_5_0/indices.js b/src/core_plugins/console/api_server/es_5_0/indices.js index f65ee3d2fcc22..911ce48b950f5 100644 --- a/src/core_plugins/console/api_server/es_5_0/indices.js +++ b/src/core_plugins/console/api_server/es_5_0/indices.js @@ -108,7 +108,7 @@ module.exports = function (api) { tokenizer: "", char_filter: [], filter: [], - explain: {__one_of: [false, true]}, + explain: { __one_of: [false, true] }, attributes: [] } }); diff --git a/src/core_plugins/console/api_server/es_5_0/mappings.js b/src/core_plugins/console/api_server/es_5_0/mappings.js index 4bbfede64c5b9..93709de58657f 100644 --- a/src/core_plugins/console/api_server/es_5_0/mappings.js +++ b/src/core_plugins/console/api_server/es_5_0/mappings.js @@ -195,7 +195,7 @@ module.exports = function (api) { __scope_link: '_put_mapping.type.properties.field' } }, - copy_to: {__one_of: ['{field}', ['{field}']]}, + copy_to: { __one_of: ['{field}', ['{field}']] }, // nested include_in_parent: BOOLEAN, diff --git a/src/core_plugins/console/api_server/es_5_0/percolator.js b/src/core_plugins/console/api_server/es_5_0/percolator.js index 7f100f34511a8..100a0889a8ada 100644 --- a/src/core_plugins/console/api_server/es_5_0/percolator.js +++ b/src/core_plugins/console/api_server/es_5_0/percolator.js @@ -38,7 +38,7 @@ module.exports = function (api) { query: {}, filter: {}, size: 10, - track_scores: {__one_of: [true, false]}, + track_scores: { __one_of: [true, false] }, sort: "_score", aggs: {}, highlight: {} @@ -64,7 +64,7 @@ module.exports = function (api) { query: {}, filter: {}, size: 10, - track_scores: {__one_of: [true, false]}, + track_scores: { __one_of: [true, false] }, sort: "_score", aggs: {}, highlight: {} diff --git a/src/core_plugins/console/api_server/es_5_0/query.js b/src/core_plugins/console/api_server/es_5_0/query.js index 99e35f3a8110b..2b4d2ee48d7ba 100644 --- a/src/core_plugins/console/api_server/es_5_0/query.js +++ b/src/core_plugins/console/api_server/es_5_0/query.js @@ -120,7 +120,7 @@ module.exports = function (api) { __one_of: [true, false] }, tie_breaker: 0.0, - type: {__one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix']} + type: { __one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix'] } }, bool: { must: [ @@ -321,12 +321,12 @@ module.exports = function (api) { }, query: "", fields: ["{field}"], - default_operator: {__one_of: ["OR", "AND"]}, + default_operator: { __one_of: ["OR", "AND"] }, analyzer: "", flags: "OR|AND|PREFIX", - lowercase_expanded_terms: {__one_of: [true, false]}, + lowercase_expanded_terms: { __one_of: [true, false] }, locale: "ROOT", - lenient: {__one_of: [true, false]} + lenient: { __one_of: [true, false] } }, range: { __template: { @@ -606,8 +606,8 @@ module.exports = function (api) { ) ], boost: 1.0, - boost_mode: {__one_of: ["multiply", "replace", "sum", "avg", "max", "min"]}, - score_mode: {__one_of: ["multiply", "sum", "first", "avg", "max", "min"]}, + boost_mode: { __one_of: ["multiply", "replace", "sum", "avg", "max", "min"] }, + score_mode: { __one_of: ["multiply", "sum", "first", "avg", "max", "min"] }, max_boost: 10, min_score: 1.0 }, diff --git a/src/core_plugins/console/api_server/es_5_0/search.js b/src/core_plugins/console/api_server/es_5_0/search.js index db5efcf6b24ec..c2f1e7f72f6a2 100644 --- a/src/core_plugins/console/api_server/es_5_0/search.js +++ b/src/core_plugins/console/api_server/es_5_0/search.js @@ -112,9 +112,9 @@ module.exports = function (api) { "" ] }, - distance_type: {__one_of: ["sloppy_arc", "arc", "plane"]}, - sort_mode: {__one_of: ["min", "max", "avg"]}, - order: {__one_of: ["asc", "desc"]}, + distance_type: { __one_of: ["sloppy_arc", "arc", "plane"] }, + sort_mode: { __one_of: ["min", "max", "avg"] }, + order: { __one_of: ["asc", "desc"] }, unit: "km" } } @@ -173,7 +173,7 @@ module.exports = function (api) { }, stats: [''], timeout: "1s", - version: {__one_of: [true, false]} + version: { __one_of: [true, false] } } }); @@ -187,8 +187,8 @@ module.exports = function (api) { data_autocomplete_rules: { "template": { __one_of: [ - {__scope_link: "_search"}, - {__scope_link: "GLOBAL.script"} + { __scope_link: "_search" }, + { __scope_link: "GLOBAL.script" } ] }, "params": {} @@ -202,8 +202,8 @@ module.exports = function (api) { ], data_autocomplete_rules: { __one_of: [ - {"inline": {__scope_link: "_search"}}, - {__scope_link: "GLOBAL.script"} + { "inline": { __scope_link: "_search" } }, + { __scope_link: "GLOBAL.script" } ], "params": {} } diff --git a/src/core_plugins/console/api_server/es_5_0/snapshot_restore.js b/src/core_plugins/console/api_server/es_5_0/snapshot_restore.js index 4e681ea23cbd6..2971fc8c72989 100644 --- a/src/core_plugins/console/api_server/es_5_0/snapshot_restore.js +++ b/src/core_plugins/console/api_server/es_5_0/snapshot_restore.js @@ -9,7 +9,7 @@ module.exports = function (api) { }, data_autocomplete_rules: { indices: "*", - ignore_unavailable: {__one_of: [true, false]}, + ignore_unavailable: { __one_of: [true, false] }, include_global_state: false, rename_pattern: "index_(.+)", rename_replacement: "restored_index_$1" @@ -41,9 +41,9 @@ module.exports = function (api) { }, data_autocomplete_rules: { indices: "*", - ignore_unavailable: {__one_of: [true, false]}, - include_global_state: {__one_of: [true, false]}, - partial: {__one_of: [true, false]} + ignore_unavailable: { __one_of: [true, false] }, + include_global_state: { __one_of: [true, false] }, + partial: { __one_of: [true, false] } } }); @@ -86,7 +86,7 @@ module.exports = function (api) { '_snapshot/{id}' ], data_autocomplete_rules: { - __template: {"type": ""}, + __template: { "type": "" }, "type": { __one_of: ["fs", "url", "s3", "hdfs"] @@ -101,7 +101,7 @@ module.exports = function (api) { location: "path" }, location: "path", - compress: {__one_of: [true, false]}, + compress: { __one_of: [true, false] }, concurrent_streams: 5, chunk_size: "10m", max_restore_bytes_per_sec: "20mb", @@ -129,7 +129,7 @@ module.exports = function (api) { base_path: "", concurrent_streams: 5, chunk_size: "10m", - compress: {__one_of: [true, false]} + compress: { __one_of: [true, false] } }, {// hdfs __condition: { @@ -140,10 +140,10 @@ module.exports = function (api) { }, uri: "", path: "some/path", - load_defaults: {__one_of: [true, false]}, + load_defaults: { __one_of: [true, false] }, conf_location: "cfg.xml", concurrent_streams: 5, - compress: {__one_of: [true, false]}, + compress: { __one_of: [true, false] }, chunk_size: "10m" } ] diff --git a/src/core_plugins/console/api_server/es_5_0/templates.js b/src/core_plugins/console/api_server/es_5_0/templates.js index 635256c3f6985..5646be3e4e252 100644 --- a/src/core_plugins/console/api_server/es_5_0/templates.js +++ b/src/core_plugins/console/api_server/es_5_0/templates.js @@ -19,9 +19,9 @@ module.exports = function (api) { ], data_autocomplete_rules: { template: 'index*', - warmers: {__scope_link: '_warmer'}, - mappings: {__scope_link: '_put_mapping'}, - settings: {__scope_link: '_put_settings'} + warmers: { __scope_link: '_warmer' }, + mappings: { __scope_link: '_put_mapping' }, + settings: { __scope_link: '_put_settings' } } }); }; diff --git a/src/core_plugins/console/index.js b/src/core_plugins/console/index.js index 85ce64e31fad6..0a8497bcdb4ce 100644 --- a/src/core_plugins/console/index.js +++ b/src/core_plugins/console/index.js @@ -163,7 +163,7 @@ module.exports = function (kibana) { method: ['GET', 'POST'], handler: function (req, reply) { let server = require('./api_server/server'); - let {sense_version, apis} = req.query; + let { sense_version, apis } = req.query; if (!apis) { reply(Boom.badRequest('"apis" is a required param.')); return; diff --git a/src/core_plugins/console/public/src/app.js b/src/core_plugins/console/public/src/app.js index 114411ce4f787..fc709148e9c71 100644 --- a/src/core_plugins/console/public/src/app.js +++ b/src/core_plugins/console/public/src/app.js @@ -34,9 +34,9 @@ function loadSavedState() { } } else if (/^https?:\/\//.test(sourceLocation)) { - var loadFrom = {url: sourceLocation, dataType: "text", kbnXsrfToken: false}; + var loadFrom = { url: sourceLocation, dataType: "text", kbnXsrfToken: false }; if (/https?:\/\/api.github.com/.test(sourceLocation)) { - loadFrom.headers = {Accept: "application/vnd.github.v3.raw"}; + loadFrom.headers = { Accept: "application/vnd.github.v3.raw" }; } $.ajax(loadFrom).done(function (data) { resetToValues(data); diff --git a/src/core_plugins/console/public/src/autocomplete.js b/src/core_plugins/console/public/src/autocomplete.js index f706780cb0bc1..f05469128e85b 100644 --- a/src/core_plugins/console/public/src/autocomplete.js +++ b/src/core_plugins/console/public/src/autocomplete.js @@ -77,9 +77,9 @@ module.exports = function (editor) { function addMetaToTermsList(list, meta, template) { return _.map(list, function (t) { if (typeof t !== "object") { - t = {name: t}; + t = { name: t }; } - return _.defaults(t, {meta: meta, template: template}); + return _.defaults(t, { meta: meta, template: template }); }); } @@ -166,13 +166,13 @@ module.exports = function (editor) { var nonEmptyToken = editor.parser.nextNonEmptyToken(tokenIter); switch (nonEmptyToken ? nonEmptyToken.type : "NOTOKEN") { case "paren.rparen": - newPos = {row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn()}; + newPos = { row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn() }; break; case "punctuation.colon": nonEmptyToken = editor.parser.nextNonEmptyToken(tokenIter); if ((nonEmptyToken || {}).type == "paren.lparen") { nonEmptyToken = editor.parser.nextNonEmptyToken(tokenIter); - newPos = {row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn()}; + newPos = { row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn() }; if (nonEmptyToken && nonEmptyToken.value.indexOf('"') === 0) { newPos.column++; } // don't stand on " @@ -181,7 +181,7 @@ module.exports = function (editor) { case "paren.lparen": case "punctuation.comma": tokenIter.stepForward(); - newPos = {row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn()}; + newPos = { row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn() }; break; } editor.moveCursorToPosition(newPos); @@ -325,7 +325,7 @@ module.exports = function (editor) { context.updatedForToken = _.clone(session.getTokenAt(pos.row, pos.column)); if (!context.updatedForToken) { - context.updatedForToken = {value: "", start: pos.column}; + context.updatedForToken = { value: "", start: pos.column }; } // empty line var anchorToken = context.createdWithToken; @@ -374,7 +374,7 @@ module.exports = function (editor) { break; } - context.textBoxPosition = {row: context.rangeToReplace.start.row, column: context.rangeToReplace.start.column}; + context.textBoxPosition = { row: context.rangeToReplace.start.row, column: context.rangeToReplace.start.column }; switch (context.autoCompleteType) { case "path": @@ -514,7 +514,7 @@ module.exports = function (editor) { function addMethodAutoCompleteSetToContext(context, pos) { context.autoCompleteSet = _.map(["GET", "PUT", "POST", "DELETE", "HEAD"], function (m, i) { - return {name: m, score: -i, meta: "method"} + return { name: m, score: -i, meta: "method" } }) } @@ -825,7 +825,7 @@ module.exports = function (editor) { LAST_EVALUATED_TOKEN = null; return; } - currentToken = {start: 0, value: ""}; // empty row + currentToken = { start: 0, value: "" }; // empty row } currentToken.row = pos.row; // extend token with row. Ace doesn't supply it by default diff --git a/src/core_plugins/console/public/src/autocomplete/body_completer.js b/src/core_plugins/console/public/src/autocomplete/body_completer.js index a3891d320d787..57459cfc7d5bc 100644 --- a/src/core_plugins/console/public/src/autocomplete/body_completer.js +++ b/src/core_plugins/console/public/src/autocomplete/body_completer.js @@ -97,7 +97,7 @@ function compileParametrizedValue(value, compilingContext, template) { } component = component(value, null, template); if (!_.isUndefined(template)) { - component = engine.wrapComponentWithDefaults(component, {template: template}); + component = engine.wrapComponentWithDefaults(component, { template: template }); } return component; @@ -169,7 +169,7 @@ function ObjectComponent(name, constants, patternsAndWildCards) { ObjectComponent.prototype = _.create( engine.AutocompleteComponent.prototype, - {'constructor': ObjectComponent}); + { 'constructor': ObjectComponent }); (function (cls) { @@ -244,7 +244,7 @@ function ScopeResolver(link, compilingContext) { ScopeResolver.prototype = _.create( engine.SharedComponent.prototype, - {'constructor': ScopeResolver}); + { 'constructor': ScopeResolver }); (function (cls) { @@ -316,7 +316,7 @@ function ConditionalProxy(predicate, delegate) { ConditionalProxy.prototype = _.create( engine.SharedComponent.prototype, - {'constructor': ConditionalProxy}); + { 'constructor': ConditionalProxy }); (function (cls) { @@ -345,7 +345,7 @@ function GlobalOnlyComponent(name) { GlobalOnlyComponent.prototype = _.create( engine.AutocompleteComponent.prototype, - {'constructor': ObjectComponent}); + { 'constructor': ObjectComponent }); (function (cls) { diff --git a/src/core_plugins/console/public/src/autocomplete/engine.js b/src/core_plugins/console/public/src/autocomplete/engine.js index 31115d49cc0a0..a120ba258f077 100644 --- a/src/core_plugins/console/public/src/autocomplete/engine.js +++ b/src/core_plugins/console/public/src/autocomplete/engine.js @@ -39,7 +39,7 @@ function SharedComponent(name, parent) { SharedComponent.prototype = _.create( module.exports.AutocompleteComponent.prototype, - {'constructor': SharedComponent}); + { 'constructor': SharedComponent }); module.exports.SharedComponent = SharedComponent; @@ -68,7 +68,7 @@ function ListComponent(name, list, parent, multi_valued, allow_non_valid_values) this.allow_non_valid_values = _.isUndefined(allow_non_valid_values) ? false : allow_non_valid_values; } -ListComponent.prototype = _.create(SharedComponent.prototype, {"constructor": ListComponent}); +ListComponent.prototype = _.create(SharedComponent.prototype, { "constructor": ListComponent }); module.exports.ListComponent = ListComponent; @@ -88,9 +88,9 @@ module.exports.ListComponent = ListComponent; var meta = this.getDefaultTermMeta(); ret = _.map(ret, function (term) { if (_.isString(term)) { - term = {"name": term}; + term = { "name": term }; } - return _.defaults(term, {meta: meta}); + return _.defaults(term, { meta: meta }); }); } @@ -141,7 +141,7 @@ function SimpleParamComponent(name, parent) { SharedComponent.call(this, name, parent); } -SimpleParamComponent.prototype = _.create(SharedComponent.prototype, {"constructor": SimpleParamComponent}); +SimpleParamComponent.prototype = _.create(SharedComponent.prototype, { "constructor": SimpleParamComponent }); module.exports.SimpleParamComponent = SimpleParamComponent; (function (cls) { @@ -162,7 +162,7 @@ function ConstantComponent(name, parent, options) { this.options = options || [name]; } -ConstantComponent.prototype = _.create(SharedComponent.prototype, {"constructor": ConstantComponent}); +ConstantComponent.prototype = _.create(SharedComponent.prototype, { "constructor": ConstantComponent }); module.exports.ConstantComponent = ConstantComponent; (function (cls) { @@ -207,7 +207,7 @@ module.exports.wrapComponentWithDefaults = function (component, defaults) { } result = _.map(result, function (term) { if (!_.isObject(term)) { - term = {name: term}; + term = { name: term }; } return _.defaults(term, defaults); }, this); @@ -320,7 +320,7 @@ module.exports.populateContext = function (tokenPath, context, editor, includeAu _.each(ws.components, function (component) { _.each(component.getTerms(contextForState, editor), function (term) { if (!_.isObject(term)) { - term = {name: term}; + term = { name: term }; } autoCompleteSet.push(term); }); diff --git a/src/core_plugins/console/public/src/autocomplete/url_params.js b/src/core_plugins/console/public/src/autocomplete/url_params.js index 7a0b77151b60b..4f7b0a1b3d848 100644 --- a/src/core_plugins/console/public/src/autocomplete/url_params.js +++ b/src/core_plugins/console/public/src/autocomplete/url_params.js @@ -6,12 +6,12 @@ function ParamComponent(name, parent, description) { this.description = description; } -ParamComponent.prototype = _.create(engine.ConstantComponent.prototype, {"constructor": ParamComponent}); +ParamComponent.prototype = _.create(engine.ConstantComponent.prototype, { "constructor": ParamComponent }); module.exports.ParamComponent = ParamComponent; (function (cls) { cls.getTerms = function () { - var t = {name: this.name}; + var t = { name: this.name }; if (this.description === "__flag__") { t.meta = "flag" } diff --git a/src/core_plugins/console/public/src/autocomplete/url_pattern_matcher.js b/src/core_plugins/console/public/src/autocomplete/url_pattern_matcher.js index 1ff1e136b13da..7a20b49d6d443 100644 --- a/src/core_plugins/console/public/src/autocomplete/url_pattern_matcher.js +++ b/src/core_plugins/console/public/src/autocomplete/url_pattern_matcher.js @@ -9,7 +9,7 @@ function AcceptEndpointComponent(endpoint, parent) { this.endpoint = endpoint } -AcceptEndpointComponent.prototype = _.create(engine.SharedComponent.prototype, {"constructor": AcceptEndpointComponent}); +AcceptEndpointComponent.prototype = _.create(engine.SharedComponent.prototype, { "constructor": AcceptEndpointComponent }); (function (cls) { diff --git a/src/core_plugins/console/public/src/input.js b/src/core_plugins/console/public/src/input.js index 97a393c04ec61..98d3988674f97 100644 --- a/src/core_plugins/console/public/src/input.js +++ b/src/core_plugins/console/public/src/input.js @@ -23,21 +23,21 @@ input.$actions = $("#editor_actions"); input.commands.addCommand({ name: 'auto indent request', - bindKey: {win: 'Ctrl-I', mac: 'Command-I'}, + bindKey: { win: 'Ctrl-I', mac: 'Command-I' }, exec: function () { input.autoIndent(); } }); input.commands.addCommand({ name: 'move to previous request start or end', - bindKey: {win: 'Ctrl-Up', mac: 'Command-Up'}, + bindKey: { win: 'Ctrl-Up', mac: 'Command-Up' }, exec: function () { input.moveToPreviousRequestEdge() } }); input.commands.addCommand({ name: 'move to next request start or end', - bindKey: {win: 'Ctrl-Down', mac: 'Command-Down'}, + bindKey: { win: 'Ctrl-Down', mac: 'Command-Down' }, exec: function () { input.moveToNextRequestEdge() } @@ -224,7 +224,7 @@ function sendCurrentRequestToES() { input.commands.addCommand({ name: 'send to elasticsearch', - bindKey: {win: 'Ctrl-Enter', mac: 'Command-Enter'}, + bindKey: { win: 'Ctrl-Enter', mac: 'Command-Enter' }, exec: sendCurrentRequestToES }); diff --git a/src/core_plugins/console/public/src/kb.js b/src/core_plugins/console/public/src/kb.js index b005d25f8f4da..919cf96ef9df1 100644 --- a/src/core_plugins/console/public/src/kb.js +++ b/src/core_plugins/console/public/src/kb.js @@ -17,7 +17,7 @@ function IndexAutocompleteComponent(name, parent, multi_valued) { IndexAutocompleteComponent.prototype = _.create( autocomplete_engine.ListComponent.prototype, - {'constructor': IndexAutocompleteComponent}); + { 'constructor': IndexAutocompleteComponent }); (function (cls) { cls.validateTokens = function (tokens) { @@ -47,7 +47,7 @@ function TypeAutocompleteComponent(name, parent, multi_valued) { TypeAutocompleteComponent.prototype = _.create( autocomplete_engine.ListComponent.prototype, - {'constructor': TypeAutocompleteComponent}); + { 'constructor': TypeAutocompleteComponent }); (function (cls) { cls.validateTokens = function (tokens) { @@ -69,7 +69,7 @@ TypeAutocompleteComponent.prototype = _.create( function FieldGenerator(context) { return _.map(mappings.getFields(context.indices, context.types), function (field) { - return {name: field.name, meta: field.type}; + return { name: field.name, meta: field.type }; }); } @@ -79,7 +79,7 @@ function FieldAutocompleteComponent(name, parent, multi_valued) { FieldAutocompleteComponent.prototype = _.create( autocomplete_engine.ListComponent.prototype, - {'constructor': FieldAutocompleteComponent}); + { 'constructor': FieldAutocompleteComponent }); (function (cls) { cls.validateTokens = function (tokens) { @@ -109,7 +109,7 @@ function IdAutocompleteComponent(name, parent, multi) { IdAutocompleteComponent.prototype = _.create( autocomplete_engine.SharedComponent.prototype, - {'constructor': IdAutocompleteComponent}); + { 'constructor': IdAutocompleteComponent }); (function (cls) { cls.match = function (token, context, editor) { diff --git a/src/core_plugins/console/public/src/mappings.js b/src/core_plugins/console/public/src/mappings.js index 82906c8f4fae8..672897a013fb3 100644 --- a/src/core_plugins/console/public/src/mappings.js +++ b/src/core_plugins/console/public/src/mappings.js @@ -155,7 +155,7 @@ function getFieldNamesFromFieldMapping(field_name, field_mapping) { return applyPathSettings(nested_fields); } - var ret = {name: field_name, type: field_type}; + var ret = { name: field_name, type: field_type }; if (field_mapping["index_name"]) { ret.name = field_mapping["index_name"]; diff --git a/src/core_plugins/console/public/src/output.js b/src/core_plugins/console/public/src/output.js index 0df74267104ad..5dd490f4f0249 100644 --- a/src/core_plugins/console/public/src/output.js +++ b/src/core_plugins/console/public/src/output.js @@ -40,7 +40,7 @@ output.append = function (val, fold_previous, cb) { session.toggleFold(false); } - session.insert({row: lastLine, column: 0}, "\n" + val); + session.insert({ row: lastLine, column: 0 }, "\n" + val); output.moveCursorTo(lastLine + 1, 0); if (typeof cb === 'function') { setTimeout(cb); diff --git a/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js b/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js index da256594bfb45..cc4e229d07a39 100644 --- a/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js +++ b/src/core_plugins/console/public/src/sense_editor/mode/input_highlight_rules.js @@ -14,8 +14,8 @@ var InputHighlightRules = function () { reg = reg.source; } return [ - {token: tokens.concat(["whitespace"]), regex: reg + "(\\s*)$", next: nextIfEOL}, - {token: tokens, regex: reg, next: normalNext} + { token: tokens.concat(["whitespace"]), regex: reg + "(\\s*)$", next: nextIfEOL }, + { token: tokens, regex: reg, next: normalNext } ]; } @@ -24,8 +24,8 @@ var InputHighlightRules = function () { /*jshint -W015 */ this.$rules = { "start": mergeTokens([ - {token: "comment", regex: /^#.*$/}, - {token: "paren.lparen", regex: "{", next: "json", push: true} + { token: "comment", regex: /^#.*$/ }, + { token: "paren.lparen", regex: "{", next: "json", push: true } ], addEOL(["method"], /([a-zA-Z]+)/, "start", "method_sep") , diff --git a/src/core_plugins/console/public/src/sense_editor/mode/worker.js b/src/core_plugins/console/public/src/sense_editor/mode/worker.js index 4371f7ff14b8d..8a3f6f6d6fa63 100644 --- a/src/core_plugins/console/public/src/sense_editor/mode/worker.js +++ b/src/core_plugins/console/public/src/sense_editor/mode/worker.js @@ -7,7 +7,7 @@ window.console = function () { var msgs = Array.prototype.slice.call(arguments, 0); - window.postMessage({type: "log", data: msgs}); + window.postMessage({ type: "log", data: msgs }); }; window.console.error = window.console.warn = @@ -273,7 +273,7 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib } else if (Array.isArray(text)) { this._insertLines(0, text); } else { - this.insert({row: 0, column: 0}, text); + this.insert({ row: 0, column: 0 }, text); } }; @@ -283,7 +283,7 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib this.setValue = function (text) { var len = this.getLength(); this.remove(new Range(0, 0, len, this.getLine(len - 1).length)); - this.insert({row: 0, column: 0}, text); + this.insert({ row: 0, column: 0 }, text); }; this.getValue = function () { return this.getAllLines().join(this.getNewLineCharacter()); @@ -386,12 +386,12 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib }; this.insertLines = function (row, lines) { if (row >= this.getLength()) - return this.insert({row: row, column: 0}, "\n" + lines.join("\n")); + return this.insert({ row: row, column: 0 }, "\n" + lines.join("\n")); return this._insertLines(Math.max(row, 0), lines); }; this._insertLines = function (row, lines) { if (lines.length == 0) - return {row: row, column: 0}; + return { row: row, column: 0 }; var end; if (lines.length > 0xFFFF) { end = this._insertLines(row, lines.slice(0xFFFF)); @@ -596,9 +596,9 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib for (var i = startRow || 0, l = lines.length; i < l; i++) { index -= lines[i].length + newlineLength; if (index < 0) - return {row: i, column: index + lines[i].length + newlineLength}; + return { row: i, column: index + lines[i].length + newlineLength }; } - return {row: l - 1, column: lines[l - 1].length}; + return { row: l - 1, column: lines[l - 1].length }; }; this.positionToIndex = function (pos, startRow) { var lines = this.$lines || this.getAllLines(); @@ -680,7 +680,7 @@ define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function (req EventEmitter.setDefaultHandler = function (eventName, callback) { var handlers = this._defaultHandlers if (!handlers) - handlers = this._defaultHandlers = {_disabled_: {}}; + handlers = this._defaultHandlers = { _disabled_: {} }; if (handlers[eventName]) { var old = handlers[eventName]; @@ -918,14 +918,14 @@ define('ace/range', ['require', 'exports', 'module' ], function (require, export this.clipRows = function (firstRow, lastRow) { var start, end; if (this.end.row > lastRow) - end = {row: lastRow + 1, column: 0}; + end = { row: lastRow + 1, column: 0 }; else if (this.end.row < firstRow) - end = {row: firstRow, column: 0}; + end = { row: firstRow, column: 0 }; if (this.start.row > lastRow) - start = {row: lastRow + 1, column: 0}; + start = { row: lastRow + 1, column: 0 }; else if (this.start.row < firstRow) - start = {row: firstRow, column: 0}; + start = { row: firstRow, column: 0 }; return Range.fromPoints(start || this.start, end || this.end); }; @@ -935,9 +935,9 @@ define('ace/range', ['require', 'exports', 'module' ], function (require, export if (cmp == 0) return this; else if (cmp == -1) - start = {row: row, column: column}; + start = { row: row, column: column }; else - end = {row: row, column: column}; + end = { row: row, column: column }; return Range.fromPoints(start || this.start, end || this.end); }; @@ -1337,7 +1337,7 @@ define("sense_editor/mode/worker_parser", ['require', 'exports', 'module' ], fun text, annotate = function (type, text) { - annos.push({type: type, text: text, at: at}); + annos.push({ type: type, text: text, at: at }); }, error = function (m) { @@ -1711,7 +1711,7 @@ define("sense_editor/mode/worker_parser", ['require', 'exports', 'module' ], fun } } return reviver.call(holder, key, value); - })({'': result}, '') : result; + })({ '': result }, '') : result; }; }); @@ -1764,7 +1764,7 @@ define("sense_editor/mode/worker", ['require', 'exports', 'module' , 'ace/lib/oo var nl = this.doc.getNewLineCharacter().length; if (!len) { - return { row: 0, column: 0}; + return { row: 0, column: 0 }; } var lineStart = 0, line; diff --git a/src/core_plugins/console/public/src/settings.js b/src/core_plugins/console/public/src/settings.js index 49c11b37c79fd..da8a9c602e906 100644 --- a/src/core_plugins/console/public/src/settings.js +++ b/src/core_plugins/console/public/src/settings.js @@ -56,7 +56,7 @@ function getCurrentSettings() { }; } -function updateSettings({ fontSize, wrapMode, autocomplete}) { +function updateSettings({ fontSize, wrapMode, autocomplete }) { setFontSize(fontSize); setWrapMode(wrapMode); setAutocomplete(autocomplete); diff --git a/src/core_plugins/console/public/tests/src/curl_parsing_tests.js b/src/core_plugins/console/public/tests/src/curl_parsing_tests.js index 6eb35df9b1c98..be017912546af 100644 --- a/src/core_plugins/console/public/tests/src/curl_parsing_tests.js +++ b/src/core_plugins/console/public/tests/src/curl_parsing_tests.js @@ -2,7 +2,7 @@ let _ = require('lodash'); let curl = require('../../src/curl'); let curlTests = require('raw!./curl_parsing_tests.txt'); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("CURL"); diff --git a/src/core_plugins/console/public/tests/src/editor_tests.js b/src/core_plugins/console/public/tests/src/editor_tests.js index f73d1e5038c14..fa2862ed70d5d 100644 --- a/src/core_plugins/console/public/tests/src/editor_tests.js +++ b/src/core_plugins/console/public/tests/src/editor_tests.js @@ -4,7 +4,7 @@ let input = require('../../src/input'); let editor_input1 = require('raw!./editor_input1.txt'); var aceRange = ace.require("ace/range"); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Editor", { @@ -272,7 +272,7 @@ function multi_req_test(name, editor_input, range, expected) { } multi_req_test("mid body to mid body", editor_input1, - {start: {row: 12}, end: {row: 17}}, [{ + { start: { row: 12 }, end: { row: 17 } }, [{ method: "PUT", url: "index_1/type1/1", data: { @@ -287,7 +287,7 @@ multi_req_test("mid body to mid body", editor_input1, }]); multi_req_test("single request start to end", editor_input1, - {start: {row: 10}, end: {row: 13}}, [{ + { start: { row: 10 }, end: { row: 13 } }, [{ method: "PUT", url: "index_1/type1/1", data: { @@ -296,7 +296,7 @@ multi_req_test("single request start to end", editor_input1, }]); multi_req_test("start to end, with comment", editor_input1, - {start: {row: 6}, end: {row: 13}}, [{ + { start: { row: 6 }, end: { row: 13 } }, [{ method: "GET", url: "_stats?level=shards", data: null @@ -310,7 +310,7 @@ multi_req_test("start to end, with comment", editor_input1, }]); multi_req_test("before start to after end, with comments", editor_input1, - {start: {row: 4}, end: {row: 14}}, [{ + { start: { row: 4 }, end: { row: 14 } }, [{ method: "GET", url: "_stats?level=shards", data: null @@ -324,13 +324,13 @@ multi_req_test("before start to after end, with comments", editor_input1, }]); multi_req_test("between requests", editor_input1, - {start: {row: 21}, end: {row: 22}}, []); + { start: { row: 21 }, end: { row: 22 } }, []); multi_req_test("between requests - with comment", editor_input1, - {start: {row: 20}, end: {row: 22}}, []); + { start: { row: 20 }, end: { row: 22 } }, []); multi_req_test("between requests - before comment", editor_input1, - {start: {row: 19}, end: {row: 22}}, []); + { start: { row: 19 }, end: { row: 22 } }, []); function multi_req_copy_as_curl_test(name, editor_input, range, expected) { @@ -344,7 +344,7 @@ function multi_req_copy_as_curl_test(name, editor_input, range, expected) { multi_req_copy_as_curl_test("start to end, with comment", editor_input1, - {start: {row: 6}, end: {row: 13}}, ` + { start: { row: 6 }, end: { row: 13 } }, ` curl -XGET "http://localhost:9200/_stats?level=shards" #in between comment diff --git a/src/core_plugins/console/public/tests/src/integration_tests.js b/src/core_plugins/console/public/tests/src/integration_tests.js index aea330f7371d3..8439ec3b4a610 100644 --- a/src/core_plugins/console/public/tests/src/integration_tests.js +++ b/src/core_plugins/console/public/tests/src/integration_tests.js @@ -3,7 +3,7 @@ let kb = require('../../src/kb'); let mappings = require('../../src/mappings'); let $ = require('jquery'); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Integration", { setup: function () { @@ -96,7 +96,7 @@ function process_context_test(data, mapping, kb_schemes, request_line, test) { if (test["autoCompleteSet"]) { var expected_terms = _.map(test["autoCompleteSet"], function (t) { if (typeof t !== "object") { - t = {"name": t}; + t = { "name": t }; } return t; }); @@ -173,13 +173,13 @@ var SEARCH_KB = { "_search" ], data_autocomplete_rules: { - query: {match_all: {}, term: {"{field}": {__template: {"f": 1}}}}, + query: { match_all: {}, term: { "{field}": { __template: { "f": 1 } } } }, size: {}, facets: { __template: { "FIELD": {} }, - "*": {terms: {field: "{field}"}} + "*": { terms: { field: "{field}" } } } } } @@ -190,16 +190,16 @@ var MAPPING = { "index1": { "type1.1": { "properties": { - "field1.1.1": {"type": "string"}, - "field1.1.2": {"type": "string"} + "field1.1.1": { "type": "string" }, + "field1.1.2": { "type": "string" } } } }, "index2": { "type2.1": { "properties": { - "field2.1.1": {"type": "string"}, - "field2.1.2": {"type": "string"} + "field2.1.1": { "type": "string" }, + "field2.1.2": { "type": "string" } } } } @@ -213,12 +213,12 @@ context_tests( [ { name: "Empty doc", - cursor: {row: 0, column: 1}, + cursor: { row: 0, column: 1 }, initialValue: "", addTemplate: true, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 0, column: 1}, end: {row: 0, column: 1}}, + rangeToReplace: { start: { row: 0, column: 1 }, end: { row: 0, column: 1 } }, autoCompleteSet: ["facets", "query", "size"] } ] @@ -232,7 +232,7 @@ context_tests( [ { name: "Missing KB", - cursor: {row: 0, column: 1}, + cursor: { row: 0, column: 1 }, no_context: true } ] @@ -257,7 +257,7 @@ context_tests( [ { name: "Missing KB - global auto complete", - cursor: {row: 2, column: 5}, + cursor: { row: 2, column: 5 }, autoCompleteSet: ["t1"] } ] @@ -277,37 +277,37 @@ context_tests( [ { name: "existing dictionary key, no template", - cursor: {row: 1, column: 6}, + cursor: { row: 1, column: 6 }, initialValue: "query", addTemplate: false, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 1, column: 3}, end: {row: 1, column: 10}}, + rangeToReplace: { start: { row: 1, column: 3 }, end: { row: 1, column: 10 } }, autoCompleteSet: ["facets", "query", "size"] }, { name: "existing inner dictionary key", - cursor: {row: 2, column: 7}, + cursor: { row: 2, column: 7 }, initialValue: "field", addTemplate: false, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 2, column: 6}, end: {row: 2, column: 13}}, + rangeToReplace: { start: { row: 2, column: 6 }, end: { row: 2, column: 13 } }, autoCompleteSet: ["match_all", "term"] }, { name: "existing dictionary key, yes template", - cursor: {row: 4, column: 7}, + cursor: { row: 4, column: 7 }, initialValue: "facets", addTemplate: true, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 4, column: 3}, end: {row: 4, column: 15}}, + rangeToReplace: { start: { row: 4, column: 3 }, end: { row: 4, column: 15 } }, autoCompleteSet: ["facets", "query", "size"] }, { name: "ignoring meta keys", - cursor: {row: 4, column: 14}, + cursor: { row: 4, column: 14 }, no_context: true } ] @@ -327,42 +327,42 @@ context_tests( [ { name: "trailing comma, end of line", - cursor: {row: 4, column: 16}, + cursor: { row: 4, column: 16 }, initialValue: "", addTemplate: true, prefixToAdd: "", suffixToAdd: ", ", - rangeToReplace: {start: {row: 4, column: 16}, end: {row: 4, column: 16}}, + rangeToReplace: { start: { row: 4, column: 16 }, end: { row: 4, column: 16 } }, autoCompleteSet: ["facets", "query", "size"] }, { name: "trailing comma, beginning of line", - cursor: {row: 5, column: 1}, + cursor: { row: 5, column: 1 }, initialValue: "", addTemplate: true, prefixToAdd: "", suffixToAdd: ", ", - rangeToReplace: {start: {row: 5, column: 1}, end: {row: 5, column: 1}}, + rangeToReplace: { start: { row: 5, column: 1 }, end: { row: 5, column: 1 } }, autoCompleteSet: ["facets", "query", "size"] }, { name: "prefix comma, beginning of line", - cursor: {row: 6, column: 0}, + cursor: { row: 6, column: 0 }, initialValue: "", addTemplate: true, prefixToAdd: ", ", suffixToAdd: "", - rangeToReplace: {start: {row: 6, column: 0}, end: {row: 6, column: 0}}, + rangeToReplace: { start: { row: 6, column: 0 }, end: { row: 6, column: 0 } }, autoCompleteSet: ["facets", "query", "size"] }, { name: "prefix comma, end of line", - cursor: {row: 5, column: 14}, + cursor: { row: 5, column: 14 }, initialValue: "", addTemplate: true, prefixToAdd: ", ", suffixToAdd: "", - rangeToReplace: {start: {row: 5, column: 14}, end: {row: 5, column: 14}}, + rangeToReplace: { start: { row: 5, column: 14 }, end: { row: 5, column: 14 } }, autoCompleteSet: ["facets", "query", "size"] } @@ -385,11 +385,11 @@ context_tests( "_test" ], data_autocomplete_rules: { - object: {bla: 1}, + object: { bla: 1 }, array: [1], - value_one_of: {__one_of: [1, 2]}, + value_one_of: { __one_of: [1, 2] }, value: 3, - "*": {__one_of: [4, 5]} + "*": { __one_of: [4, 5] } } } } @@ -398,31 +398,31 @@ context_tests( [ { name: "not matching object when { is not opened", - cursor: {row: 1, column: 12}, + cursor: { row: 1, column: 12 }, initialValue: "", autoCompleteSet: ["{"] }, { name: "not matching array when [ is not opened", - cursor: {row: 2, column: 12}, + cursor: { row: 2, column: 12 }, initialValue: "", autoCompleteSet: ["["] }, { name: "matching value with one_of", - cursor: {row: 3, column: 19}, + cursor: { row: 3, column: 19 }, initialValue: "", autoCompleteSet: [1, 2] }, { name: "matching value", - cursor: {row: 4, column: 12}, + cursor: { row: 4, column: 12 }, initialValue: "", autoCompleteSet: [3] }, { name: "matching any value with one_of", - cursor: {row: 5, column: 21}, + cursor: { row: 5, column: 21 }, initialValue: "", autoCompleteSet: [4, 5] } @@ -445,14 +445,14 @@ context_tests( [ { name: "* matching everything", - cursor: {row: 5, column: 15}, + cursor: { row: 5, column: 15 }, initialValue: "", addTemplate: true, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 5, column: 15}, end: {row: 5, column: 15}}, + rangeToReplace: { start: { row: 5, column: 15 }, end: { row: 5, column: 15 } }, autoCompleteSet: [ - {name: "terms", meta: "API"} + { name: "terms", meta: "API" } ] } ] @@ -479,17 +479,17 @@ context_tests( [ { name: "{index} matching", - cursor: {row: 1, column: 15}, + cursor: { row: 1, column: 15 }, autoCompleteSet: [ - {name: "index1", meta: "index"}, - {name: "index2", meta: "index"} + { name: "index1", meta: "index" }, + { name: "index2", meta: "index" } ] } ] ); function tt(term, template, meta) { - term = {name: term, template: template}; + term = { name: term, template: template }; if (meta) { term.meta = meta; } @@ -514,8 +514,8 @@ context_tests( array: ["a", "b"], number: 1, object: {}, - fixed: {__template: {"a": 1}}, - oneof: {__one_of: ["o1", "o2"]} + fixed: { __template: { "a": 1 } }, + oneof: { __one_of: ["o1", "o2"] } } } } @@ -524,14 +524,14 @@ context_tests( [ { name: "Templates 1", - cursor: {row: 1, column: 0}, + cursor: { row: 1, column: 0 }, autoCompleteSet: [ - tt("array", []), tt("fixed", {a: 1}), tt("number", 1), tt("object", {}), tt("oneof", "o1") + tt("array", []), tt("fixed", { a: 1 }), tt("number", 1), tt("object", {}), tt("oneof", "o1") ] }, { name: "Templates - one off", - cursor: {row: 4, column: 12}, + cursor: { row: 4, column: 12 }, autoCompleteSet: [tt("o1"), tt("o2")] } ] @@ -561,7 +561,7 @@ context_tests( lines_regex: "other" }, "no_match": {} - }, {"always": {}}] + }, { "always": {} }] } } } @@ -571,7 +571,7 @@ context_tests( [ { name: "Conditionals", - cursor: {row: 2, column: 15}, + cursor: { row: 2, column: 15 }, autoCompleteSet: [ tt("always", {}), tt("match", {}) ] @@ -605,18 +605,18 @@ context_tests( "_endpoint" ], data_autocomplete_rules: { - any_of_numbers: {__template: [1, 2], __any_of: [1, 2, 3]}, + any_of_numbers: { __template: [1, 2], __any_of: [1, 2, 3] }, any_of_obj: { __template: [ - {c: 1} + { c: 1 } ], __any_of: [ - {a: 1, b: 2}, - {c: 1} + { a: 1, b: 2 }, + { c: 1 } ] }, any_of_mixed: { __any_of: [ - {a: 1}, + { a: 1 }, 3 ] } @@ -628,37 +628,37 @@ context_tests( [ { name: "Any of - templates", - cursor: {row: 1, column: 0}, + cursor: { row: 1, column: 0 }, autoCompleteSet: [ tt("any_of_mixed", []), tt("any_of_numbers", [1, 2]), tt("any_of_obj", [ - {c: 1} + { c: 1 } ]) ] }, { name: "Any of - numbers", - cursor: {row: 2, column: 2}, + cursor: { row: 2, column: 2 }, autoCompleteSet: [1, 2, 3] }, { name: "Any of - object", - cursor: {row: 6, column: 2}, + cursor: { row: 6, column: 2 }, autoCompleteSet: [ tt("a", 1), tt("b", 2), tt("c", 1) ] }, { name: "Any of - mixed - obj", - cursor: {row: 11, column: 2}, + cursor: { row: 11, column: 2 }, autoCompleteSet: [ tt("a", 1) ] }, { name: "Any of - mixed - both", - cursor: {row: 13, column: 2}, + cursor: { row: 13, column: 2 }, autoCompleteSet: [ tt("{"), tt(3) ] @@ -683,7 +683,7 @@ context_tests( [ { name: "Empty string as default", - cursor: {row: 0, column: 1}, + cursor: { row: 0, column: 1 }, autoCompleteSet: [tt("query", "")] } ] @@ -765,7 +765,7 @@ context_tests( [ { name: "Relative scope link test", - cursor: {row: 2, column: 12}, + cursor: { row: 2, column: 12 }, autoCompleteSet: [ tt("b", {}), tt("c", {}), tt("d", {}), tt("e", {}), tt("f", [ {} @@ -774,37 +774,37 @@ context_tests( }, { name: "External scope link test", - cursor: {row: 3, column: 12}, + cursor: { row: 3, column: 12 }, autoCompleteSet: [tt("t2", 1)] }, { name: "Global scope link test", - cursor: {row: 4, column: 12}, + cursor: { row: 4, column: 12 }, autoCompleteSet: [tt("t1", 2), tt("t1a", {})] }, { name: "Global scope link with an internal scope link", - cursor: {row: 5, column: 17}, + cursor: { row: 5, column: 17 }, autoCompleteSet: [tt("t1", 2), tt("t1a", {})] }, { name: "Entire endpoint scope link test", - cursor: {row: 7, column: 12}, + cursor: { row: 7, column: 12 }, autoCompleteSet: [tt("target", {})] }, { name: "A scope link within an array", - cursor: {row: 9, column: 10}, + cursor: { row: 9, column: 10 }, autoCompleteSet: [tt("t2", 1)] }, { name: "A function based scope link", - cursor: {row: 11, column: 12}, + cursor: { row: 11, column: 12 }, autoCompleteSet: [tt("a", 1), tt("b", 2)] }, { name: "A global scope link with wrong link", - cursor: {row: 12, column: 12}, + cursor: { row: 12, column: 12 }, assertThrows: /broken/ } @@ -834,7 +834,7 @@ context_tests( [ { name: "Top level scope link", - cursor: {row: 0, column: 1}, + cursor: { row: 0, column: 1 }, autoCompleteSet: [ tt("t1", 2) ] @@ -862,7 +862,7 @@ context_tests( [ { name: "Path after empty object", - cursor: {row: 1, column: 10}, + cursor: { row: 1, column: 10 }, autoCompleteSet: ["a", "b"] } ] @@ -878,8 +878,8 @@ context_tests( [ { name: "Replace an empty string", - cursor: {row: 1, column: 4}, - rangeToReplace: {start: {row: 1, column: 3}, end: {row: 1, column: 9}} + cursor: { row: 1, column: 4 }, + rangeToReplace: { start: { row: 1, column: 3 }, end: { row: 1, column: 9 } } } ] ); @@ -899,7 +899,7 @@ context_tests( patterns: ["_endpoint"], data_autocomplete_rules: { "a": [ - {b: 1} + { b: 1 } ] } } @@ -909,12 +909,12 @@ context_tests( [ { name: "List of objects - internal autocomplete", - cursor: {row: 3, column: 10}, + cursor: { row: 3, column: 10 }, autoCompleteSet: ["b"] }, { name: "List of objects - external template", - cursor: {row: 0, column: 1}, + cursor: { row: 0, column: 1 }, autoCompleteSet: [tt("a", [ {} ])] @@ -944,15 +944,15 @@ context_tests( [ { name: "Field completion as scope", - cursor: {row: 3, column: 10}, - autoCompleteSet: [tt("field1.1.1", {"f": 1}, "string"), tt("field1.1.2", {"f": 1}, "string")] + cursor: { row: 3, column: 10 }, + autoCompleteSet: [tt("field1.1.1", { "f": 1 }, "string"), tt("field1.1.2", { "f": 1 }, "string")] }, { name: "Field completion as value", - cursor: {row: 9, column: 23}, + cursor: { row: 9, column: 23 }, autoCompleteSet: [ - {name: "field1.1.1", meta: "string"}, - {name: "field1.1.2", meta: "string"} + { name: "field1.1.1", meta: "string" }, + { name: "field1.1.2", meta: "string" } ] } ] @@ -967,7 +967,7 @@ context_tests( [ { name: "initial doc start", - cursor: {row: 1, column: 0}, + cursor: { row: 1, column: 0 }, autoCompleteSet: ["{"], prefixToAdd: "", suffixToAdd: "" @@ -988,14 +988,14 @@ context_tests( [ { name: "Cursor rows after request end", - cursor: {row: 4, column: 0}, + cursor: { row: 4, column: 0 }, autoCompleteSet: ["GET", "PUT", "POST", "DELETE", "HEAD"], prefixToAdd: "", suffixToAdd: " " }, { name: "Cursor just after request end", - cursor: {row: 2, column: 1}, + cursor: { row: 2, column: 1 }, no_context: true } @@ -1033,7 +1033,7 @@ context_tests( [ { name: "Endpoints with slashes - no slash", - cursor: {row: 0, column: 8}, + cursor: { row: 0, column: 8 }, autoCompleteSet: ["_cluster/nodes/stats", "_cluster/stats", "_search", "index1", "index2"], prefixToAdd: "", suffixToAdd: "" @@ -1049,21 +1049,21 @@ context_tests( [ { name: "Endpoints with slashes - before slash", - cursor: {row: 0, column: 7}, + cursor: { row: 0, column: 7 }, autoCompleteSet: ["_cluster/nodes/stats", "_cluster/stats", "_search", "index1", "index2"], prefixToAdd: "", suffixToAdd: "" }, { name: "Endpoints with slashes - on slash", - cursor: {row: 0, column: 12}, + cursor: { row: 0, column: 12 }, autoCompleteSet: ["_cluster/nodes/stats", "_cluster/stats", "_search", "index1", "index2"], prefixToAdd: "", suffixToAdd: "" }, { name: "Endpoints with slashes - after slash", - cursor: {row: 0, column: 13}, + cursor: { row: 0, column: 13 }, autoCompleteSet: ["nodes/stats", "stats"], prefixToAdd: "", suffixToAdd: "" @@ -1079,10 +1079,10 @@ context_tests( [ { name: "Endpoints with slashes - after slash", - cursor: {row: 0, column: 14}, + cursor: { row: 0, column: 14 }, autoCompleteSet: [ - {name: "nodes/stats", meta: "endpoint"}, - {name: "stats", meta: "endpoint"} + { name: "nodes/stats", meta: "endpoint" }, + { name: "stats", meta: "endpoint" } ], prefixToAdd: "", suffixToAdd: "", @@ -1099,7 +1099,7 @@ context_tests( [ { name: "Endpoints with two slashes", - cursor: {row: 0, column: 20}, + cursor: { row: 0, column: 20 }, autoCompleteSet: ["stats"], prefixToAdd: "", suffixToAdd: "", @@ -1116,13 +1116,13 @@ context_tests( [ { name: "Immediately after space + method", - cursor: {row: 0, column: 4}, + cursor: { row: 0, column: 4 }, autoCompleteSet: [ - {name: "_cluster/nodes/stats", meta: "endpoint"}, - {name: "_cluster/stats", meta: "endpoint"}, - {name: "_search", meta: "endpoint"}, - {name: "index1", meta: "index"}, - {name: "index2", meta: "index"} + { name: "_cluster/nodes/stats", meta: "endpoint" }, + { name: "_cluster/stats", meta: "endpoint" }, + { name: "_search", meta: "endpoint" }, + { name: "index1", meta: "index" }, + { name: "index2", meta: "index" } ], prefixToAdd: "", suffixToAdd: "", @@ -1139,13 +1139,13 @@ context_tests( [ { name: "Endpoints by subpart", - cursor: {row: 0, column: 6}, + cursor: { row: 0, column: 6 }, autoCompleteSet: [ - {name: "_cluster/nodes/stats", meta: "endpoint"}, - {name: "_cluster/stats", meta: "endpoint"}, - {name: "_search", meta: "endpoint"}, - {name: "index1", meta: "index"}, - {name: "index2", meta: "index"} + { name: "_cluster/nodes/stats", meta: "endpoint" }, + { name: "_cluster/stats", meta: "endpoint" }, + { name: "_search", meta: "endpoint" }, + { name: "index1", meta: "index" }, + { name: "index2", meta: "index" } ], prefixToAdd: "", suffixToAdd: "", @@ -1162,13 +1162,13 @@ context_tests( [ { name: "Endpoints by subpart", - cursor: {row: 0, column: 7}, + cursor: { row: 0, column: 7 }, autoCompleteSet: [ - {name: "_cluster/nodes/stats", meta: "endpoint"}, - {name: "_cluster/stats", meta: "endpoint"}, - {name: "_search", meta: "endpoint"}, - {name: "index1", meta: "index"}, - {name: "index2", meta: "index"} + { name: "_cluster/nodes/stats", meta: "endpoint" }, + { name: "_cluster/stats", meta: "endpoint" }, + { name: "_search", meta: "endpoint" }, + { name: "index1", meta: "index" }, + { name: "index2", meta: "index" } ], prefixToAdd: "", suffixToAdd: "", @@ -1186,13 +1186,13 @@ context_tests( [ { name: "Params just after ?", - cursor: {row: 0, column: 12}, + cursor: { row: 0, column: 12 }, autoCompleteSet: [ - {name: "filter_path", meta: "param", "insert_value": "filter_path="}, - {name: "format", meta: "param", "insert_value": "format="}, - {name: "pretty", meta: "flag"}, - {name: "scroll", meta: "param", "insert_value": "scroll="}, - {name: "search_type", meta: "param", "insert_value": "search_type="}, + { name: "filter_path", meta: "param", "insert_value": "filter_path=" }, + { name: "format", meta: "param", "insert_value": "format=" }, + { name: "pretty", meta: "flag" }, + { name: "scroll", meta: "param", "insert_value": "scroll=" }, + { name: "search_type", meta: "param", "insert_value": "search_type=" }, ], prefixToAdd: "", suffixToAdd: "" @@ -1208,10 +1208,10 @@ context_tests( [ { name: "Params values", - cursor: {row: 0, column: 19}, + cursor: { row: 0, column: 19 }, autoCompleteSet: [ - {name: "json", meta: "format"}, - {name: "yaml", meta: "format"} + { name: "json", meta: "format" }, + { name: "yaml", meta: "format" } ], prefixToAdd: "", suffixToAdd: "" @@ -1227,13 +1227,13 @@ context_tests( [ { name: "Params after amp", - cursor: {row: 0, column: 24}, + cursor: { row: 0, column: 24 }, autoCompleteSet: [ - {name: "filter_path", meta: "param", "insert_value": "filter_path="}, - {name: "format", meta: "param", "insert_value": "format="}, - {name: "pretty", meta: "flag"}, - {name: "scroll", meta: "param", "insert_value": "scroll="}, - {name: "search_type", meta: "param", "insert_value": "search_type="}, + { name: "filter_path", meta: "param", "insert_value": "filter_path=" }, + { name: "format", meta: "param", "insert_value": "format=" }, + { name: "pretty", meta: "flag" }, + { name: "scroll", meta: "param", "insert_value": "scroll=" }, + { name: "search_type", meta: "param", "insert_value": "search_type=" }, ], prefixToAdd: "", suffixToAdd: "" @@ -1249,17 +1249,17 @@ context_tests( [ { name: "Params on existing param", - cursor: {row: 0, column: 26}, + cursor: { row: 0, column: 26 }, rangeToReplace: { - start: {row: 0, column: 24}, - end: {row: 0, column: 30} + start: { row: 0, column: 24 }, + end: { row: 0, column: 30 } }, autoCompleteSet: [ - {name: "filter_path", meta: "param", "insert_value": "filter_path="}, - {name: "format", meta: "param", "insert_value": "format="}, - {name: "pretty", meta: "flag"}, - {name: "scroll", meta: "param", "insert_value": "scroll="}, - {name: "search_type", meta: "param", "insert_value": "search_type="}, + { name: "filter_path", meta: "param", "insert_value": "filter_path=" }, + { name: "format", meta: "param", "insert_value": "format=" }, + { name: "pretty", meta: "flag" }, + { name: "scroll", meta: "param", "insert_value": "scroll=" }, + { name: "search_type", meta: "param", "insert_value": "search_type=" }, ], prefixToAdd: "", suffixToAdd: "" @@ -1275,14 +1275,14 @@ context_tests( [ { name: "Params on existing value", - cursor: {row: 0, column: 37}, + cursor: { row: 0, column: 37 }, rangeToReplace: { - start: {row: 0, column: 36}, - end: {row: 0, column: 39} + start: { row: 0, column: 36 }, + end: { row: 0, column: 39 } }, autoCompleteSet: [ - {name: "count", meta: "search_type"}, - {name: "query_then_fetch", meta: "search_type"}, + { name: "count", meta: "search_type" }, + { name: "query_then_fetch", meta: "search_type" }, ], prefixToAdd: "", suffixToAdd: "" @@ -1297,14 +1297,14 @@ context_tests( [ { name: "Params on just after = with existing value", - cursor: {row: 0, column: 36}, + cursor: { row: 0, column: 36 }, rangeToReplace: { - start: {row: 0, column: 36}, - end: {row: 0, column: 36} + start: { row: 0, column: 36 }, + end: { row: 0, column: 36 } }, autoCompleteSet: [ - {name: "count", meta: "search_type"}, - {name: "query_then_fetch", meta: "search_type"}, + { name: "count", meta: "search_type" }, + { name: "query_then_fetch", meta: "search_type" }, ], prefixToAdd: "", suffixToAdd: "" @@ -1327,32 +1327,32 @@ context_tests( [ { name: "fullurl - existing dictionary key, no template", - cursor: {row: 1, column: 6}, + cursor: { row: 1, column: 6 }, initialValue: "query", addTemplate: false, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 1, column: 3}, end: {row: 1, column: 10}}, + rangeToReplace: { start: { row: 1, column: 3 }, end: { row: 1, column: 10 } }, autoCompleteSet: ["facets", "query", "size"] }, { name: "fullurl - existing inner dictionary key", - cursor: {row: 2, column: 7}, + cursor: { row: 2, column: 7 }, initialValue: "field", addTemplate: false, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 2, column: 6}, end: {row: 2, column: 13}}, + rangeToReplace: { start: { row: 2, column: 6 }, end: { row: 2, column: 13 } }, autoCompleteSet: ["match_all", "term"] }, { name: "fullurl - existing dictionary key, yes template", - cursor: {row: 4, column: 7}, + cursor: { row: 4, column: 7 }, initialValue: "facets", addTemplate: true, prefixToAdd: "", suffixToAdd: "", - rangeToReplace: {start: {row: 4, column: 3}, end: {row: 4, column: 15}}, + rangeToReplace: { start: { row: 4, column: 3 }, end: { row: 4, column: 15 } }, autoCompleteSet: ["facets", "query", "size"] } ] diff --git a/src/core_plugins/console/public/tests/src/kb_tests.js b/src/core_plugins/console/public/tests/src/kb_tests.js index f9a51bbbb6b19..10190395d699d 100644 --- a/src/core_plugins/console/public/tests/src/kb_tests.js +++ b/src/core_plugins/console/public/tests/src/kb_tests.js @@ -2,7 +2,7 @@ let kb = require('../../src/kb'); let mappings = require('../../src/mappings'); let autocomplete_engine = require('../../src/autocomplete/engine'); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Knowledge base", { setup: function () { @@ -19,8 +19,8 @@ var MAPPING = { "index1": { "type1.1": { "properties": { - "field1.1.1": {"type": "string"}, - "field1.1.2": {"type": "long"} + "field1.1.1": { "type": "string" }, + "field1.1.2": { "type": "long" } } }, "type1.2": { @@ -30,8 +30,8 @@ var MAPPING = { "index2": { "type2.1": { "properties": { - "field2.1.1": {"type": "string"}, - "field2.1.2": {"type": "string"} + "field2.1.1": { "type": "string" }, + "field2.1.2": { "type": "string" } } } } @@ -42,13 +42,13 @@ function testUrlContext(tokenPath, otherTokenValues, expectedContext) { if (expectedContext.autoCompleteSet) { expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) { if (_.isString(t)) { - t = {name: t} + t = { name: t } } return t; }) } - var context = {otherTokenValues: otherTokenValues}; + var context = { otherTokenValues: otherTokenValues }; autocomplete_engine.populateContext(tokenPath, context, null, expectedContext.autoCompleteSet, kb.getTopLevelUrlCompleteComponents() ); @@ -62,7 +62,7 @@ function testUrlContext(tokenPath, otherTokenValues, expectedContext) { function norm(t) { if (_.isString(t)) { - return {name: t}; + return { name: t }; } return t; } @@ -78,11 +78,11 @@ function testUrlContext(tokenPath, otherTokenValues, expectedContext) { } function t(term) { - return {name: term, meta: "type"}; + return { name: term, meta: "type" }; } function i(term) { - return {name: term, meta: "index"}; + return { name: term, meta: "index" }; } function index_test(name, tokenPath, otherTokenValues, expectedContext) { @@ -93,7 +93,7 @@ function index_test(name, tokenPath, otherTokenValues, expectedContext) { _multi_indices: { patterns: ["{indices}/_multi_indices"] }, - _single_index: {patterns: ["{index}/_single_index"]}, + _single_index: { patterns: ["{index}/_single_index"] }, _no_index: { // testing default patters // patterns: ["_no_index"] @@ -110,22 +110,22 @@ function index_test(name, tokenPath, otherTokenValues, expectedContext) { } index_test("Index integration 1", [], [], - {autoCompleteSet: ["_no_index", i("index1"), i("index2")]} + { autoCompleteSet: ["_no_index", i("index1"), i("index2")] } ); index_test("Index integration 2", [], ["index1"], // still return _no_index as index1 is not committed to yet. - {autoCompleteSet: ["_no_index", i("index2")]} + { autoCompleteSet: ["_no_index", i("index2")] } ); index_test("Index integration 2", ["index1"], [], - {indices: ["index1"], autoCompleteSet: ["_multi_indices", "_single_index"]} + { indices: ["index1"], autoCompleteSet: ["_multi_indices", "_single_index"] } ); index_test("Index integration 2", [ ["index1", "index2"] ], [], - {indices: ["index1", "index2"], autoCompleteSet: ["_multi_indices"]} + { indices: ["index1", "index2"], autoCompleteSet: ["_multi_indices"] } ); function type_test(name, tokenPath, otherTokenValues, expectedContext) { @@ -133,9 +133,9 @@ function type_test(name, tokenPath, otherTokenValues, expectedContext) { var test_api = kb._test.loadApisFromJson({ "type_test": { endpoints: { - _multi_types: {patterns: ["{indices}/{types}/_multi_types"]}, - _single_type: {patterns: ["{indices}/{type}/_single_type"]}, - _no_types: {patterns: ["{indices}/_no_types"]} + _multi_types: { patterns: ["{indices}/{types}/_multi_types"] }, + _single_type: { patterns: ["{indices}/{type}/_single_type"] }, + _no_types: { patterns: ["{indices}/_no_types"] } } } }, kb._test.globalUrlComponentFactories); @@ -149,24 +149,24 @@ function type_test(name, tokenPath, otherTokenValues, expectedContext) { } type_test("Type integration 1", ["index1"], [], - {indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1"), t("type1.2")]} + { indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1"), t("type1.2")] } ); type_test("Type integration 2", ["index1"], ["type1.2"], // we are not yet comitted to type1.2, so _no_types is returned - {indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1")]} + { indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1")] } ); type_test("Type integration 3", ["index2"], [], - {indices: ["index2"], autoCompleteSet: ["_no_types", t("type2.1")]} + { indices: ["index2"], autoCompleteSet: ["_no_types", t("type2.1")] } ); type_test("Type integration 4", ["index1", "type1.2"], [], - {indices: ["index1"], types: ["type1.2"], autoCompleteSet: ["_multi_types", "_single_type"]} + { indices: ["index1"], types: ["type1.2"], autoCompleteSet: ["_multi_types", "_single_type"] } ); type_test("Type integration 5", [ ["index1", "index2"], ["type1.2", "type1.1"] ], [], - {indices: ["index1", "index2"], types: ["type1.2", "type1.1"], autoCompleteSet: ["_multi_types"]} + { indices: ["index1", "index2"], types: ["type1.2", "type1.1"], autoCompleteSet: ["_multi_types"] } ); diff --git a/src/core_plugins/console/public/tests/src/mapping_tests.js b/src/core_plugins/console/public/tests/src/mapping_tests.js index cd79c6f3d4c54..b6a2c2271026e 100644 --- a/src/core_plugins/console/public/tests/src/mapping_tests.js +++ b/src/core_plugins/console/public/tests/src/mapping_tests.js @@ -1,6 +1,6 @@ let mappings = require('../../src/mappings'); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Mappings", { setup: function () { @@ -22,7 +22,7 @@ function fc(f1, f2) { } function f(name, type) { - return {name: name, type: type || "string"}; + return { name: name, type: type || "string" }; } test("Multi fields", function () { @@ -34,16 +34,16 @@ test("Multi fields", function () { "type": "multi_field", "path": "just_name", "fields": { - "first_name": {"type": "string", "index": "analyzed"}, - "any_name": {"type": "string", "index": "analyzed"} + "first_name": { "type": "string", "index": "analyzed" }, + "any_name": { "type": "string", "index": "analyzed" } } }, "last_name": { "type": "multi_field", "path": "just_name", "fields": { - "last_name": {"type": "string", "index": "analyzed"}, - "any_name": {"type": "string", "index": "analyzed"} + "last_name": { "type": "string", "index": "analyzed" }, + "any_name": { "type": "string", "index": "analyzed" } } } } @@ -64,13 +64,13 @@ test("Multi fields 1.0 style", function () { "type": "string", "index": "analyzed", "path": "just_name", "fields": { - "any_name": {"type": "string", "index": "analyzed"} + "any_name": { "type": "string", "index": "analyzed" } } }, "last_name": { "type": "string", "index": "no", "fields": { - "raw": {"type": "string", "index": "analyzed"} + "raw": { "type": "string", "index": "analyzed" } } } } @@ -132,14 +132,14 @@ QUnit.test("Nested fields", function () { "properties": { "name": { "properties": { - "first_name": {"type": "string"}, - "last_name": {"type": "string"} + "first_name": { "type": "string" }, + "last_name": { "type": "string" } } }, - "sid": {"type": "string", "index": "not_analyzed"} + "sid": { "type": "string", "index": "not_analyzed" } } }, - "message": {"type": "string"} + "message": { "type": "string" } } } } @@ -161,10 +161,10 @@ test("Enabled fields", function () { "type": "object", "enabled": false }, - "sid": {"type": "string", "index": "not_analyzed"} + "sid": { "type": "string", "index": "not_analyzed" } } }, - "message": {"type": "string"} + "message": { "type": "string" } } } } @@ -184,16 +184,16 @@ test("Path tests", function () { "type": "object", "path": "just_name", "properties": { - "first1": {"type": "string"}, - "last1": {"type": "string", "index_name": "i_last_1"} + "first1": { "type": "string" }, + "last1": { "type": "string", "index_name": "i_last_1" } } }, "name2": { "type": "object", "path": "full", "properties": { - "first2": {"type": "string"}, - "last2": {"type": "string", "index_name": "i_last_2"} + "first2": { "type": "string" }, + "last2": { "type": "string", "index_name": "i_last_2" } } } } @@ -210,7 +210,7 @@ test("Use index_name tests", function () { "index": { "person": { "properties": { - "last1": {"type": "string", "index_name": "i_last_1"} + "last1": { "type": "string", "index_name": "i_last_1" } } } } @@ -244,14 +244,14 @@ test("Aliases", function () { "test_index1": { "type1": { "properties": { - "last1": {"type": "string", "index_name": "i_last_1"} + "last1": { "type": "string", "index_name": "i_last_1" } } } }, "test_index2": { "type2": { "properties": { - "last1": {"type": "string", "index_name": "i_last_1"} + "last1": { "type": "string", "index_name": "i_last_1" } } } } diff --git a/src/core_plugins/console/public/tests/src/tokenization_tests.js b/src/core_plugins/console/public/tests/src/tokenization_tests.js index 5162609d9dd9a..66a950aa48542 100644 --- a/src/core_plugins/console/public/tests/src/tokenization_tests.js +++ b/src/core_plugins/console/public/tests/src/tokenization_tests.js @@ -3,7 +3,7 @@ let $ = require('jquery'); let input = require('../../src/input'); var token_iterator = ace.require("ace/token_iterator"); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Tokenization", { setup: function () { @@ -24,7 +24,7 @@ function tokensAsList() { t = input.parser.nextNonEmptyToken(iter); } while (t) { - ret.push({value: t.value, type: t.type}); + ret.push({ value: t.value, type: t.type }); t = input.parser.nextNonEmptyToken(iter); } @@ -51,7 +51,7 @@ function token_test(token_list, prefix, data) { var tokens = tokensAsList(); var normTokenList = []; for (var i = 0; i < token_list.length; i++) { - normTokenList.push({type: token_list[i++], value: token_list[i]}); + normTokenList.push({ type: token_list[i++], value: token_list[i] }); } deepEqual(tokens, normTokenList, "Doc:\n" + data); diff --git a/src/core_plugins/console/public/tests/src/url_autocomplete_tests.js b/src/core_plugins/console/public/tests/src/url_autocomplete_tests.js index e6f63c2a4398a..a639f46821e24 100644 --- a/src/core_plugins/console/public/tests/src/url_autocomplete_tests.js +++ b/src/core_plugins/console/public/tests/src/url_autocomplete_tests.js @@ -2,7 +2,7 @@ let _ = require('lodash'); let url_pattern_matcher = require('../../src/autocomplete/url_pattern_matcher'); let autocomplete_engine = require('../../src/autocomplete/engine'); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Url autocomplete"); @@ -32,7 +32,7 @@ function patterns_test(name, endpoints, tokenPath, expectedContext, globalUrlCom if (expectedContext.autoCompleteSet) { expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) { if (_.isString(t)) { - t = {name: t} + t = { name: t } } return t; }); @@ -63,7 +63,7 @@ function patterns_test(name, endpoints, tokenPath, expectedContext, globalUrlCom function t(name, meta) { if (meta) { - return {name: name, meta: meta}; + return { name: name, meta: meta }; } return name; } @@ -79,14 +79,14 @@ function t(name, meta) { patterns_test("simple single path - completion", endpoints, "a/b$", - {endpoint: "1"} + { endpoint: "1" } ); patterns_test("simple single path - completion, with auto complete", endpoints, "a/b", - {autoCompleteSet: []} + { autoCompleteSet: [] } ); patterns_test("simple single path - partial, without auto complete", @@ -98,13 +98,13 @@ function t(name, meta) { patterns_test("simple single path - partial, with auto complete", endpoints, "a", - {autoCompleteSet: ["b"]} + { autoCompleteSet: ["b"] } ); patterns_test("simple single path - partial, with auto complete", endpoints, [], - {autoCompleteSet: ["a/b"]} + { autoCompleteSet: ["a/b"] } ); patterns_test("simple single path - different path", @@ -132,31 +132,31 @@ function t(name, meta) { patterns_test("shared path - completion 1", endpoints, "a/b$", - {endpoint: "1"} + { endpoint: "1" } ); patterns_test("shared path - completion 2", endpoints, "a/c$", - {endpoint: "2"} + { endpoint: "2" } ); patterns_test("shared path - completion 1 with param", endpoints, "a/b/v$", - {endpoint: "1", p: "v"} + { endpoint: "1", p: "v" } ); patterns_test("shared path - partial, with auto complete", endpoints, "a", - {autoCompleteSet: ["b", "c"]} + { autoCompleteSet: ["b", "c"] } ); patterns_test("shared path - partial, with auto complete of param, no options", endpoints, "a/b", - {autoCompleteSet: []} + { autoCompleteSet: [] } ); patterns_test("shared path - partial, without auto complete", @@ -168,7 +168,7 @@ function t(name, meta) { patterns_test("shared path - different path - with auto complete", endpoints, "a/e", - {autoCompleteSet: []} + { autoCompleteSet: [] } ); patterns_test("shared path - different path - without auto complete", @@ -198,25 +198,25 @@ function t(name, meta) { patterns_test("option testing - completion 1", endpoints, "a/a$", - {endpoint: "1", p: ["a"]} + { endpoint: "1", p: ["a"] } ); patterns_test("option testing - completion 2", endpoints, "a/b$", - {endpoint: "1", p: ["b"]} + { endpoint: "1", p: ["b"] } ); patterns_test("option testing - completion 3", endpoints, "a/b,a$", - {endpoint: "1", p: ["b", "a"]} + { endpoint: "1", p: ["b", "a"] } ); patterns_test("option testing - completion 4", endpoints, "a/c$", - {endpoint: "2"} + { endpoint: "2" } ); patterns_test("option testing - completion 5", @@ -228,7 +228,7 @@ function t(name, meta) { patterns_test("option testing - partial, with auto complete", endpoints, "a", - {autoCompleteSet: [t("a", "p"), t("b", "p"), "c"]} + { autoCompleteSet: [t("a", "p"), t("b", "p"), "c"] } ); patterns_test("option testing - partial, without auto complete", @@ -241,7 +241,7 @@ function t(name, meta) { patterns_test("option testing - different path - with auto complete", endpoints, "a/e", - {autoCompleteSet: []} + { autoCompleteSet: [] } ); @@ -284,14 +284,14 @@ function t(name, meta) { patterns_test("global parameters testing - completion 1", endpoints, "a/a$", - {endpoint: "1", p: ["a"]}, + { endpoint: "1", p: ["a"] }, globalFactories ); patterns_test("global parameters testing - completion 2", endpoints, "b/g1$", - {endpoint: "2", p: ["g1"]}, + { endpoint: "2", p: ["g1"] }, globalFactories ); @@ -299,27 +299,27 @@ function t(name, meta) { patterns_test("global parameters testing - partial, with auto complete", endpoints, "a", - {autoCompleteSet: [t("a", "p"), t("b", "p")]}, + { autoCompleteSet: [t("a", "p"), t("b", "p")] }, globalFactories ); patterns_test("global parameters testing - partial, with auto complete 2", endpoints, "b", - {autoCompleteSet: [t("g1", "p"), t("g2", "p"), t("la", "l"), t("lb", "l")]}, + { autoCompleteSet: [t("g1", "p"), t("g2", "p"), t("la", "l"), t("lb", "l")] }, globalFactories ); patterns_test("Non valid token acceptance - partial, with auto complete 1", endpoints, "b/la", - {autoCompleteSet: ["c"], "l": ["la"]}, + { autoCompleteSet: ["c"], "l": ["la"] }, globalFactories ); patterns_test("Non valid token acceptance - partial, with auto complete 2", endpoints, "b/non_valid", - {autoCompleteSet: ["c"], "l": ["non_valid"]}, + { autoCompleteSet: ["c"], "l": ["non_valid"] }, globalFactories ); @@ -336,25 +336,25 @@ function t(name, meta) { patterns_test("look ahead - autocomplete before param 1", endpoints, "a", - {autoCompleteSet: ["b"]} + { autoCompleteSet: ["b"] } ); patterns_test("look ahead - autocomplete before param 2", endpoints, [], - {autoCompleteSet: ["a/b"]} + { autoCompleteSet: ["a/b"] } ); patterns_test("look ahead - autocomplete after param 1", endpoints, "a/b/v", - {autoCompleteSet: ["c/e"], "p": "v"} + { autoCompleteSet: ["c/e"], "p": "v" } ); patterns_test("look ahead - autocomplete after param 2", endpoints, "a/b/v/c", - {autoCompleteSet: ["e"], "p": "v"} + { autoCompleteSet: ["e"], "p": "v" } ); })(); @@ -380,7 +380,7 @@ function t(name, meta) { patterns_test("Competing endpoints - priority 1", e, "a/b$", - {method: "GET", endpoint: "1_param", "p": "b"} + { method: "GET", endpoint: "1_param", "p": "b" } ); e = _.cloneDeep(endpoints); e["1_param"].priority = 1; @@ -388,7 +388,7 @@ function t(name, meta) { patterns_test("Competing endpoints - priority 2", e, "a/b$", - {method: "GET", endpoint: "2_explicit"} + { method: "GET", endpoint: "2_explicit" } ); e = _.cloneDeep(endpoints); @@ -396,7 +396,7 @@ function t(name, meta) { patterns_test("Competing endpoints - priority 3", e, "a/b$", - {method: "GET", endpoint: "2_explicit"} + { method: "GET", endpoint: "2_explicit" } ); })(); @@ -431,44 +431,44 @@ function t(name, meta) { patterns_test("Competing endpoint - sub url of another - auto complete", endpoints, "a", - {method: "GET", autoCompleteSet: ["b"]} + { method: "GET", autoCompleteSet: ["b"] } ); patterns_test("Competing endpoint - sub url of another, complete 1", endpoints, "a$", - {method: "GET", endpoint: "1_GET"} + { method: "GET", endpoint: "1_GET" } ); patterns_test("Competing endpoint - sub url of another, complete 2", endpoints, "a$", - {method: "PUT", endpoint: "1_PUT"} + { method: "PUT", endpoint: "1_PUT" } ); patterns_test("Competing endpoint - sub url of another, complete 3", endpoints, "a$", - {method: "DELETE"} + { method: "DELETE" } ); patterns_test("Competing endpoint - extension of another, complete 1, auto complete", endpoints, "a/b$", - {method: "PUT", autoCompleteSet: []} + { method: "PUT", autoCompleteSet: [] } ); patterns_test("Competing endpoint - extension of another, complete 1", endpoints, "a/b$", - {method: "GET", endpoint: "2_GET"} + { method: "GET", endpoint: "2_GET" } ); patterns_test("Competing endpoint - extension of another, complete 1", endpoints, "a/b$", - {method: "DELETE", endpoint: "2_DELETE"} + { method: "DELETE", endpoint: "2_DELETE" } ); patterns_test("Competing endpoint - extension of another, complete 1", endpoints, "a/b$", - {method: "PUT"} + { method: "PUT" } ); })(); diff --git a/src/core_plugins/console/public/tests/src/url_params_tests.js b/src/core_plugins/console/public/tests/src/url_params_tests.js index a529e67b42b2f..42cc0a7cb910c 100644 --- a/src/core_plugins/console/public/tests/src/url_params_tests.js +++ b/src/core_plugins/console/public/tests/src/url_params_tests.js @@ -2,7 +2,7 @@ let _ = require('lodash'); let url_params = require('../../src/autocomplete/url_params'); let autocomplete_engine = require('../../src/autocomplete/engine'); -var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit; +var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit; module("Url params"); @@ -23,7 +23,7 @@ function param_test(name, description, tokenPath, expectedContext, globalParams) if (expectedContext.autoCompleteSet) { expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) { if (_.isString(t)) { - t = {name: t} + t = { name: t } } return t; }); @@ -49,14 +49,14 @@ function param_test(name, description, tokenPath, expectedContext, globalParams) function t(name, meta, insert_value) { var r = name; if (meta) { - r = {name: name, meta: meta}; + r = { name: name, meta: meta }; if (meta === "param" && !insert_value) { insert_value = name + "="; } } if (insert_value) { if (_.isString(r)) { - r = {name: name} + r = { name: name } } r.insert_value = insert_value; } @@ -71,19 +71,19 @@ function t(name, meta, insert_value) { param_test("settings params", params, "a/1", - {"a": ["1"]} + { "a": ["1"] } ); param_test("autocomplete top level", params, [], - {autoCompleteSet: [t("a", "param"), t("b", "flag")]} + { autoCompleteSet: [t("a", "param"), t("b", "flag")] } ); param_test("autocomplete top level, with defaults", params, [], - {autoCompleteSet: [t("a", "param"), t("b", "flag"), t("c", "param")]}, + { autoCompleteSet: [t("a", "param"), t("b", "flag"), t("c", "param")] }, { "c": [2] } @@ -92,13 +92,13 @@ function t(name, meta, insert_value) { param_test("autocomplete values", params, "a", - {autoCompleteSet: [t("1", "a"), t("2", "a")]} + { autoCompleteSet: [t("1", "a"), t("2", "a")] } ); param_test("autocomplete values flag", params, "b", - {autoCompleteSet: [t("true", "b"), t("false", "b")]} + { autoCompleteSet: [t("true", "b"), t("false", "b")] } ); diff --git a/src/core_plugins/dev_mode/public/vis_debug_spy_panel.js b/src/core_plugins/dev_mode/public/vis_debug_spy_panel.js index 05ce703ab2de6..fccc8bfde707c 100644 --- a/src/core_plugins/dev_mode/public/vis_debug_spy_panel.js +++ b/src/core_plugins/dev_mode/public/vis_debug_spy_panel.js @@ -2,13 +2,13 @@ import visDebugSpyPanelTemplate from 'plugins/dev_mode/vis_debug_spy_panel.html' // register the spy mode or it won't show up in the spys require('ui/registry/spy_modes').register(VisDetailsSpyProvider); -function VisDetailsSpyProvider(Notifier, $filter, $rootScope, config) { +function VisDetailsSpyProvider() { return { name: 'debug', display: 'Debug', template: visDebugSpyPanelTemplate, order: 5, - link: function ($scope, $el) { + link: function ($scope) { $scope.$watch('vis.getEnabledState() | json', function (json) { $scope.visStateJson = json; }); diff --git a/src/core_plugins/elasticsearch/index.js b/src/core_plugins/elasticsearch/index.js index a536fa3f1dccf..361ab4451f93b 100644 --- a/src/core_plugins/elasticsearch/index.js +++ b/src/core_plugins/elasticsearch/index.js @@ -47,7 +47,7 @@ module.exports = function ({ Plugin }) { } }, - init(server, options) { + init(server) { const kibanaIndex = server.config().get('kibana.index'); // Expose the client to the server diff --git a/src/core_plugins/elasticsearch/lib/__tests__/check_es_version.js b/src/core_plugins/elasticsearch/lib/__tests__/check_es_version.js index b40634d51fb42..f9d84bf4145ef 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/check_es_version.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/check_es_version.js @@ -11,7 +11,6 @@ import checkEsVersion from '../check_es_version'; describe('plugins/elasticsearch', function () { describe('lib/check_es_version', function () { let server; - let plugin; beforeEach(function () { const get = sinon.stub().withArgs('elasticsearch.engineVersion').returns('^1.4.3'); @@ -88,6 +87,5 @@ describe('plugins/elasticsearch', function () { expect(e).to.be.a(SetupError); }); }); - }); }); diff --git a/src/core_plugins/elasticsearch/lib/__tests__/is_upgradeable.js b/src/core_plugins/elasticsearch/lib/__tests__/is_upgradeable.js index 0e9b064393d15..400990a9b8265 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/is_upgradeable.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/is_upgradeable.js @@ -1,6 +1,5 @@ import _ from 'lodash'; import expect from 'expect.js'; -import sinon from 'sinon'; import isUpgradeable from '../is_upgradeable'; import pkg from '../../../../utils/package_json'; @@ -8,7 +7,7 @@ let version = pkg.version; describe('plugins/elasticsearch', function () { describe('lib/is_upgradeable', function () { - let server = { + const server = { config: _.constant({ get: function (key) { switch (key) { @@ -44,7 +43,7 @@ describe('plugins/elasticsearch', function () { upgradeDoc('5.0.0-alpha1', '5.0.0', false); it('should handle missing _id field', function () { - let doc = { + const doc = { '_index': '.kibana', '_type': 'config', '_score': 1, @@ -58,7 +57,7 @@ describe('plugins/elasticsearch', function () { }); it('should handle _id of @@version', function () { - let doc = { + const doc = { '_index': '.kibana', '_type': 'config', '_id': '@@version', diff --git a/src/core_plugins/elasticsearch/lib/__tests__/map_uri.js b/src/core_plugins/elasticsearch/lib/__tests__/map_uri.js index ca769ca3054f5..f74e7c09894a6 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/map_uri.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/map_uri.js @@ -37,7 +37,7 @@ describe('plugins/elasticsearch', function () { it('sends configured custom headers even if the same named header exists in request', function () { const get = sinon.stub(); get.withArgs('elasticsearch.requestHeadersWhitelist').returns(['x-my-custom-header']); - get.withArgs('elasticsearch.customHeaders').returns({'x-my-custom-header': 'asconfigured'}); + get.withArgs('elasticsearch.customHeaders').returns({ 'x-my-custom-header': 'asconfigured' }); const server = { config: () => ({ get }) }; mapUri(server)(request, function (err, upstreamUri, upstreamHeaders) { diff --git a/src/core_plugins/elasticsearch/lib/__tests__/routes.js b/src/core_plugins/elasticsearch/lib/__tests__/routes.js index b70531bc6cffb..54a92fb837537 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/routes.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/routes.js @@ -93,13 +93,13 @@ describe('plugins/elasticsearch', function () { testRoute({ method: 'POST', url: '/elasticsearch/.kibana/__kibanaQueryValidator/_validate/query?explain=true&ignore_unavailable=true', - payload: {query: {query_string: {analyze_wildcard: true, query: '*'}}} + payload: { query: { query_string: { analyze_wildcard: true, query: '*' } } } }); testRoute({ method: 'POST', url: '/elasticsearch/_mget?timeout=0&ignore_unavailable=true&preference=1429574531063', - payload: {docs: [{_index: '.kibana', _type: 'index-pattern', _id: '[logstash-]YYYY.MM.DD'}]} + payload: { docs: [{ _index: '.kibana', _type: 'index-pattern', _id: '[logstash-]YYYY.MM.DD' }] } }); testRoute({ diff --git a/src/core_plugins/elasticsearch/lib/__tests__/set_headers.js b/src/core_plugins/elasticsearch/lib/__tests__/set_headers.js index 0bed49f4d4c1c..2ee97b53d5474 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/set_headers.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/set_headers.js @@ -1,5 +1,4 @@ import expect from 'expect.js'; -import sinon from 'sinon'; import setHeaders from '../set_headers'; describe('plugins/elasticsearch', function () { diff --git a/src/core_plugins/elasticsearch/lib/__tests__/upgrade_config.js b/src/core_plugins/elasticsearch/lib/__tests__/upgrade_config.js index 96e744c11ac10..39d627c9800e5 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/upgrade_config.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/upgrade_config.js @@ -1,4 +1,3 @@ -import _ from 'lodash'; import Promise from 'bluebird'; import sinon from 'sinon'; import expect from 'expect.js'; @@ -10,7 +9,6 @@ describe('plugins/elasticsearch', function () { let get; let server; let client; - let config; let upgrade; beforeEach(function () { @@ -46,7 +44,7 @@ describe('plugins/elasticsearch', function () { }); it('should resolve buildNum to pkg.buildNum config', function () { - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { sinon.assert.calledOnce(client.create); const params = client.create.args[0][0]; expect(params.body).to.have.property('buildNum', get('pkg.buildNum')); @@ -54,7 +52,7 @@ describe('plugins/elasticsearch', function () { }); it('should resolve version to pkg.version config', function () { - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { const params = client.create.args[0][0]; expect(params).to.have.property('id', get('pkg.version')); }); @@ -69,14 +67,14 @@ describe('plugins/elasticsearch', function () { }); it('should resolve buildNum to pkg.buildNum config', function () { - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { const params = client.create.args[0][0]; expect(params.body).to.have.property('buildNum', get('pkg.buildNum')); }); }); it('should resolve version to pkg.version config', function () { - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { const params = client.create.args[0][0]; expect(params).to.have.property('id', get('pkg.version')); }); @@ -95,7 +93,7 @@ describe('plugins/elasticsearch', function () { get.withArgs('pkg.buildNum').returns(9833); client.create.returns(Promise.resolve()); const response = { hits: { hits: [ { _id: '4.0.1-alpha3' }, { _id: '4.0.1-beta1' }, { _id: '4.0.0-SNAPSHOT1' } ] } }; - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { sinon.assert.calledOnce(client.create); const params = client.create.args[0][0]; expect(params).to.have.property('body'); @@ -110,7 +108,7 @@ describe('plugins/elasticsearch', function () { get.withArgs('pkg.buildNum').returns(5801); client.create.returns(Promise.resolve()); const response = { hits: { hits: [ { _id: '4.0.0', _source: { buildNum: 1 } } ] } }; - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { sinon.assert.calledOnce(client.create); const params = client.create.args[0][0]; expect(params).to.have.property('body'); @@ -125,7 +123,7 @@ describe('plugins/elasticsearch', function () { get.withArgs('pkg.buildNum').returns(5801); client.create.returns(Promise.resolve()); const response = { hits: { hits: [ { _id: '4.0.0', _source: { buildNum: 1 } } ] } }; - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { sinon.assert.calledOnce(server.log); expect(server.log.args[0][0]).to.eql(['plugin', 'elasticsearch']); const msg = server.log.args[0][1]; @@ -139,13 +137,12 @@ describe('plugins/elasticsearch', function () { get.withArgs('pkg.buildNum').returns(5801); client.create.returns(Promise.resolve()); const response = { hits: { hits: [ { _id: '4.0.0', _source: { buildNum: 1, defaultIndex: 'logstash-*' } } ] } }; - return upgrade(response).then(function (resp) { + return upgrade(response).then(function () { sinon.assert.calledOnce(client.create); const params = client.create.args[0][0]; expect(params).to.have.property('body'); expect(params.body).to.have.property('defaultIndex', 'logstash-*'); }); }); - }); }); diff --git a/src/core_plugins/elasticsearch/lib/check_es_version.js b/src/core_plugins/elasticsearch/lib/check_es_version.js index 287132324e6a8..cd0e38f8336b2 100644 --- a/src/core_plugins/elasticsearch/lib/check_es_version.js +++ b/src/core_plugins/elasticsearch/lib/check_es_version.js @@ -1,5 +1,4 @@ import _ from 'lodash'; -import esBool from './es_bool'; import versionSatisfies from './version_satisfies'; import SetupError from './setup_error'; @@ -22,7 +21,7 @@ module.exports = function (server) { return 'Elasticsearch v' + node.version + ' @ ' + node.http_address + ' (' + node.ip + ')'; }); - const message = `This version of Kibana requires Elasticsearch ` + + const message = 'This version of Kibana requires Elasticsearch ' + `${engineVersion} on all nodes. I found ` + `the following incompatible nodes in your cluster: ${badNodeNames.join(',')}`; diff --git a/src/core_plugins/elasticsearch/lib/create_kibana_index.js b/src/core_plugins/elasticsearch/lib/create_kibana_index.js index b35e13fa84156..618d8af35aae5 100644 --- a/src/core_plugins/elasticsearch/lib/create_kibana_index.js +++ b/src/core_plugins/elasticsearch/lib/create_kibana_index.js @@ -1,5 +1,4 @@ import SetupError from './setup_error'; -import { format } from 'util'; import { mappings } from './kibana_index_mappings'; module.exports = function (server) { diff --git a/src/core_plugins/elasticsearch/lib/create_proxy.js b/src/core_plugins/elasticsearch/lib/create_proxy.js index 2ef2bd1da56d8..cfe72edcbfbb2 100644 --- a/src/core_plugins/elasticsearch/lib/create_proxy.js +++ b/src/core_plugins/elasticsearch/lib/create_proxy.js @@ -1,6 +1,5 @@ import createAgent from './create_agent'; import mapUri from './map_uri'; -import { resolve } from 'url'; import { assign } from 'lodash'; function createProxy(server, method, route, config) { @@ -29,7 +28,7 @@ function createProxy(server, method, route, config) { assign(options.config, config); server.route(options); -}; +} createProxy.createPath = function createPath(path) { const pre = '/elasticsearch'; diff --git a/src/core_plugins/elasticsearch/lib/expose_client.js b/src/core_plugins/elasticsearch/lib/expose_client.js index a1748e54ebbeb..8caeb03f29cdc 100644 --- a/src/core_plugins/elasticsearch/lib/expose_client.js +++ b/src/core_plugins/elasticsearch/lib/expose_client.js @@ -41,7 +41,6 @@ module.exports = function (server) { const uri = url.parse(options.url); - let authorization; if (options.auth && options.username && options.password) { uri.auth = util.format('%s:%s', options.username, options.password); } diff --git a/src/core_plugins/elasticsearch/lib/filter_headers.js b/src/core_plugins/elasticsearch/lib/filter_headers.js index 285b45f560697..891306fd260c2 100644 --- a/src/core_plugins/elasticsearch/lib/filter_headers.js +++ b/src/core_plugins/elasticsearch/lib/filter_headers.js @@ -1,7 +1,6 @@ import _ from 'lodash'; export default function (originalHeaders, headersToKeep) { - const normalizeHeader = function (header) { if (!header) { return ''; @@ -13,10 +12,5 @@ export default function (originalHeaders, headersToKeep) { // Normalize list of headers we want to allow in upstream request const headersToKeepNormalized = headersToKeep.map(normalizeHeader); - // Normalize original headers in request - const originalHeadersNormalized = _.mapKeys(originalHeaders, function (headerValue, headerName) { - return normalizeHeader(headerName); - }); - return _.pick(originalHeaders, headersToKeepNormalized); } diff --git a/src/core_plugins/elasticsearch/lib/get_basic_auth_realm.js b/src/core_plugins/elasticsearch/lib/get_basic_auth_realm.js index 9a9c183def983..11646439fad3b 100644 --- a/src/core_plugins/elasticsearch/lib/get_basic_auth_realm.js +++ b/src/core_plugins/elasticsearch/lib/get_basic_auth_realm.js @@ -4,4 +4,4 @@ export default function getBasicAuthRealm(message) { const parts = message.match(/Basic\ realm=\\"(.*)\\"/); if (parts && parts.length === 2) return parts[1]; else return null; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/src/core_plugins/elasticsearch/lib/health_check.js b/src/core_plugins/elasticsearch/lib/health_check.js index cca77e2f2398a..d93240b66600d 100644 --- a/src/core_plugins/elasticsearch/lib/health_check.js +++ b/src/core_plugins/elasticsearch/lib/health_check.js @@ -1,7 +1,6 @@ import _ from 'lodash'; import Promise from 'bluebird'; import elasticsearch from 'elasticsearch'; -import exposeClient from './expose_client'; import migrateConfig from './migrate_config'; import createKibanaIndex from './create_kibana_index'; import checkEsVersion from './check_es_version'; diff --git a/src/core_plugins/elasticsearch/lib/map_uri.js b/src/core_plugins/elasticsearch/lib/map_uri.js index 53b7a8a4f38db..678fb8b92021d 100644 --- a/src/core_plugins/elasticsearch/lib/map_uri.js +++ b/src/core_plugins/elasticsearch/lib/map_uri.js @@ -1,9 +1,8 @@ import querystring from 'querystring'; -import { resolve } from 'url'; import filterHeaders from './filter_headers'; import setHeaders from './set_headers'; -export default function mapUri(server, prefix) { +export default function mapUri(server) { const config = server.config(); return function (request, done) { @@ -19,4 +18,4 @@ export default function mapUri(server, prefix) { const customHeaders = setHeaders(filteredHeaders, config.get('elasticsearch.customHeaders')); done(null, url, customHeaders); }; -}; +} diff --git a/src/core_plugins/elasticsearch/lib/upgrade_config.js b/src/core_plugins/elasticsearch/lib/upgrade_config.js index 9050767d969ac..8fd4609daa64d 100644 --- a/src/core_plugins/elasticsearch/lib/upgrade_config.js +++ b/src/core_plugins/elasticsearch/lib/upgrade_config.js @@ -1,11 +1,8 @@ import Promise from 'bluebird'; import isUpgradeable from './is_upgradeable'; import _ from 'lodash'; -import { format } from 'util'; module.exports = function (server) { - const MAX_INTEGER = Math.pow(2, 53) - 1; - const client = server.plugins.elasticsearch.client; const config = server.config(); @@ -19,8 +16,6 @@ module.exports = function (server) { } return function (response) { - const newConfig = {}; - // Check to see if there are any doc. If not then we set the build number and id if (response.hits.hits.length === 0) { return createNewConfig(); diff --git a/src/core_plugins/kbn_doc_views/index.js b/src/core_plugins/kbn_doc_views/index.js index 7f94a42489d31..47af2971d166d 100644 --- a/src/core_plugins/kbn_doc_views/index.js +++ b/src/core_plugins/kbn_doc_views/index.js @@ -10,4 +10,4 @@ export default function (kibana) { }); -}; +} diff --git a/src/core_plugins/kbn_doc_views/public/__tests__/doc_views.js b/src/core_plugins/kbn_doc_views/public/__tests__/doc_views.js index c931996d53a22..89e67a658b72e 100644 --- a/src/core_plugins/kbn_doc_views/public/__tests__/doc_views.js +++ b/src/core_plugins/kbn_doc_views/public/__tests__/doc_views.js @@ -3,7 +3,6 @@ import _ from 'lodash'; import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import $ from 'jquery'; import 'ui/render_directive'; import 'plugins/kbn_doc_views/views/table'; import docViewsRegistry from 'ui/registry/doc_views'; @@ -16,9 +15,9 @@ const hit = { '_source': { 'extension': 'html', 'bytes': 100, - 'area': [{lat: 7, lon: 7}], + 'area': [{ lat: 7, lon: 7 }], 'noMapping': 'hasNoMapping', - 'objectArray': [{foo: true}, {bar: false}], + 'objectArray': [{ foo: true }, { bar: false }], '_underscore': 1 } }; @@ -78,7 +77,6 @@ describe('docViews', function () { initView(docViews.byName.Table); }); it('should have a row for each field', function () { - const rows = $elem.find('tr'); expect($elem.find('tr').length).to.be(_.keys(flattened).length); }); diff --git a/src/core_plugins/kbn_doc_views/public/views/json.js b/src/core_plugins/kbn_doc_views/public/views/json.js index 120935e4b9cde..8415da47fd5e6 100644 --- a/src/core_plugins/kbn_doc_views/public/views/json.js +++ b/src/core_plugins/kbn_doc_views/public/views/json.js @@ -1,4 +1,3 @@ -import _ from 'lodash'; import angular from 'angular'; import 'ace'; import docViewsRegistry from 'ui/registry/doc_views'; diff --git a/src/core_plugins/kbn_doc_views/public/views/table.js b/src/core_plugins/kbn_doc_views/public/views/table.js index af201f39c3539..fef633e5827ec 100644 --- a/src/core_plugins/kbn_doc_views/public/views/table.js +++ b/src/core_plugins/kbn_doc_views/public/views/table.js @@ -26,7 +26,7 @@ docViewsRegistry.register(function () { }; $scope.showArrayInObjectsWarning = function (row, field) { - let value = $scope.flattened[field]; + const value = $scope.flattened[field]; return _.isArray(value) && typeof value[0] === 'object'; }; } diff --git a/src/core_plugins/kbn_vislib_vis_types/index.js b/src/core_plugins/kbn_vislib_vis_types/index.js index 0f7e42cfbf556..b74e5a4cf56c7 100644 --- a/src/core_plugins/kbn_vislib_vis_types/index.js +++ b/src/core_plugins/kbn_vislib_vis_types/index.js @@ -10,4 +10,4 @@ export default function (kibana) { }); -}; +} diff --git a/src/core_plugins/kbn_vislib_vis_types/public/area.js b/src/core_plugins/kbn_vislib_vis_types/public/area.js index 8ba764e50a6d8..8968b2d532c2f 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/area.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/area.js @@ -71,4 +71,4 @@ export default function HistogramVisType(Private) { } ]) }); -}; +} diff --git a/src/core_plugins/kbn_vislib_vis_types/public/controls/line_interpolation_option.js b/src/core_plugins/kbn_vislib_vis_types/public/controls/line_interpolation_option.js index a62607f67e307..2159713cf1937 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/controls/line_interpolation_option.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/controls/line_interpolation_option.js @@ -1,10 +1,8 @@ -import _ from 'lodash'; -import $ from 'jquery'; import uiModules from 'ui/modules'; import lineInterpolationOptionTemplate from 'plugins/kbn_vislib_vis_types/controls/line_interpolation_option.html'; const module = uiModules.get('kibana'); -module.directive('lineInterpolationOption', function ($parse, $compile) { +module.directive('lineInterpolationOption', function () { return { restrict: 'E', template: lineInterpolationOptionTemplate, diff --git a/src/core_plugins/kbn_vislib_vis_types/public/controls/point_series_options.js b/src/core_plugins/kbn_vislib_vis_types/public/controls/point_series_options.js index 653d3afd5c755..88b92f760b07c 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/controls/point_series_options.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/controls/point_series_options.js @@ -1,11 +1,9 @@ -import _ from 'lodash'; -import $ from 'jquery'; import 'ui/directives/inequality'; import uiModules from 'ui/modules'; import pointSeriesOptionsTemplate from 'plugins/kbn_vislib_vis_types/controls/point_series_options.html'; const module = uiModules.get('kibana'); -module.directive('pointSeriesOptions', function ($parse, $compile) { +module.directive('pointSeriesOptions', function () { return { restrict: 'E', template: pointSeriesOptionsTemplate, diff --git a/src/core_plugins/kbn_vislib_vis_types/public/controls/vislib_basic_options.js b/src/core_plugins/kbn_vislib_vis_types/public/controls/vislib_basic_options.js index fd7f7b9eaa8e0..4f160429e9493 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/controls/vislib_basic_options.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/controls/vislib_basic_options.js @@ -1,10 +1,8 @@ -import _ from 'lodash'; -import $ from 'jquery'; import uiModules from 'ui/modules'; import vislibBasicOptionsTemplate from 'plugins/kbn_vislib_vis_types/controls/vislib_basic_options.html'; const module = uiModules.get('kibana'); -module.directive('vislibBasicOptions', function ($parse, $compile) { +module.directive('vislibBasicOptions', function () { return { restrict: 'E', template: vislibBasicOptionsTemplate, diff --git a/src/core_plugins/kbn_vislib_vis_types/public/histogram.js b/src/core_plugins/kbn_vislib_vis_types/public/histogram.js index 40099fe4c7bf0..23a08e3e98d51 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/histogram.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/histogram.js @@ -67,4 +67,4 @@ export default function HistogramVisType(Private) { } ]) }); -}; +} diff --git a/src/core_plugins/kbn_vislib_vis_types/public/line.js b/src/core_plugins/kbn_vislib_vis_types/public/line.js index 0c7830da74583..f292dade6788d 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/line.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/line.js @@ -77,4 +77,4 @@ export default function HistogramVisType(Private) { } ]) }); -}; +} diff --git a/src/core_plugins/kbn_vislib_vis_types/public/pie.js b/src/core_plugins/kbn_vislib_vis_types/public/pie.js index 170178cf1d153..64a2242fbe7bb 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/pie.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/pie.js @@ -57,4 +57,4 @@ export default function HistogramVisType(Private) { } ]) }); -}; +} diff --git a/src/core_plugins/kbn_vislib_vis_types/public/tile_map.js b/src/core_plugins/kbn_vislib_vis_types/public/tile_map.js index 8c2e18ed3e2b5..7c43770184638 100644 --- a/src/core_plugins/kbn_vislib_vis_types/public/tile_map.js +++ b/src/core_plugins/kbn_vislib_vis_types/public/tile_map.js @@ -43,7 +43,7 @@ export default function TileMapVisType(Private, getAppState, courier, config) { const pushFilter = Private(FilterBarPushFilterProvider)(getAppState()); const indexPatternName = agg.vis.indexPattern.id; const field = agg.fieldName(); - const filter = {geo_bounding_box: {}}; + const filter = { geo_bounding_box: {} }; filter.geo_bounding_box[field] = event.bounds; pushFilter(filter, false, indexPatternName); @@ -98,4 +98,4 @@ export default function TileMapVisType(Private, getAppState, courier, config) { } ]) }); -}; +} diff --git a/src/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js b/src/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js index 97dea17fc5bfe..38e3c751ad2a9 100644 --- a/src/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js +++ b/src/core_plugins/kibana/common/lib/__tests__/convert_pattern_and_ingest_name.js @@ -1,5 +1,5 @@ import expect from 'expect.js'; -import {patternToIngest, ingestToPattern} from '../convert_pattern_and_ingest_name'; +import { patternToIngest, ingestToPattern } from '../convert_pattern_and_ingest_name'; describe('convertPatternAndTemplateName', function () { diff --git a/src/core_plugins/kibana/index.js b/src/core_plugins/kibana/index.js index ac337892136a9..a459092b909c1 100644 --- a/src/core_plugins/kibana/index.js +++ b/src/core_plugins/kibana/index.js @@ -32,8 +32,8 @@ module.exports = function (kibana) { 'docViews' ], - injectVars: function (server, options) { - let config = server.config(); + injectVars: function (server) { + const config = server.config(); return { kbnDefaultAppId: config.get('kibana.defaultAppId'), tilemap: config.get('tilemap') @@ -84,7 +84,7 @@ module.exports = function (kibana) { }, }, - init: function (server, options) { + init: function (server) { // uuid manageUuid(server); // routes diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js b/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js index 54e12f3fd4d7e..bc2744a70d8a1 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js @@ -1,4 +1,3 @@ -import _ from 'lodash'; import PluginsKibanaDashboardComponentsPanelLibVisualizationProvider from 'plugins/kibana/dashboard/components/panel/lib/visualization'; import PluginsKibanaDashboardComponentsPanelLibSearchProvider from 'plugins/kibana/dashboard/components/panel/lib/search'; export default function loadPanelFunction(Private) { // Inject services here @@ -15,4 +14,4 @@ export default function loadPanelFunction(Private) { // Inject services here } }; -}; +} diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js b/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js index e0d7a914b2f4f..eca3f43f24ffc 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js @@ -1,4 +1,4 @@ -export default function searchLoader(savedSearches, Private) { // Inject services here +export default function searchLoader(savedSearches) { // Inject services here return function (panel, $scope) { // Function parameters here return savedSearches.get(panel.id) .then(function (savedSearch) { @@ -21,4 +21,4 @@ export default function searchLoader(savedSearches, Private) { // Inject service }; }); }; -}; +} diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js b/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js index 87b04bc1cb535..3c47e4d253feb 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js @@ -20,4 +20,4 @@ export default function visualizationLoader(savedVisualizations, Private) { // I }; }); }; -}; +} diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/panel.js b/src/core_plugins/kibana/public/dashboard/components/panel/panel.js index 5cdf1a8469dfa..2737bd3e43fbd 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/panel.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/panel.js @@ -1,11 +1,8 @@ -import moment from 'moment'; -import $ from 'jquery'; import _ from 'lodash'; import 'ui/visualize'; import 'ui/doc_table'; import PluginsKibanaDashboardComponentsPanelLibLoadPanelProvider from 'plugins/kibana/dashboard/components/panel/lib/load_panel'; import FilterManagerProvider from 'ui/filter_manager'; -import UtilsBrushEventProvider from 'ui/utils/brush_event'; import uiModules from 'ui/modules'; import panelTemplate from 'plugins/kibana/dashboard/components/panel/panel.html'; uiModules @@ -13,7 +10,6 @@ uiModules .directive('dashboardPanel', function (savedVisualizations, savedSearches, Notifier, Private, $injector) { const loadPanel = Private(PluginsKibanaDashboardComponentsPanelLibLoadPanelProvider); const filterManager = Private(FilterManagerProvider); - const notify = new Notifier(); const services = require('plugins/kibana/management/saved_object_registry').all().map(function (serviceObj) { const service = $injector.get(serviceObj.service); @@ -24,8 +20,6 @@ uiModules }); - const brushEvent = Private(UtilsBrushEventProvider); - const getPanelId = function (panel) { return ['P', panel.panelIndex].join('-'); }; @@ -34,7 +28,7 @@ uiModules restrict: 'E', template: panelTemplate, requires: '^dashboardGrid', - link: function ($scope, $el) { + link: function ($scope) { // using $scope inheritance, panels are available in AppState const $state = $scope.state; diff --git a/src/core_plugins/kibana/public/dashboard/directives/grid.js b/src/core_plugins/kibana/public/dashboard/directives/grid.js index afff8d497bc38..87416550b4ac6 100644 --- a/src/core_plugins/kibana/public/dashboard/directives/grid.js +++ b/src/core_plugins/kibana/public/dashboard/directives/grid.js @@ -16,7 +16,6 @@ app.directive('dashboardGrid', function ($compile, Notifier) { $el = $('