diff --git a/.eslintignore b/.eslintignore index 97c455379985c..4d80cd3b5f1e6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,4 @@ src/fixtures/vislib/mock_data src/ui/public/angular-bootstrap/**/*.js test/fixtures/scenarios/**/*.js +src/core_plugins/console diff --git a/.eslintrc b/.eslintrc index d54bd19499d7d..7a623df06a6ca 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,4 +1,2 @@ --- extends: '@elastic/kibana' -rules: - no-unused-vars: off diff --git a/Gruntfile.js b/Gruntfile.js index 336e313b43c4a..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) { 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__/cluster_manager.js b/src/cli/cluster/__tests__/cluster_manager.js index ae9ef7080981a..f264e2f62b6b5 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 5091c7bfa41b8..4c62fc3e9f757 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'; @@ -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 eddd75d058680..7810b05adcc5c 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'; diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index 2e98b3bcbcfe7..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'; @@ -123,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 320defcb7e0d5..2c16ecf411154 100644 --- a/src/cli/cluster/worker.js +++ b/src/cli/cluster/worker.js @@ -1,6 +1,5 @@ import _ from 'lodash'; import cluster from 'cluster'; -import { resolve } from 'path'; import { EventEmitter } from 'events'; import { BinderFor, fromRoot } from '../../utils'; diff --git a/src/cli/command.js b/src/cli/command.js index 98997f4bc1100..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; diff --git a/src/cli/log.js b/src/cli/log.js index 50657ca533028..584c27d5f9857 100644 --- a/src/cli/log.js +++ b/src/cli/log.js @@ -1,5 +1,4 @@ import _ from 'lodash'; -import ansicolors from 'ansicolors'; 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 d768d1973708d..5fbbe9797ca5f 100644 --- a/src/cli/serve/__tests__/reload_logging_config.js +++ b/src/cli/serve/__tests__/reload_logging_config.js @@ -1,5 +1,5 @@ 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'; @@ -33,7 +33,7 @@ describe('Server logging configuration', function () { let asserted = false; let json = Infinity; - const conf = setLoggingJson(true); + setLoggingJson(true); const child = spawn(cli, ['--config', testConfigFile]); child.on('error', err => { diff --git a/src/cli/serve/deprecated_config.js b/src/cli/serve/deprecated_config.js index d0ec271a8cee8..41f3197346792 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..c0172a12410b4 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 3ff2ba328830f..5d3dd2f702267 100644 --- a/src/cli_plugin/cli.js +++ b/src/cli_plugin/cli.js @@ -30,7 +30,7 @@ program program .command('*', null, { noHelp: true }) -.action(function (cmd, options) { +.action(function (cmd) { program.error(`unknown command ${cmd}`); }); 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__/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..cb0da8cc2a7d6 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/downloaders/file.js b/src/cli_plugin/install/downloaders/file.js index bd8233c009614..8089f35326676 100644 --- a/src/cli_plugin/install/downloaders/file.js +++ b/src/cli_plugin/install/downloaders/file.js @@ -1,5 +1,5 @@ import Progress from '../progress'; -import { createWriteStream, createReadStream, unlinkSync, statSync } from 'fs'; +import {createWriteStream, createReadStream, statSync} from 'fs'; function openSourceFile({ sourcePath }) { try { diff --git a/src/cli_plugin/install/downloaders/http.js b/src/cli_plugin/install/downloaders/http.js index 0b9844a6d9c14..2e2731d2f2ceb 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. diff --git a/src/cli_plugin/install/index.js b/src/cli_plugin/install/index.js index 205132226a66f..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; diff --git a/src/cli_plugin/install/pack.js b/src/cli_plugin/install/pack.js index ce7bfccfbbccd..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(); } diff --git a/src/cli_plugin/install/settings.js b/src/cli_plugin/install/settings.js index ee61263ebdb55..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 [ 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/list/__tests__/settings.js b/src/cli_plugin/list/__tests__/settings.js index ebfb245dc8c29..8180a5858d02a 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/settings.js b/src/cli_plugin/list/settings.js index 1f24e9e57f280..b4f59581c08f0 100644 --- a/src/cli_plugin/list/settings.js +++ b/src/cli_plugin/list/settings.js @@ -1,6 +1,4 @@ -import { resolve } from 'path'; - -export function parse(command, options) { +export function parse(command) { const settings = { pluginDir: command.pluginDir || '' }; diff --git a/src/cli_plugin/remove/__tests__/settings.js b/src/cli_plugin/remove/__tests__/settings.js index f29aa9d6e33c6..ccc4bae3bd60d 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/core_plugins/console/.eslintrc b/src/core_plugins/console/.eslintrc index f539f6cd5878f..a0436102317b2 100644 --- a/src/core_plugins/console/.eslintrc +++ b/src/core_plugins/console/.eslintrc @@ -34,3 +34,4 @@ rules: wrap-iife: off no-var: off prefer-const: off + no-unused-vars: off 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 7ab961a81a0ab..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'; diff --git a/src/core_plugins/elasticsearch/lib/__tests__/manage_uuid.js b/src/core_plugins/elasticsearch/lib/__tests__/manage_uuid.js index 80a0687f9ab0d..c23b46535eddf 100644 --- a/src/core_plugins/elasticsearch/lib/__tests__/manage_uuid.js +++ b/src/core_plugins/elasticsearch/lib/__tests__/manage_uuid.js @@ -1,6 +1,5 @@ import expect from 'expect.js'; import sinon from 'sinon'; -import Joi from 'joi'; import * as kbnTestServer from '../../../../../test/utils/kbn_server.js'; import fromRoot from '../../../../utils/from_root'; import manageUuid from '../manage_uuid'; 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 09167eea4acf4..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'; 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 1e9434f03402a..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) { 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/health_check.js b/src/core_plugins/elasticsearch/lib/health_check.js index 6920b4eb593f9..112d7ff2dfaae 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 665b348cff5bf..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) { 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/public/__tests__/doc_views.js b/src/core_plugins/kbn_doc_views/public/__tests__/doc_views.js index c931996d53a22..5a996719cae7a 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'; @@ -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_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/kibana/index.js b/src/core_plugins/kibana/index.js index b31e32d3dd7fd..78cf42fb87ef6 100644 --- a/src/core_plugins/kibana/index.js +++ b/src/core_plugins/kibana/index.js @@ -29,7 +29,7 @@ module.exports = function (kibana) { 'docViews' ], - injectVars: function (server, options) { + injectVars: function (server) { const config = server.config(); return { kbnDefaultAppId: config.get('kibana.defaultAppId'), @@ -80,7 +80,7 @@ module.exports = function (kibana) { }, }, - init: function (server, options) { + init: function (server) { ingest(server); search(server); settings(server); 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 7f50e0cc7cfd7..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 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 27b2dcbc66e7a..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) { 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 = $('