Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Monitoring] Fix linting issues #54068

Merged
merged 2 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -814,21 +808,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
*/
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/monitoring/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ 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 = (
<EuiKeyboardAccessible>
<a onClick={changeUrl}>
<span>{data.name}</span>
</a>
</EuiKeyboardAccessible>
);
/* eslint-enable jsx-a11y/click-events-have-key-events */
const master =
data.node_type === 'master' ? <EuiIcon type="starFilledSpace" color="primary" /> : null;
const shards = sortBy(data.children, 'shard').map(this.createShard);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function renderPluginBasicStats(vertex, timeseriesTooltipXValueFormatter) {
);
}

function renderIfBasicStats(_vertex) {
function renderIfBasicStats() {
return (
<p>
<FormattedMessage
Expand All @@ -175,7 +175,7 @@ function renderIfBasicStats(_vertex) {
);
}

function renderQueueBasicStats(_vertex) {
function renderQueueBasicStats() {
return (
<p>
<FormattedMessage
Expand Down Expand Up @@ -253,7 +253,7 @@ function renderIfBasicInfo(vertex) {
);
}

function renderQueueBasicInfo(_vertex) {
function renderQueueBasicInfo() {
return (
<p>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function executorProvider(Promise, $timeout) {
).finally(reset);
}

function reFetch(_changes) {
function reFetch() {
cancel();
run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ uiRoutes.when('/elasticsearch/nodes', {
}) || {};

const getPageData = ($injector, _api = undefined, routeOptions = {}) => {
_api; // to fix eslint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can also use something like // eslint-disable-next-line no-unused-vars above the function, but this works too 👍

const $http = $injector.get('$http');
const globalState = $injector.get('globalState');
const timeBounds = timefilter.getBounds();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down