From 8e6199a292878ee478463612d84a9cdcfc87b241 Mon Sep 17 00:00:00 2001 From: chrisronline Date: Mon, 6 Jan 2020 16:36:00 -0500 Subject: [PATCH] Fix linting issues --- .eslintrc.js | 21 ------------------- x-pack/legacy/plugins/monitoring/index.js | 2 +- .../public/components/chart/chart_target.js | 2 +- .../components/chart/chart_target.test.js | 4 ++-- .../shard_allocation/components/assigned.js | 3 +++ .../pipeline_viewer/views/detail_drawer.js | 6 +++--- .../public/services/executor_provider.js | 2 +- .../public/views/elasticsearch/nodes/index.js | 1 + .../views/logstash/node/pipelines/index.js | 1 + .../public/views/logstash/pipelines/index.js | 1 + .../monitoring/server/cloud/cloud_service.js | 2 +- .../lib/metrics/elasticsearch/classes.js | 2 +- .../server/lib/metrics/logstash/classes.js | 4 ++-- 13 files changed, 18 insertions(+), 33 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7dd0860aac04e..79a079edc7700 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -177,12 +177,6 @@ module.exports = { 'react-hooks/exhaustive-deps': 'off', }, }, - { - files: ['x-pack/legacy/plugins/monitoring/**/*.{js,ts,tsx}'], - rules: { - 'jsx-a11y/click-events-have-key-events': 'off', - }, - }, { files: ['x-pack/legacy/plugins/snapshot_restore/**/*.{js,ts,tsx}'], rules: { @@ -821,21 +815,6 @@ module.exports = { }, }, - /** - * Monitoring overrides - */ - { - files: ['x-pack/legacy/plugins/monitoring/**/*.js'], - rules: { - 'no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }], - 'no-else-return': 'error', - }, - }, - { - files: ['x-pack/legacy/plugins/monitoring/public/**/*.js'], - env: { browser: true }, - }, - /** * Canvas overrides */ diff --git a/x-pack/legacy/plugins/monitoring/index.js b/x-pack/legacy/plugins/monitoring/index.js index 3d98b11c2045b..8e0201bea710b 100644 --- a/x-pack/legacy/plugins/monitoring/index.js +++ b/x-pack/legacy/plugins/monitoring/index.js @@ -22,7 +22,7 @@ export const monitoring = kibana => id: 'monitoring', configPrefix: 'xpack.monitoring', publicDir: resolve(__dirname, 'public'), - init(server, _options) { + init(server) { const configs = [ 'xpack.monitoring.ui.enabled', 'xpack.monitoring.kibana.collection.enabled', diff --git a/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.js b/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.js index c3ca241c73cc0..5c9cddf9c2902 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.js +++ b/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.js @@ -46,7 +46,7 @@ export class ChartTarget extends React.Component { return seriesToShow.some(id => id.toLowerCase() === metric.id.toLowerCase()); }; } - return _metric => true; + return () => true; } UNSAFE_componentWillReceiveProps(newProps) { diff --git a/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.test.js b/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.test.js index bf0d5fdd24879..56eb52fa86235 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.test.js +++ b/x-pack/legacy/plugins/monitoring/public/components/chart/chart_target.test.js @@ -38,8 +38,8 @@ const props = { max: 1562962539851, }, hasLegend: true, - onBrush: _ => void 0, - tickFormatter: _ => void 0, + onBrush: () => void 0, + tickFormatter: () => void 0, updateLegend: () => void 0, }; diff --git a/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/assigned.js b/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/assigned.js index 012bc81135e34..897c20edc3f74 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/assigned.js +++ b/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/assigned.js @@ -46,6 +46,8 @@ export class Assigned extends React.Component { // TODO: redesign for shard allocation, possibly giving shard display the // ability to use the euiLink CSS class (blue link text instead of white link text) + // Disabling eslint because EuiKeyboardAccessible does it for us + /* eslint-disable jsx-a11y/click-events-have-key-events */ const name = ( @@ -53,6 +55,7 @@ export class Assigned extends React.Component { ); + /* eslint-enable jsx-a11y/click-events-have-key-events */ const master = data.node_type === 'master' ? : null; const shards = sortBy(data.children, 'shard').map(this.createShard); diff --git a/x-pack/legacy/plugins/monitoring/public/components/logstash/pipeline_viewer/views/detail_drawer.js b/x-pack/legacy/plugins/monitoring/public/components/logstash/pipeline_viewer/views/detail_drawer.js index cd9fe5229b640..73faa81af7b55 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/logstash/pipeline_viewer/views/detail_drawer.js +++ b/x-pack/legacy/plugins/monitoring/public/components/logstash/pipeline_viewer/views/detail_drawer.js @@ -164,7 +164,7 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) { ); } -function renderIfBasicStats(_vertex) { +function renderIfBasicStats() { return (

{ + _api; // to fix eslint const $http = $injector.get('$http'); const globalState = $injector.get('globalState'); const timeBounds = timefilter.getBounds(); diff --git a/x-pack/legacy/plugins/monitoring/public/views/logstash/node/pipelines/index.js b/x-pack/legacy/plugins/monitoring/public/views/logstash/node/pipelines/index.js index bc5ac75931fce..7bfcddf8f283a 100644 --- a/x-pack/legacy/plugins/monitoring/public/views/logstash/node/pipelines/index.js +++ b/x-pack/legacy/plugins/monitoring/public/views/logstash/node/pipelines/index.js @@ -23,6 +23,7 @@ import { DetailStatus } from '../../../../components/logstash/detail_status'; import { CODE_PATH_LOGSTASH } from '../../../../../common/constants'; const getPageData = ($injector, _api = undefined, routeOptions = {}) => { + _api; // fixing eslint const $route = $injector.get('$route'); const $http = $injector.get('$http'); const globalState = $injector.get('globalState'); diff --git a/x-pack/legacy/plugins/monitoring/public/views/logstash/pipelines/index.js b/x-pack/legacy/plugins/monitoring/public/views/logstash/pipelines/index.js index ce49fc2fac97b..03cf7383d1d02 100644 --- a/x-pack/legacy/plugins/monitoring/public/views/logstash/pipelines/index.js +++ b/x-pack/legacy/plugins/monitoring/public/views/logstash/pipelines/index.js @@ -23,6 +23,7 @@ import { CODE_PATH_LOGSTASH } from '../../../../common/constants'; */ const getPageData = ($injector, _api = undefined, routeOptions = {}) => { + _api; // to fix eslint const $http = $injector.get('$http'); const globalState = $injector.get('globalState'); const Private = $injector.get('Private'); diff --git a/x-pack/legacy/plugins/monitoring/server/cloud/cloud_service.js b/x-pack/legacy/plugins/monitoring/server/cloud/cloud_service.js index dcc8ad8fc8b64..2a408f5295aef 100644 --- a/x-pack/legacy/plugins/monitoring/server/cloud/cloud_service.js +++ b/x-pack/legacy/plugins/monitoring/server/cloud/cloud_service.js @@ -48,7 +48,7 @@ export class CloudService { * @param {Object} _request 'request' HTTP handler. * @return {Promise} Never {@code null} {@code CloudServiceResponse}. */ - _checkIfService(_request) { + _checkIfService() { return Promise.reject(new Error('not implemented')); } diff --git a/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/classes.js b/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/classes.js index 755b89a0409d0..d3a43ed651827 100644 --- a/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/classes.js +++ b/x-pack/legacy/plugins/monitoring/server/lib/metrics/elasticsearch/classes.js @@ -116,7 +116,7 @@ export class LatencyMetric extends ElasticsearchMetric { }, }; - this.calculation = (bucket, _key, _metric, _bucketSizeInSeconds) => { + this.calculation = bucket => { const timeInMillisDeriv = _.get(bucket, 'event_time_in_millis_deriv.normalized_value', null); const totalEventsDeriv = _.get(bucket, 'event_total_deriv.normalized_value', null); diff --git a/x-pack/legacy/plugins/monitoring/server/lib/metrics/logstash/classes.js b/x-pack/legacy/plugins/monitoring/server/lib/metrics/logstash/classes.js index c76edf9061396..eddcfabe83b1b 100644 --- a/x-pack/legacy/plugins/monitoring/server/lib/metrics/logstash/classes.js +++ b/x-pack/legacy/plugins/monitoring/server/lib/metrics/logstash/classes.js @@ -90,7 +90,7 @@ export class LogstashEventsLatencyClusterMetric extends LogstashClusterMetric { }, }; - this.calculation = (bucket, _key, _metric, _bucketSizeInSeconds) => { + this.calculation = bucket => { const timeInMillisDeriv = _.get(bucket, 'events_time_in_millis_deriv.normalized_value', null); const totalEventsDeriv = _.get(bucket, 'events_total_deriv.normalized_value', null); @@ -189,7 +189,7 @@ export class LogstashEventsLatencyMetric extends LogstashMetric { }, }; - this.calculation = (bucket, _key, _metric, _bucketSizeInSeconds) => { + this.calculation = bucket => { const timeInMillisDeriv = _.get(bucket, 'events_time_in_millis_deriv.normalized_value', null); const totalEventsDeriv = _.get(bucket, 'events_total_deriv.normalized_value', null);