From 724b7e83a43082886cf89481144fe65dd7533d1b Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 12 Dec 2019 10:07:00 -0700 Subject: [PATCH] move eslint rule override comments for code that moved around (cherry picked from commit 14bf10863a8dbdf4ac01c20889154149cb12978b) # Conflicts: # x-pack/legacy/plugins/rollup/public/crud_app/app.js --- .../src/components/guide_page/guide_page.js | 5 +++-- .../__tests__/timelion_expression_suggestions.js | 11 ++++++----- .../server/http/integration_tests/xsrf.test.js | 2 +- src/legacy/server/logging/log_with_metadata.js | 2 +- .../services/auto_follow_pattern_serialization.js | 14 ++++++++++++-- .../follower_index_form/follower_index_form.js | 4 +++- .../server/lib/error_wrappers/wrap_es_error.js | 2 +- .../shard_allocation/components/table_head.js | 3 +-- .../lib/elasticsearch/convert_metric_names.js | 5 ++++- .../legacy/plugins/rollup/public/crud_app/app.js | 2 +- .../server/lib/error_wrappers/wrap_es_error.js | 2 +- .../create_router/error_wrappers/wrap_es_error.js | 2 +- x-pack/legacy/server/lib/esjs_shield_plugin.js | 2 +- .../apis/monitoring/common/mappings_exist.js | 2 +- 14 files changed, 37 insertions(+), 21 deletions(-) diff --git a/packages/kbn-ui-framework/doc_site/src/components/guide_page/guide_page.js b/packages/kbn-ui-framework/doc_site/src/components/guide_page/guide_page.js index d1e6ddd63305cf..2ac14655eb8a5d 100644 --- a/packages/kbn-ui-framework/doc_site/src/components/guide_page/guide_page.js +++ b/packages/kbn-ui-framework/doc_site/src/components/guide_page/guide_page.js @@ -31,10 +31,11 @@ export class GuidePage extends Component { onClickLink(id) { // Scroll to element. + // eslint-disable-next-line no-undef $('html, body').animate( { - // eslint-disable-line no-undef - scrollTop: $(`#${id}`).offset().top - 100, // eslint-disable-line no-undef + // eslint-disable-next-line no-undef + scrollTop: $(`#${id}`).offset().top - 100, }, 250 ); diff --git a/src/legacy/core_plugins/timelion/public/directives/timelion_expression_suggestions/__tests__/timelion_expression_suggestions.js b/src/legacy/core_plugins/timelion/public/directives/timelion_expression_suggestions/__tests__/timelion_expression_suggestions.js index d7864f45920f26..a74cf19df29e37 100644 --- a/src/legacy/core_plugins/timelion/public/directives/timelion_expression_suggestions/__tests__/timelion_expression_suggestions.js +++ b/src/legacy/core_plugins/timelion/public/directives/timelion_expression_suggestions/__tests__/timelion_expression_suggestions.js @@ -27,11 +27,12 @@ describe('Timelion expression suggestions directive', function() { beforeEach(ngMock.module('kibana')); - beforeEach(inject(function($injector) { - // eslint-disable-line no-undef - $compile = $injector.get('$compile'); - scope = $injector.get('$rootScope').$new(); - })); + beforeEach( + ngMock.inject(function($injector) { + $compile = $injector.get('$compile'); + scope = $injector.get('$rootScope').$new(); + }) + ); describe('attributes', function() { describe('suggestions', function() { diff --git a/src/legacy/server/http/integration_tests/xsrf.test.js b/src/legacy/server/http/integration_tests/xsrf.test.js index 46ba5eaeb3f303..428fda6f8fe571 100644 --- a/src/legacy/server/http/integration_tests/xsrf.test.js +++ b/src/legacy/server/http/integration_tests/xsrf.test.js @@ -108,8 +108,8 @@ describe('xsrf request filter', () => { }); for (const method of destructiveMethods) { + // eslint-disable-next-line no-loop-func describe(`destructiveMethod: ${method}`, function() { - // eslint-disable-line no-loop-func it('accepts requests with the xsrf header', async function() { await kbnTestServer.request[method.toLowerCase()](root, testPath) .set(xsrfHeader, 'anything') diff --git a/src/legacy/server/logging/log_with_metadata.js b/src/legacy/server/logging/log_with_metadata.js index 067eb567ce63b6..73e03a154907ac 100644 --- a/src/legacy/server/logging/log_with_metadata.js +++ b/src/legacy/server/logging/log_with_metadata.js @@ -18,10 +18,10 @@ */ import { isPlainObject } from 'lodash'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { metadataSymbol, attachMetaData, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../../../src/core/server/legacy/logging/legacy_logging_server'; export const logWithMetadata = { diff --git a/x-pack/legacy/plugins/cross_cluster_replication/common/services/auto_follow_pattern_serialization.js b/x-pack/legacy/plugins/cross_cluster_replication/common/services/auto_follow_pattern_serialization.js index 14131bf3624df4..36a2b79361c34c 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/common/services/auto_follow_pattern_serialization.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/common/services/auto_follow_pattern_serialization.js @@ -5,9 +5,19 @@ */ export const deserializeAutoFollowPattern = ( - { name, pattern: { remote_cluster, leader_index_patterns, follow_index_pattern } } = { + { + name, + pattern: { + // eslint-disable-next-line camelcase + remote_cluster, + // eslint-disable-next-line camelcase + leader_index_patterns, + // eslint-disable-next-line camelcase + follow_index_pattern, + }, + } = { pattern: {}, - } // eslint-disable-line camelcase + } ) => ({ name, remoteCluster: remote_cluster, diff --git a/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js b/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js index 00d94edf9c41c0..329ef4756133db 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js @@ -117,8 +117,10 @@ export class FollowerIndexForm extends PureComponent { ...getEmptyFollowerIndex(), ...this.props.followerIndex, }; + + // eslint-disable-next-line no-nested-ternary const areAdvancedSettingsVisible = isNew - ? false // eslint-disable-line no-nested-ternary + ? false : areAdvancedSettingsEdited(followerIndex) ? true : false; diff --git a/x-pack/legacy/plugins/cross_cluster_replication/server/lib/error_wrappers/wrap_es_error.js b/x-pack/legacy/plugins/cross_cluster_replication/server/lib/error_wrappers/wrap_es_error.js index a26b6fec1375d5..5f4884a3f2d266 100644 --- a/x-pack/legacy/plugins/cross_cluster_replication/server/lib/error_wrappers/wrap_es_error.js +++ b/x-pack/legacy/plugins/cross_cluster_replication/server/lib/error_wrappers/wrap_es_error.js @@ -13,8 +13,8 @@ function extractCausedByChain(causedBy = {}, accumulator = []) { accumulator.push(reason); } + // eslint-disable-next-line camelcase if (caused_by) { - // eslint-disable-line camelcase return extractCausedByChain(caused_by, accumulator); } diff --git a/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js b/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js index 044c1f5886f432..922164fd4e9a75 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js +++ b/x-pack/legacy/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js @@ -48,9 +48,8 @@ class IndexLabel extends React.Component { } } +// eslint-disable-next-line react/no-multi-comp export class TableHead extends React.Component { - // eslint-disable-line react/no-multi-comp - constructor(props) { super(props); } diff --git a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js index 04b3f09a47cc34..41ba904377d294 100644 --- a/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js +++ b/x-pack/legacy/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js @@ -55,11 +55,14 @@ export function uncovertMetricNames(byDateBucketResponse) { unconverted[metricName] = { buckets: byDateBucketResponse.buckets.map(bucket => { const { + // eslint-disable-next-line camelcase key_as_string, + // eslint-disable-next-line camelcase key, + // eslint-disable-next-line camelcase doc_count, ...rest - } = bucket; /* eslint-disable-line camelcase */ + } = bucket; const metrics = Object.entries(rest).reduce((accum, [key, value]) => { if (key.startsWith(`${CONVERTED_TOKEN}${metricName}`)) { const name = key.split('__')[1]; diff --git a/x-pack/legacy/plugins/rollup/public/crud_app/app.js b/x-pack/legacy/plugins/rollup/public/crud_app/app.js index 1bfa49e378d235..afec03763abae5 100644 --- a/x-pack/legacy/plugins/rollup/public/crud_app/app.js +++ b/x-pack/legacy/plugins/rollup/public/crud_app/app.js @@ -39,8 +39,8 @@ class ShareRouter extends Component { } } +// eslint-disable-next-line react/no-multi-comp export class App extends Component { - // eslint-disable-line react/no-multi-comp componentDidMount() { trackUiMetric(METRIC_TYPE.LOADED, UIM_APP_LOAD); } diff --git a/x-pack/legacy/plugins/rollup/server/lib/error_wrappers/wrap_es_error.js b/x-pack/legacy/plugins/rollup/server/lib/error_wrappers/wrap_es_error.js index a26b6fec1375d5..5f4884a3f2d266 100644 --- a/x-pack/legacy/plugins/rollup/server/lib/error_wrappers/wrap_es_error.js +++ b/x-pack/legacy/plugins/rollup/server/lib/error_wrappers/wrap_es_error.js @@ -13,8 +13,8 @@ function extractCausedByChain(causedBy = {}, accumulator = []) { accumulator.push(reason); } + // eslint-disable-next-line camelcase if (caused_by) { - // eslint-disable-line camelcase return extractCausedByChain(caused_by, accumulator); } diff --git a/x-pack/legacy/server/lib/create_router/error_wrappers/wrap_es_error.js b/x-pack/legacy/server/lib/create_router/error_wrappers/wrap_es_error.js index 22b115b6560b19..72be6321af8a20 100644 --- a/x-pack/legacy/server/lib/create_router/error_wrappers/wrap_es_error.js +++ b/x-pack/legacy/server/lib/create_router/error_wrappers/wrap_es_error.js @@ -13,8 +13,8 @@ function extractCausedByChain(causedBy = {}, accumulator = []) { accumulator.push(reason); } + // eslint-disable-next-line camelcase if (caused_by) { - // eslint-disable-line camelcase return extractCausedByChain(caused_by, accumulator); } diff --git a/x-pack/legacy/server/lib/esjs_shield_plugin.js b/x-pack/legacy/server/lib/esjs_shield_plugin.js index 27219336c5f2dc..ef7f2cf2a1de9b 100644 --- a/x-pack/legacy/server/lib/esjs_shield_plugin.js +++ b/x-pack/legacy/server/lib/esjs_shield_plugin.js @@ -5,8 +5,8 @@ */ (function(root, factory) { + // eslint-disable-next-line no-undef if (typeof define === 'function' && define.amd) { - // eslint-disable-line no-undef define([], factory); // eslint-disable-line no-undef } else if (typeof exports === 'object') { module.exports = factory(); diff --git a/x-pack/test/api_integration/apis/monitoring/common/mappings_exist.js b/x-pack/test/api_integration/apis/monitoring/common/mappings_exist.js index cde7da519ef8fb..73b3f5f97c6fad 100644 --- a/x-pack/test/api_integration/apis/monitoring/common/mappings_exist.js +++ b/x-pack/test/api_integration/apis/monitoring/common/mappings_exist.js @@ -56,8 +56,8 @@ export default function({ getService }) { // eslint-disable-line no-loop-func for (const metric of Object.values(metrics)) { for (const field of metric.getFields()) { + // eslint-disable-next-line no-loop-func it(`${field} should exist in the mappings`, () => { - // eslint-disable-line no-loop-func const propertyGetter = field .split('.') .reduce((list, field) => {