From 7e7a89e129f1df27cefde4e9c464d305fb5d6515 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 24 Aug 2016 15:39:52 -0400 Subject: [PATCH 01/20] Disable button using ng-disabled This prevents the menuItem.run() function from being executed if the button is clicked. --- src/ui/public/kbn_top_nav/kbn_top_nav.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav.html b/src/ui/public/kbn_top_nav/kbn_top_nav.html index 0414340e2c2ac..d5b1397f5a441 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav.html +++ b/src/ui/public/kbn_top_nav/kbn_top_nav.html @@ -13,6 +13,7 @@ tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1" + ng-disabled="menuItem.disableButton" > From 266333844e6df5a04c51825a189a4630b03ea913 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 05:17:48 -0700 Subject: [PATCH 02/20] Only call the click function if the item is not disabled --- src/ui/public/kbn_top_nav/kbn_top_nav.html | 3 +-- src/ui/public/kbn_top_nav/kbn_top_nav_controller.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav.html b/src/ui/public/kbn_top_nav/kbn_top_nav.html index d5b1397f5a441..8b4f0b04c88e4 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav.html +++ b/src/ui/public/kbn_top_nav/kbn_top_nav.html @@ -7,13 +7,12 @@ aria-haspopup="{{!menuItem.hasFunction}}" aria-expanded="{{kbnTopNav.isCurrent(menuItem.key)}}" ng-class="{active: kbnTopNav.isCurrent(menuItem.key), 'is-kbn-top-nav-button-disabled': menuItem.disableButton}" - ng-click="menuItem.run(menuItem, kbnTopNav)" + ng-click="!menuItem.disableButton && menuItem.run(menuItem, kbnTopNav)" ng-bind="menuItem.label" tooltip="{{menuItem.tooltip}}" tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1" - ng-disabled="menuItem.disableButton" > diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index 9446639eaaea0..d6547cd3dcb1f 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -57,7 +57,7 @@ export default function ($compile) { label: capitalize(opt.key), hasFunction: !!opt.run, description: opt.run ? opt.key : `Toggle ${opt.key} view`, - run: (item) => !item.disableButton && this.toggle(item.key) + run: (item) => this.toggle(item.key) }, opt); defaultedOpt.hideButton = result(opt, 'hideButton', false); From 3b0ccfb66b1b3a379adac89a79fa6db6bf7d8619 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 07:53:15 -0700 Subject: [PATCH 03/20] Do not show outline when disabled buttons are focussed --- src/ui/public/styles/base.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/public/styles/base.less b/src/ui/public/styles/base.less index 8c29ccfa539cb..b68c169492740 100644 --- a/src/ui/public/styles/base.less +++ b/src/ui/public/styles/base.less @@ -162,9 +162,10 @@ a { opacity: 0.5; cursor: default; - &:active { + &:active, &:focus { color: @kibanaGray2; background-color: transparent; + outline: none; } } } From 549293d2b181d7a99678e78219884ca55feba32a Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 17 Aug 2016 15:09:12 -0400 Subject: [PATCH 04/20] Bind Kibana server to localhost This is a breaking change. The default behaviour will now be that connections from remote users will be rejected. --- config/kibana.yml | 6 ++++-- docs/kibana-yml.asciidoc | 2 +- docs/settings.asciidoc | 2 +- src/server/config/__tests__/config.js | 2 +- src/server/config/schema.js | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config/kibana.yml b/config/kibana.yml index 7358fd5b06a36..0da5cdfbab779 100644 --- a/config/kibana.yml +++ b/config/kibana.yml @@ -1,8 +1,10 @@ # Kibana is served by a back end server. This setting specifies the port to use. # server.port: 5601 -# This setting specifies the IP address of the back end server. -# server.host: "0.0.0.0" +# Specifies the public host name to which the Kibana server will bind. +# The default is 'localhost', which usually means remote machines will not be able to connect. +# To allow connections from remote users, set this parameter to IP or the DNS-name of the machine that is running Kibana. +# server.host: "localhost" # Enables you to specify a path to mount Kibana at if you are running behind a proxy. This setting # cannot end in a slash. diff --git a/docs/kibana-yml.asciidoc b/docs/kibana-yml.asciidoc index 0a4e2a20d5a9a..2a5e7fc86dde2 100644 --- a/docs/kibana-yml.asciidoc +++ b/docs/kibana-yml.asciidoc @@ -1,7 +1,7 @@ .Kibana Configuration Settings [horizontal] `server.port:`:: *Default: 5601* Kibana is served by a back end server. This setting specifies the port to use. -`server.host:`:: *Default: "0.0.0.0"* This setting specifies the IP address of the back end server. +`server.host:`:: *Default: "localhost"* This setting specifies the host of the back end server. `server.basePath:`:: Enables you to specify a path to mount Kibana at if you are running behind a proxy. This setting cannot end in a slash (`/`). `server.maxPayloadBytes:`:: *Default: 1048576* The maximum payload size in bytes for incoming server requests. diff --git a/docs/settings.asciidoc b/docs/settings.asciidoc index 51ae6716105b0..8b9ee99997458 100644 --- a/docs/settings.asciidoc +++ b/docs/settings.asciidoc @@ -295,7 +295,7 @@ deprecated[4.2, The names of several Kibana server properties changed in the 4.2 + *alias*: `host` deprecated[4.2] + -*default*: `"0.0.0.0"` +*default*: `"localhost"` `elasticsearch.url` added[4.2]:: The Elasticsearch instance where the indices you want to query reside. + diff --git a/src/server/config/__tests__/config.js b/src/server/config/__tests__/config.js index cf43ce256f585..0dc60f98f6004 100644 --- a/src/server/config/__tests__/config.js +++ b/src/server/config/__tests__/config.js @@ -54,7 +54,7 @@ describe('lib/config/config', function () { it('should allow keys in the schema', function () { let config = new Config(schema); let run = function () { - config.set('test.client.host', 'http://0.0.0.0'); + config.set('test.client.host', 'http://localhost'); }; expect(run).to.not.throwException(); }); diff --git a/src/server/config/schema.js b/src/server/config/schema.js index cf6790b82ea46..074ccec05b579 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -34,7 +34,7 @@ module.exports = () => Joi.object({ server: Joi.object({ name: Joi.string().default(os.hostname()), - host: Joi.string().hostname().default('0.0.0.0'), + host: Joi.string().hostname().default('localhost'), port: Joi.number().default(5601), maxPayloadBytes: Joi.number().default(1048576), autoListen: Joi.boolean().default(true), From e702c6d4047a6baf7ebfb43a3c5486d6411ba7f3 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Wed, 24 Aug 2016 16:02:54 -0400 Subject: [PATCH 05/20] Improve doc --- config/kibana.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/kibana.yml b/config/kibana.yml index 0da5cdfbab779..6535dcbee6a6a 100644 --- a/config/kibana.yml +++ b/config/kibana.yml @@ -1,9 +1,9 @@ # Kibana is served by a back end server. This setting specifies the port to use. # server.port: 5601 -# Specifies the public host name to which the Kibana server will bind. +# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. # The default is 'localhost', which usually means remote machines will not be able to connect. -# To allow connections from remote users, set this parameter to IP or the DNS-name of the machine that is running Kibana. +# To allow connections from remote users, set this parameter to a non-loopback address. # server.host: "localhost" # Enables you to specify a path to mount Kibana at if you are running behind a proxy. This setting From a5206b2b64c9864adc4549ce605f631ccd3a6133 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 13:43:58 -0700 Subject: [PATCH 06/20] Removing outline rule and focus selector because focus is orthogonal to enabled/disabled state --- src/ui/public/styles/base.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/public/styles/base.less b/src/ui/public/styles/base.less index b68c169492740..8c29ccfa539cb 100644 --- a/src/ui/public/styles/base.less +++ b/src/ui/public/styles/base.less @@ -162,10 +162,9 @@ a { opacity: 0.5; cursor: default; - &:active, &:focus { + &:active { color: @kibanaGray2; background-color: transparent; - outline: none; } } } From 4002bd01886b4e5c7a980a7b551ac05565d81d02 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 13:54:02 -0700 Subject: [PATCH 07/20] Encapsulating click logic in handleClick helper method --- src/ui/public/kbn_top_nav/kbn_top_nav.html | 2 +- src/ui/public/kbn_top_nav/kbn_top_nav_controller.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav.html b/src/ui/public/kbn_top_nav/kbn_top_nav.html index 8b4f0b04c88e4..9fde90a689f6c 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav.html +++ b/src/ui/public/kbn_top_nav/kbn_top_nav.html @@ -7,7 +7,7 @@ aria-haspopup="{{!menuItem.hasFunction}}" aria-expanded="{{kbnTopNav.isCurrent(menuItem.key)}}" ng-class="{active: kbnTopNav.isCurrent(menuItem.key), 'is-kbn-top-nav-button-disabled': menuItem.disableButton}" - ng-click="!menuItem.disableButton && menuItem.run(menuItem, kbnTopNav)" + ng-click="kbnTopNav.handleClick(menuItem)" ng-bind="menuItem.label" tooltip="{{menuItem.tooltip}}" tooltip-placement="bottom" diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index d6547cd3dcb1f..6ed1b253724c2 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -50,7 +50,12 @@ export default function ($compile) { open(key) { this.setCurrent(key); } close(key) { (!key || this.isCurrent(key)) && this.setCurrent(null); } toggle(key) { this.setCurrent(this.isCurrent(key) ? null : key); } - + handleClick(menuItem) { + if (menuItem.disableButton) { + return false; + } + menuItem.run(menuItem, this); + } // apply the defaults to individual options _applyOptDefault(opt = {}) { const defaultedOpt = Object.assign({ From 71f8bca4f2767c2df2300301603b0dcb0f096c1c Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 14:05:02 -0700 Subject: [PATCH 08/20] Make disableButton, hideButton, and tooltip responsive to model changes --- src/ui/public/kbn_top_nav/kbn_top_nav.html | 4 ++-- src/ui/public/kbn_top_nav/kbn_top_nav_controller.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav.html b/src/ui/public/kbn_top_nav/kbn_top_nav.html index 9fde90a689f6c..5a26efde52b3f 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav.html +++ b/src/ui/public/kbn_top_nav/kbn_top_nav.html @@ -6,10 +6,10 @@ aria-label="{{::menuItem.description}}" aria-haspopup="{{!menuItem.hasFunction}}" aria-expanded="{{kbnTopNav.isCurrent(menuItem.key)}}" - ng-class="{active: kbnTopNav.isCurrent(menuItem.key), 'is-kbn-top-nav-button-disabled': menuItem.disableButton}" + ng-class="{active: kbnTopNav.isCurrent(menuItem.key), 'is-kbn-top-nav-button-disabled': menuItem.disableButton()}" ng-click="kbnTopNav.handleClick(menuItem)" ng-bind="menuItem.label" - tooltip="{{menuItem.tooltip}}" + tooltip="{{menuItem.tooltip()}}" tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1" diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index 6ed1b253724c2..3f475847fef86 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -1,4 +1,4 @@ -import { capitalize, isArray, isFunction, result } from 'lodash'; +import { capitalize, isArray, isFunction } from 'lodash'; import uiModules from 'ui/modules'; import filterTemplate from 'ui/chrome/config/filter.html'; @@ -29,7 +29,7 @@ export default function ($compile) { const opt = this._applyOptDefault(rawOpt); if (!opt.key) throw new TypeError('KbnTopNav: menu items must have a key'); this.opts.push(opt); - if (!opt.hideButton) this.menuItems.push(opt); + if (!opt.hideButton()) this.menuItems.push(opt); if (opt.template) this.templates[opt.key] = opt.template; }); } @@ -51,7 +51,7 @@ export default function ($compile) { close(key) { (!key || this.isCurrent(key)) && this.setCurrent(null); } toggle(key) { this.setCurrent(this.isCurrent(key) ? null : key); } handleClick(menuItem) { - if (menuItem.disableButton) { + if (menuItem.disableButton()) { return false; } menuItem.run(menuItem, this); @@ -65,9 +65,9 @@ export default function ($compile) { run: (item) => this.toggle(item.key) }, opt); - defaultedOpt.hideButton = result(opt, 'hideButton', false); - defaultedOpt.disableButton = result(opt, 'disableButton', false); - defaultedOpt.tooltip = result(opt, 'tooltip', ''); + defaultedOpt.hideButton = isFunction(opt.hideButton) ? opt.hideButton : () => opt.hideButton; + defaultedOpt.disableButton = isFunction(opt.disableButton) ? opt.disableButton : () => opt.disableButton; + defaultedOpt.tooltip = isFunction(opt.tooltip) ? opt.tooltip : () => opt.tooltip; return defaultedOpt; } From 9939be453fc4d593c8af1557d8ba803aef516198 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 16:16:52 -0700 Subject: [PATCH 09/20] Adding defaults and fixing unit tests --- .../__tests__/kbn_top_nav_controller.js | 32 +++++++++++++++---- .../kbn_top_nav/kbn_top_nav_controller.js | 4 +-- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js index f72f13f2cf083..36614f1e9b7e9 100644 --- a/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js @@ -64,16 +64,19 @@ describe('KbnTopNavController', function () { }); describe('hideButton:', function () { - it('defaults to false', function () { + it('defaults to a function that returns false', function () { const controller = new KbnTopNavController([ { key: 'foo' }, { key: '1234' }, ]); - expect(pluck(controller.opts, 'hideButton')).to.eql([false, false]); + pluck(controller.opts, 'hideButton').forEach(prop => { + expect(prop).to.be.a(Function); + expect(prop()).to.eql(false); + }); }); - it('excludes opts from opts when true', function () { + it('excludes opts from opts when set to true', function () { const controller = new KbnTopNavController([ { key: 'foo' }, { key: '1234', hideButton: true }, @@ -81,27 +84,42 @@ describe('KbnTopNavController', function () { expect(controller.menuItems).to.have.length(1); }); + + it('excludes opts from opts when set to a function that returns true', function () { + const controller = new KbnTopNavController([ + { key: 'foo' }, + { key: '1234', hideButton: () => true }, + ]); + + expect(controller.menuItems).to.have.length(1); + }); }); describe('disableButton:', function () { - it('defaults to false', function () { + it('defaults to a function that returns false', function () { const controller = new KbnTopNavController([ { key: 'foo' }, { key: '1234' }, ]); - expect(pluck(controller.opts, 'disableButton')).to.eql([false, false]); + pluck(controller.opts, 'disableButton').forEach(prop => { + expect(prop).to.be.a(Function); + expect(prop()).to.eql(false); + }); }); }); describe('tooltip:', function () { - it('defaults to empty string', function () { + it('defaults to a function that returns undefined', function () { const controller = new KbnTopNavController([ { key: 'foo' }, { key: '1234' }, ]); - expect(pluck(controller.opts, 'tooltip')).to.eql(['', '']); + pluck(controller.opts, 'tooltip').forEach(prop => { + expect(prop).to.be.a(Function); + expect(prop()).to.eql(undefined); + }); }); }); diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index 3f475847fef86..2e44d6f0e5a60 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -65,8 +65,8 @@ export default function ($compile) { run: (item) => this.toggle(item.key) }, opt); - defaultedOpt.hideButton = isFunction(opt.hideButton) ? opt.hideButton : () => opt.hideButton; - defaultedOpt.disableButton = isFunction(opt.disableButton) ? opt.disableButton : () => opt.disableButton; + defaultedOpt.hideButton = isFunction(opt.hideButton) ? opt.hideButton : () => !!opt.hideButton || false; + defaultedOpt.disableButton = isFunction(opt.disableButton) ? opt.disableButton : () => !!opt.disableButton || false; defaultedOpt.tooltip = isFunction(opt.tooltip) ? opt.tooltip : () => opt.tooltip; return defaultedOpt; From 5ca6ad149ef6e2fc85fdaef13916fd82533872e6 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 25 Aug 2016 16:30:14 -0700 Subject: [PATCH 10/20] Removing redundant defaults --- src/ui/public/kbn_top_nav/kbn_top_nav_controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index 2e44d6f0e5a60..43eeaf13f4f5a 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -65,8 +65,8 @@ export default function ($compile) { run: (item) => this.toggle(item.key) }, opt); - defaultedOpt.hideButton = isFunction(opt.hideButton) ? opt.hideButton : () => !!opt.hideButton || false; - defaultedOpt.disableButton = isFunction(opt.disableButton) ? opt.disableButton : () => !!opt.disableButton || false; + defaultedOpt.hideButton = isFunction(opt.hideButton) ? opt.hideButton : () => !!opt.hideButton; + defaultedOpt.disableButton = isFunction(opt.disableButton) ? opt.disableButton : () => !!opt.disableButton; defaultedOpt.tooltip = isFunction(opt.tooltip) ? opt.tooltip : () => opt.tooltip; return defaultedOpt; From 79a8eede9487f55830ccdcaf42b956851bb316de Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 24 Aug 2016 16:39:11 -0700 Subject: [PATCH 11/20] upgrade all eslint-related deps --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 683d4fed98ec9..430c33045fa53 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-alpha1", "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", From e37accefc3865ff34c84534ba047bf993150631f Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 24 Aug 2016 17:13:39 -0700 Subject: [PATCH 12/20] convert console eslint overrides to new syntax --- src/core_plugins/console/.eslintrc | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/core_plugins/console/.eslintrc b/src/core_plugins/console/.eslintrc index c5fcfc4ff6fda..23b4375134922 100644 --- a/src/core_plugins/console/.eslintrc +++ b/src/core_plugins/console/.eslintrc @@ -4,31 +4,31 @@ root: true extends: '@elastic/kibana' 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 From 1e73417c73f77dfbdcfea9b5ee61922ee67390e7 Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 24 Aug 2016 17:14:21 -0700 Subject: [PATCH 13/20] disable new no-var and prefer-const rules in console --- src/core_plugins/console/.eslintrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core_plugins/console/.eslintrc b/src/core_plugins/console/.eslintrc index 23b4375134922..da082099cb33f 100644 --- a/src/core_plugins/console/.eslintrc +++ b/src/core_plugins/console/.eslintrc @@ -32,3 +32,5 @@ rules: semi: off strict: off wrap-iife: off + no-var: off + prefer-const: off From 8df3218e7b25109e2e821ed6453fa28f778a997e Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 24 Aug 2016 17:16:19 -0700 Subject: [PATCH 14/20] update eslint config --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 430c33045fa53..2449a1f49b8a7 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "wreck": "6.2.0" }, "devDependencies": { - "@elastic/eslint-config-kibana": "0.2.0-alpha1", + "@elastic/eslint-config-kibana": "0.2.0", "Nonsense": "0.1.2", "angular-mocks": "1.4.7", "auto-release-sinon": "1.0.3", From d5d38093bb70b6e33f212b1b61bd29eac90bc8ac Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 24 Aug 2016 17:23:40 -0700 Subject: [PATCH 15/20] disable no-unused-vars rule temporarily --- .eslintrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.eslintrc b/.eslintrc index 7a623df06a6ca..d54bd19499d7d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,2 +1,4 @@ --- extends: '@elastic/kibana' +rules: + no-unused-vars: off From 12f1c78d3023ba424296980d8041078a78594db2 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 25 Aug 2016 10:45:14 -0700 Subject: [PATCH 16/20] disable changed eslint rules temporarily --- .eslintrc | 4 ++++ src/core_plugins/console/.eslintrc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index d54bd19499d7d..1904222b3cfa9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,3 +2,7 @@ extends: '@elastic/kibana' rules: no-unused-vars: off + no-var: off + prefer-const: off + no-extra-semi: off + quotes: off diff --git a/src/core_plugins/console/.eslintrc b/src/core_plugins/console/.eslintrc index da082099cb33f..f539f6cd5878f 100644 --- a/src/core_plugins/console/.eslintrc +++ b/src/core_plugins/console/.eslintrc @@ -1,7 +1,7 @@ --- root: true -extends: '@elastic/kibana' +extends: '../../../.eslintrc' rules: block-scoped-var: off From 03f70f2214be3eab1b9c6634da259edfc6cac326 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 25 Aug 2016 10:47:57 -0700 Subject: [PATCH 17/20] fix async IIFE now that babel-eslint is upgraded --- src/cli/cluster/__tests__/_mock_cluster_fork.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'); - }()); + })(); } } From 7f6447f42a67680b8f3e05c8a5c9f0c1dbb4fac1 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 25 Aug 2016 10:48:30 -0700 Subject: [PATCH 18/20] ensure that import statements come before use --- src/ui/public/share/directives/share_object_url.js | 2 +- src/ui/ui_bundle_collection.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ui/public/share/directives/share_object_url.js b/src/ui/public/share/directives/share_object_url.js index d20a1c4c00305..f49c8dbcdf645 100644 --- a/src/ui/public/share/directives/share_object_url.js +++ b/src/ui/public/share/directives/share_object_url.js @@ -1,10 +1,10 @@ -const app = uiModules.get('kibana'); import Clipboard from 'clipboard'; import '../styles/index.less'; import LibUrlShortenerProvider from '../lib/url_shortener'; import uiModules from 'ui/modules'; import shareObjectUrlTemplate from 'ui/share/views/share_object_url.html'; +const app = uiModules.get('kibana'); app.directive('shareObjectUrl', function (Private, Notifier) { const urlShortener = Private(LibUrlShortenerProvider); diff --git a/src/ui/ui_bundle_collection.js b/src/ui/ui_bundle_collection.js index 3e652a176974c..a6b87779486b8 100644 --- a/src/ui/ui_bundle_collection.js +++ b/src/ui/ui_bundle_collection.js @@ -1,8 +1,3 @@ -const rimraf = promisify(require('rimraf')); -const mkdirp = promisify(require('mkdirp')); -const unlink = promisify(require('fs').unlink); -const readdir = promisify(require('fs').readdir); - import UiBundle from './ui_bundle'; import appEntryTemplate from './app_entry_template'; import { readFileSync as readSync } from 'fs'; @@ -11,6 +6,11 @@ import { join } from 'path'; import { resolve, promisify } from 'bluebird'; import { makeRe } from 'minimatch'; +const rimraf = promisify(require('rimraf')); +const mkdirp = promisify(require('mkdirp')); +const unlink = promisify(require('fs').unlink); +const readdir = promisify(require('fs').readdir); + class UiBundleCollection { constructor(bundlerEnv, filter) { this.each = []; From 685784ed384da6e6ac32850495f8361c2e33e9c8 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 25 Aug 2016 10:49:47 -0700 Subject: [PATCH 19/20] reindent code to satisfy new indentation checking --- src/cli/cluster/cluster_manager.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index 685c64db1246f..2e98b3bcbcfe7 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -85,19 +85,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__)[\\\/]/ }); From f4890e365319565607b081156e2675d23332b38d Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 25 Aug 2016 10:56:33 -0700 Subject: [PATCH 20/20] only ignore the optimize directory at the root of the project --- .eslintignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 0de6d839dc2ba..91d7e7b48c508 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ test/fixtures/scenarios -optimize +/optimize test/fixtures/scenarios