Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

re-enabled and fix no-unused-vars rule #23

Closed
wants to merge 10 commits into from
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
src/fixtures/vislib/mock_data
src/ui/public/angular-bootstrap/**/*.js
test/fixtures/scenarios/**/*.js
src/core_plugins/console
2 changes: 0 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
---
extends: '@elastic/kibana'
rules:
no-unused-vars: off
1 change: 0 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const camelCase = require('lodash').camelCase;
require('babel/register')(require('./src/optimize/babel_options').node);

module.exports = function (grunt) {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ program

program
.command('*', null, { noHelp: true })
.action(function (cmd, options) {
.action(function (cmd) {
program.error(`unknown command ${cmd}`);
});

Expand Down
3 changes: 1 addition & 2 deletions src/cli/cluster/__tests__/cluster_manager.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
5 changes: 1 addition & 4 deletions src/cli/cluster/__tests__/worker.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cluster/base_path_proxy.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
17 changes: 11 additions & 6 deletions src/cli/cluster/cluster_manager.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/cli/cluster/worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'lodash';
import cluster from 'cluster';
import { resolve } from 'path';
import { EventEmitter } from 'events';

import { BinderFor, fromRoot } from '../../utils';
Expand Down
1 change: 0 additions & 1 deletion src/cli/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/cli/log.js
Original file line number Diff line number Diff line change
@@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/cli/serve/__tests__/read_yaml_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/serve/__tests__/reload_logging_config.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/serve/deprecated_config.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/cli/serve/read_yaml_config.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ program

program
.command('*', null, { noHelp: true })
.action(function (cmd, options) {
.action(function (cmd) {
program.error(`unknown command ${cmd}`);
});

Expand Down
21 changes: 3 additions & 18 deletions src/cli_plugin/install/__tests__/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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);
});
});
Expand All @@ -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);
});
});
Expand All @@ -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();
});
Expand All @@ -133,7 +119,6 @@ describe('kibana cli', function () {

expect(cleanArtifacts).withArgs(settings).to.not.throwError();
});

});

});
Expand Down
10 changes: 5 additions & 5 deletions src/cli_plugin/install/__tests__/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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'
Expand Down Expand Up @@ -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'
})
Expand Down Expand Up @@ -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'
})
Expand Down Expand Up @@ -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'
})
Expand Down
6 changes: 3 additions & 3 deletions src/cli_plugin/install/__tests__/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand All @@ -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) => {
Expand Down
2 changes: 0 additions & 2 deletions src/cli_plugin/install/__tests__/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -87,7 +86,6 @@ describe('kibana cli', function () {
});

});

});

});
Expand Down
3 changes: 1 addition & 2 deletions src/cli_plugin/install/__tests__/settings.js
Original file line number Diff line number Diff line change
@@ -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 () {

Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/install/__tests__/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('kibana cli', function () {
workingPath: testWorkingPath,
tempArchiveFile: tempArchiveFilePath,
plugin: 'test-plugin',
setPlugin: function (plugin) {}
setPlugin: function () {}
};

function shouldReject() {
Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/install/downloaders/file.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/install/downloaders/http.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/cli_plugin/install/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 0 additions & 2 deletions src/cli_plugin/install/settings.js
Original file line number Diff line number Diff line change
@@ -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 [
Expand Down
2 changes: 0 additions & 2 deletions src/cli_plugin/install/version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import semver from 'semver';

export function versionSatisfies(cleanActual, cleanExpected) {
try {
return (cleanActual === cleanExpected);
Expand Down
4 changes: 1 addition & 3 deletions src/cli_plugin/list/__tests__/settings.js
Original file line number Diff line number Diff line change
@@ -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 () {

Expand Down
Loading