From 56352b26fbd2b791a1d0b2b58f7cc2b1fef60b3a Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 22 Mar 2019 18:53:54 -0700 Subject: [PATCH] [7.0] [eslint] merge custom rules into a single plugin (#33733) (#33759) Backports the following commits to 7.0: - [eslint] merge custom rules into a single plugin (#33733) --- .eslintignore | 1 - .eslintrc.js | 17 ++- package.json | 3 +- packages/eslint-plugin-kibana-custom/index.js | 14 --- .../eslint-plugin-kibana-custom/package.json | 10 -- .../README.md | 0 .../index.js | 1 + .../lib.js | 4 +- .../package.json | 2 +- .../__tests__/disallow_license_headers.js | 101 +++++++++--------- .../rules/__tests__/require_license_header.js | 65 ++++++----- .../rules/disallow_license_headers.js | 36 ++++--- .../rules/no_default_export.js | 29 +++++ .../rules/require_license_header.js | 43 ++++---- .../core_plugins/kibana/public/.eslintrc | 6 +- .../kibana/public/discover/_hit_sort_fn.js | 2 +- .../field_formats/__tests__/_conformance.js | 2 +- src/legacy/ui/public/.eslintrc | 5 +- .../hierarchical/_collect_branch.js | 2 +- .../agg_types/__tests__/agg_param_writer.js | 2 +- .../agg_types/__tests__/param_types/_json.js | 2 +- .../__tests__/param_types/_string.js | 2 +- .../__tests__/utils/_stub_agg_params.js | 2 +- src/legacy/ui/public/chrome/api/apps.js | 2 +- src/legacy/ui/public/chrome/api/template.js | 2 +- src/legacy/ui/public/chrome/index.js | 2 +- .../route_setup/load_default.js | 2 +- .../ui/public/jquery/find_test_subject.js | 2 +- src/legacy/ui/public/routes/index.js | 2 +- src/legacy/ui/public/routes/route_manager.js | 2 +- src/legacy/ui/public/utils/ipv4_address.ts | 2 +- src/legacy/ui/public/utils/mapping_setup.js | 2 +- src/legacy/ui/public/vis/agg_config_result.js | 2 +- src/legacy/ui/public/vislib/index.js | 2 +- .../layout/splits/gauge_chart/chart_split.js | 2 +- .../splits/gauge_chart/chart_title_split.js | 2 +- .../scroll_into_view_if_necessary.js | 2 +- .../ml/public/lib/angular_bootstrap_patch.js | 2 +- .../server/lib/encode_uri_query.js | 2 +- .../server/lib/pdf/assets/fonts/noto/index.js | 2 +- x-pack/test/functional/config.js | 2 +- 41 files changed, 196 insertions(+), 191 deletions(-) delete mode 100644 packages/eslint-plugin-kibana-custom/index.js delete mode 100644 packages/eslint-plugin-kibana-custom/package.json rename packages/{eslint-plugin-kibana-custom => kbn-eslint-plugin-eslint}/README.md (100%) rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/index.js (94%) rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/lib.js (93%) rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/package.json (81%) rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/rules/__tests__/disallow_license_headers.js (73%) rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/rules/__tests__/require_license_header.js (87%) rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/rules/disallow_license_headers.js (77%) create mode 100644 packages/kbn-eslint-plugin-eslint/rules/no_default_export.js rename packages/{kbn-eslint-plugin-license-header => kbn-eslint-plugin-eslint}/rules/require_license_header.js (81%) diff --git a/.eslintignore b/.eslintignore index 9a0d3d6a09752..eb1dce7bb2edc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -17,7 +17,6 @@ bower_components /src/core/lib/kbn_internal_native_observable /packages/*/target /packages/eslint-config-kibana -/packages/eslint-plugin-kibana-custom /packages/kbn-es-query/src/kuery/ast/kuery.js /packages/kbn-es-query/src/kuery/ast/legacy_kuery.js /packages/kbn-pm/dist diff --git a/.eslintrc.js b/.eslintrc.js index 0b9964701009b..703ab009a7428 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,6 +34,7 @@ const ELASTIC_LICENSE_HEADER = ` module.exports = { extends: ['@elastic/eslint-config-kibana', '@elastic/eslint-config-kibana/jest'], + plugins: ['@kbn/eslint-plugin-eslint'], settings: { 'import/resolver': { @@ -55,7 +56,7 @@ module.exports = { { files: [ '.eslintrc.js', - 'packages/eslint-plugin-kibana-custom/**/*', + 'packages/kbn-eslint-plugin-eslint/**/*', 'packages/kbn-config-schema/**/*', 'packages/kbn-pm/**/*', 'packages/kbn-es/**/*', @@ -86,7 +87,7 @@ module.exports = { { files: ['x-pack/test/functional/apps/**/*', 'x-pack/plugins/apm/**/*'], rules: { - 'kibana-custom/no-default-export': 'off', + '@kbn/eslint/no-default-export': 'off', 'import/no-named-as-default': 'off', }, }, @@ -240,7 +241,7 @@ module.exports = { 'packages/kbn-plugin-generator/**/*', 'packages/kbn-plugin-helpers/**/*', 'packages/kbn-eslint-import-resolver-kibana/**/*', - 'packages/kbn-eslint-plugin-license-header/**/*', + 'packages/kbn-eslint-plugin-eslint/**/*', 'x-pack/gulpfile.js', 'x-pack/dev-tools/mocha/setup_mocha.js', 'x-pack/scripts/*', @@ -265,15 +266,14 @@ module.exports = { */ { files: ['**/*.js'], - plugins: ['@kbn/eslint-plugin-license-header'], rules: { - '@kbn/license-header/require-license-header': [ + '@kbn/eslint/require-license-header': [ 'error', { license: APACHE_2_0_LICENSE_HEADER, }, ], - '@kbn/license-header/disallow-license-headers': [ + '@kbn/eslint/disallow-license-headers': [ 'error', { licenses: [ELASTIC_LICENSE_HEADER], @@ -297,15 +297,14 @@ module.exports = { */ { files: ['x-pack/**/*.js'], - plugins: ['@kbn/eslint-plugin-license-header'], rules: { - '@kbn/license-header/require-license-header': [ + '@kbn/eslint/require-license-header': [ 'error', { license: ELASTIC_LICENSE_HEADER, }, ], - '@kbn/license-header/disallow-license-headers': [ + '@kbn/eslint/disallow-license-headers': [ 'error', { licenses: [APACHE_2_0_LICENSE_HEADER], diff --git a/package.json b/package.json index da76ea044f8f2..43b33b1a88ba5 100644 --- a/package.json +++ b/package.json @@ -251,11 +251,10 @@ "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0", "@elastic/eslint-config-kibana": "0.15.0", - "@elastic/eslint-plugin-kibana-custom": "1.1.0", "@elastic/makelogs": "^4.4.0", "@kbn/es": "1.0.0", "@kbn/eslint-import-resolver-kibana": "2.0.0", - "@kbn/eslint-plugin-license-header": "1.0.0", + "@kbn/eslint-plugin-eslint": "1.0.0", "@kbn/plugin-generator": "1.0.0", "@kbn/test": "1.0.0", "@octokit/rest": "^15.10.0", diff --git a/packages/eslint-plugin-kibana-custom/index.js b/packages/eslint-plugin-kibana-custom/index.js deleted file mode 100644 index 3dada3ef3a610..0000000000000 --- a/packages/eslint-plugin-kibana-custom/index.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - rules: { - 'no-default-export': { - meta: { - schema: [] - }, - create: context => ({ - ExportDefaultDeclaration: (node) => { - context.report(node, 'Default exports not allowed.'); - } - }) - } - } -}; diff --git a/packages/eslint-plugin-kibana-custom/package.json b/packages/eslint-plugin-kibana-custom/package.json deleted file mode 100644 index 51a36e86dce52..0000000000000 --- a/packages/eslint-plugin-kibana-custom/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@elastic/eslint-plugin-kibana-custom", - "version": "1.1.0", - "license": "Apache-2.0", - "description": "Custom ESLint rules for Kibana", - "repository": { - "type": "git", - "url": "https://github.com/elastic/kibana/tree/master/packages/%40elastic/eslint-plugin-kibana-custom" - } -} diff --git a/packages/eslint-plugin-kibana-custom/README.md b/packages/kbn-eslint-plugin-eslint/README.md similarity index 100% rename from packages/eslint-plugin-kibana-custom/README.md rename to packages/kbn-eslint-plugin-eslint/README.md diff --git a/packages/kbn-eslint-plugin-license-header/index.js b/packages/kbn-eslint-plugin-eslint/index.js similarity index 94% rename from packages/kbn-eslint-plugin-license-header/index.js rename to packages/kbn-eslint-plugin-eslint/index.js index 003c89b0c5f3b..70b42d92d4b74 100644 --- a/packages/kbn-eslint-plugin-license-header/index.js +++ b/packages/kbn-eslint-plugin-eslint/index.js @@ -21,5 +21,6 @@ module.exports = { rules: { 'require-license-header': require('./rules/require_license_header'), 'disallow-license-headers': require('./rules/disallow_license_headers'), + 'no-default-export': require('./rules/no_default_export'), }, }; diff --git a/packages/kbn-eslint-plugin-license-header/lib.js b/packages/kbn-eslint-plugin-eslint/lib.js similarity index 93% rename from packages/kbn-eslint-plugin-license-header/lib.js rename to packages/kbn-eslint-plugin-eslint/lib.js index 5d632b7c328c3..56684746c479f 100644 --- a/packages/kbn-eslint-plugin-license-header/lib.js +++ b/packages/kbn-eslint-plugin-eslint/lib.js @@ -31,14 +31,14 @@ exports.normalizeWhitespace = function normalizeWhitespace(string) { return string.replace(/\s+/g, ' '); }; -exports.init = function (context, program, initStep) { +exports.init = function(context, program, initStep) { try { return initStep(); } catch (error) { if (error.failedAssertion) { context.report({ node: program, - message: error.message + message: error.message, }); } else { throw error; diff --git a/packages/kbn-eslint-plugin-license-header/package.json b/packages/kbn-eslint-plugin-eslint/package.json similarity index 81% rename from packages/kbn-eslint-plugin-license-header/package.json rename to packages/kbn-eslint-plugin-eslint/package.json index 2c62a4232cf18..b35387384071e 100644 --- a/packages/kbn-eslint-plugin-license-header/package.json +++ b/packages/kbn-eslint-plugin-eslint/package.json @@ -1,5 +1,5 @@ { - "name": "@kbn/eslint-plugin-license-header", + "name": "@kbn/eslint-plugin-eslint", "version": "1.0.0", "private": true, "license": "Apache-2.0", diff --git a/packages/kbn-eslint-plugin-license-header/rules/__tests__/disallow_license_headers.js b/packages/kbn-eslint-plugin-eslint/rules/__tests__/disallow_license_headers.js similarity index 73% rename from packages/kbn-eslint-plugin-license-header/rules/__tests__/disallow_license_headers.js rename to packages/kbn-eslint-plugin-eslint/rules/__tests__/disallow_license_headers.js index 2ae6111166089..61fc1c112b8b2 100644 --- a/packages/kbn-eslint-plugin-license-header/rules/__tests__/disallow_license_headers.js +++ b/packages/kbn-eslint-plugin-eslint/rules/__tests__/disallow_license_headers.js @@ -21,15 +21,14 @@ const { RuleTester } = require('eslint'); const rule = require('../disallow_license_headers'); const dedent = require('dedent'); -const RULE_NAME = '@kbn/license-header/disallow-license-headers'; - const ruleTester = new RuleTester({ parser: 'babel-eslint', parserOptions: { - ecmaVersion: 2015 - } + ecmaVersion: 2015, + }, }); -ruleTester.run(RULE_NAME, rule, { + +ruleTester.run('@kbn/eslint/disallow-license-headers', rule, { valid: [ { code: dedent` @@ -38,11 +37,11 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [{ - licenses: [ - '// license' - ] - }], + options: [ + { + licenses: ['// license'], + }, + ], }, { code: dedent` @@ -51,12 +50,12 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [{ - licenses: [ - '/* license */', - ] - }], - } + options: [ + { + licenses: ['/* license */'], + }, + ], + }, ], invalid: [ @@ -70,8 +69,8 @@ ruleTester.run(RULE_NAME, rule, { errors: [ { message: '"licenses" option is required', - } - ] + }, + ], }, // license cannot contain multiple block comments @@ -80,16 +79,16 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [{ - licenses: [ - '/* one *//* two */' - ] - }], + options: [ + { + licenses: ['/* one *//* two */'], + }, + ], errors: [ { message: '"licenses[0]" option must only include a single comment', - } - ] + }, + ], }, // license cannot contain multiple line comments @@ -98,16 +97,16 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [{ - licenses: [ - `// one\n// two` - ] - }], + options: [ + { + licenses: [`// one\n// two`], + }, + ], errors: [ { message: '"licenses[0]" option must only include a single comment', - } - ] + }, + ], }, // license cannot contain expressions @@ -116,20 +115,22 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [{ - licenses: [ - '// old license', - dedent` + options: [ + { + licenses: [ + '// old license', + dedent` /* license */ console.log('hello world'); - ` - ] - }], + `, + ], + }, + ], errors: [ { message: '"licenses[1]" option must only include a single comment', - } - ] + }, + ], }, // license is not a single comment @@ -138,18 +139,16 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [{ - licenses: [ - '// old license', - '// older license', - `console.log('hello world');` - ] - }], + options: [ + { + licenses: ['// old license', '// older license', `console.log('hello world');`], + }, + ], errors: [ { message: '"licenses[2]" option must only include a single comment', - } - ] + }, + ], }, - ] + ], }); diff --git a/packages/kbn-eslint-plugin-license-header/rules/__tests__/require_license_header.js b/packages/kbn-eslint-plugin-eslint/rules/__tests__/require_license_header.js similarity index 87% rename from packages/kbn-eslint-plugin-license-header/rules/__tests__/require_license_header.js rename to packages/kbn-eslint-plugin-eslint/rules/__tests__/require_license_header.js index 86c7ea3244541..491ceb2290be1 100644 --- a/packages/kbn-eslint-plugin-license-header/rules/__tests__/require_license_header.js +++ b/packages/kbn-eslint-plugin-eslint/rules/__tests__/require_license_header.js @@ -21,15 +21,14 @@ const { RuleTester } = require('eslint'); const rule = require('../require_license_header'); const dedent = require('dedent'); -const RULE_NAME = '@kbn/license-header/require-license-header'; - const ruleTester = new RuleTester({ parser: 'babel-eslint', parserOptions: { - ecmaVersion: 2015 - } + ecmaVersion: 2015, + }, }); -ruleTester.run(RULE_NAME, rule, { + +ruleTester.run('@kbn/eslint/require-license-header', rule, { valid: [ { code: dedent` @@ -48,7 +47,7 @@ ruleTester.run(RULE_NAME, rule, { `, options: [{ license: '// license' }], - } + }, ], invalid: [ @@ -62,8 +61,8 @@ ruleTester.run(RULE_NAME, rule, { errors: [ { message: '"license" option is required', - } - ] + }, + ], }, // content cannot contain multiple block comments @@ -72,14 +71,12 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [ - { license: '/* one *//* two */' } - ], + options: [{ license: '/* one *//* two */' }], errors: [ { message: '"license" option must only include a single comment', - } - ] + }, + ], }, // content cannot contain multiple line comments @@ -88,14 +85,12 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [ - { license: `// one\n// two` } - ], + options: [{ license: `// one\n// two` }], errors: [ { message: '"license" option must only include a single comment', - } - ] + }, + ], }, // content cannot contain expressions @@ -109,14 +104,14 @@ ruleTester.run(RULE_NAME, rule, { license: dedent` /* license */ console.log('hello world'); - ` - } + `, + }, ], errors: [ { message: '"license" option must only include a single comment', - } - ] + }, + ], }, // content is not a single comment @@ -125,14 +120,12 @@ ruleTester.run(RULE_NAME, rule, { console.log('foo') `, - options: [ - { license: `console.log('hello world');` } - ], + options: [{ license: `console.log('hello world');` }], errors: [ { message: '"license" option must only include a single comment', - } - ] + }, + ], }, // missing license header @@ -145,19 +138,21 @@ ruleTester.run(RULE_NAME, rule, { errors: [ { message: 'File must start with a license header', - } + }, ], output: dedent` /* license */ console.log('foo') - ` + `, }, // strips newlines before the license comment { - code: '\n\n' + dedent` + code: + '\n\n' + + dedent` /* license */ console.log('foo') @@ -167,14 +162,14 @@ ruleTester.run(RULE_NAME, rule, { errors: [ { message: 'License header must be at the very beginning of the file', - } + }, ], output: dedent` /* license */ console.log('foo') - ` + `, }, // moves license header before other nodes if necessary @@ -189,7 +184,7 @@ ruleTester.run(RULE_NAME, rule, { errors: [ { message: 'License header must be at the very beginning of the file', - } + }, ], output: dedent` @@ -198,7 +193,7 @@ ruleTester.run(RULE_NAME, rule, { /* not license */ console.log('foo') - ` + `, }, - ] + ], }); diff --git a/packages/kbn-eslint-plugin-license-header/rules/disallow_license_headers.js b/packages/kbn-eslint-plugin-eslint/rules/disallow_license_headers.js similarity index 77% rename from packages/kbn-eslint-plugin-license-header/rules/disallow_license_headers.js rename to packages/kbn-eslint-plugin-eslint/rules/disallow_license_headers.js index f7bd6fb68a785..0567307d18968 100644 --- a/packages/kbn-eslint-plugin-license-header/rules/disallow_license_headers.js +++ b/packages/kbn-eslint-plugin-eslint/rules/disallow_license_headers.js @@ -24,18 +24,20 @@ const { assert, normalizeWhitespace, init } = require('../lib'); module.exports = { meta: { fixable: 'code', - schema: [{ - type: 'object', - properties: { - licenses: { - type: 'array', - items: { - type: 'string' - } + schema: [ + { + type: 'object', + properties: { + licenses: { + type: 'array', + items: { + type: 'string', + }, + }, }, + additionalProperties: false, }, - additionalProperties: false, - }] + ], }, create: context => { return { @@ -49,8 +51,14 @@ module.exports = { return licenses.map((license, i) => { const parsed = babelEslint.parse(license); - assert(!parsed.body.length, `"licenses[${i}]" option must only include a single comment`); - assert(parsed.comments.length === 1, `"licenses[${i}]" option must only include a single comment`); + assert( + !parsed.body.length, + `"licenses[${i}]" option must only include a single comment` + ); + assert( + parsed.comments.length === 1, + `"licenses[${i}]" option must only include a single comment` + ); return normalizeWhitespace(parsed.comments[0].value); }); @@ -69,10 +77,10 @@ module.exports = { message: 'This license header is not allowed in this file.', fix(fixer) { return fixer.remove(node); - } + }, }); }); }, }; - } + }, }; diff --git a/packages/kbn-eslint-plugin-eslint/rules/no_default_export.js b/packages/kbn-eslint-plugin-eslint/rules/no_default_export.js new file mode 100644 index 0000000000000..660b9f8bb8b3c --- /dev/null +++ b/packages/kbn-eslint-plugin-eslint/rules/no_default_export.js @@ -0,0 +1,29 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +module.exports = { + meta: { + schema: [], + }, + create: context => ({ + ExportDefaultDeclaration: node => { + context.report(node, 'Default exports not allowed.'); + }, + }), +}; diff --git a/packages/kbn-eslint-plugin-license-header/rules/require_license_header.js b/packages/kbn-eslint-plugin-eslint/rules/require_license_header.js similarity index 81% rename from packages/kbn-eslint-plugin-license-header/rules/require_license_header.js rename to packages/kbn-eslint-plugin-eslint/rules/require_license_header.js index 6aa1a6223b628..f3c9fcef1985e 100644 --- a/packages/kbn-eslint-plugin-license-header/rules/require_license_header.js +++ b/packages/kbn-eslint-plugin-eslint/rules/require_license_header.js @@ -28,20 +28,22 @@ function isHashbang(text) { module.exports = { meta: { fixable: 'code', - schema: [{ - type: 'object', - properties: { - license: { - type: 'string', + schema: [ + { + type: 'object', + properties: { + license: { + type: 'string', + }, }, + additionalProperties: false, }, - additionalProperties: false, - }] + ], }, create: context => { return { Program(program) { - const license = init(context, program, function () { + const license = init(context, program, function() { const options = context.options[0] || {}; const license = options.license; @@ -49,11 +51,14 @@ module.exports = { const parsed = babelEslint.parse(license); assert(!parsed.body.length, '"license" option must only include a single comment'); - assert(parsed.comments.length === 1, '"license" option must only include a single comment'); + assert( + parsed.comments.length === 1, + '"license" option must only include a single comment' + ); return { source: license, - nodeValue: normalizeWhitespace(parsed.comments[0].value) + nodeValue: normalizeWhitespace(parsed.comments[0].value), }; }); @@ -62,9 +67,9 @@ module.exports = { } const sourceCode = context.getSourceCode(); - const comment = sourceCode.getAllComments().find(node => ( - normalizeWhitespace(node.value) === license.nodeValue - )); + const comment = sourceCode + .getAllComments() + .find(node => normalizeWhitespace(node.value) === license.nodeValue); // no licence comment if (!comment) { @@ -72,7 +77,7 @@ module.exports = { message: 'File must start with a license header', loc: { start: { line: 1, column: 0 }, - end: { line: 1, column: sourceCode.lines[0].length - 1 } + end: { line: 1, column: sourceCode.lines[0].length - 1 }, }, fix(fixer) { if (isHashbang(sourceCode.lines[0])) { @@ -80,13 +85,15 @@ module.exports = { } return fixer.replaceTextRange([0, 0], license.source + '\n\n'); - } + }, }); return; } // ensure there is nothing before the comment - const sourceBeforeNode = sourceCode.getText().slice(0, sourceCode.getIndexFromLoc(comment.loc.start)); + const sourceBeforeNode = sourceCode + .getText() + .slice(0, sourceCode.getIndexFromLoc(comment.loc.start)); if (sourceBeforeNode.length && !isHashbang(sourceBeforeNode)) { context.report({ node: comment, @@ -103,10 +110,10 @@ module.exports = { fixer.remove(comment), fixer.replaceTextRange([0, 0], license.source + '\n\n'), ]; - } + }, }); } }, }; - } + }, }; diff --git a/src/legacy/core_plugins/kibana/public/.eslintrc b/src/legacy/core_plugins/kibana/public/.eslintrc index bc1b9bbdf4949..95e3757201989 100644 --- a/src/legacy/core_plugins/kibana/public/.eslintrc +++ b/src/legacy/core_plugins/kibana/public/.eslintrc @@ -1,7 +1,3 @@ - -plugins: [ - '@elastic/eslint-plugin-kibana-custom' -] rules: no-console: 2 - '@elastic/kibana-custom/no-default-export': error + '@kbn/eslint/no-default-export': error diff --git a/src/legacy/core_plugins/kibana/public/discover/_hit_sort_fn.js b/src/legacy/core_plugins/kibana/public/discover/_hit_sort_fn.js index ce5311e46d655..c60f13bb76d4f 100644 --- a/src/legacy/core_plugins/kibana/public/discover/_hit_sort_fn.js +++ b/src/legacy/core_plugins/kibana/public/discover/_hit_sort_fn.js @@ -17,7 +17,7 @@ * under the License. */ -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function HitSortFnFactory() { /** * Creates a sort function that will resort hits based on the value diff --git a/src/legacy/core_plugins/kibana/public/field_formats/__tests__/_conformance.js b/src/legacy/core_plugins/kibana/public/field_formats/__tests__/_conformance.js index 9e1f6015bd35f..d23b60cad87c8 100644 --- a/src/legacy/core_plugins/kibana/public/field_formats/__tests__/_conformance.js +++ b/src/legacy/core_plugins/kibana/public/field_formats/__tests__/_conformance.js @@ -43,7 +43,7 @@ const formatIds = [ 'static_lookup' ]; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default describe('conformance', function () { const getConfig = (...args) => config.get(...args); diff --git a/src/legacy/ui/public/.eslintrc b/src/legacy/ui/public/.eslintrc index 4285d367bdb5b..95e3757201989 100644 --- a/src/legacy/ui/public/.eslintrc +++ b/src/legacy/ui/public/.eslintrc @@ -1,6 +1,3 @@ -plugins: [ - '@elastic/eslint-plugin-kibana-custom' -] rules: no-console: 2 - '@elastic/kibana-custom/no-default-export': error + '@kbn/eslint/no-default-export': error diff --git a/src/legacy/ui/public/agg_response/hierarchical/_collect_branch.js b/src/legacy/ui/public/agg_response/hierarchical/_collect_branch.js index 1dc0b442d08d9..5339d453a7770 100644 --- a/src/legacy/ui/public/agg_response/hierarchical/_collect_branch.js +++ b/src/legacy/ui/public/agg_response/hierarchical/_collect_branch.js @@ -17,7 +17,7 @@ * under the License. */ -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function (leaf) { // walk up the branch for each parent function walk(item, memo) { diff --git a/src/legacy/ui/public/agg_types/__tests__/agg_param_writer.js b/src/legacy/ui/public/agg_types/__tests__/agg_param_writer.js index c4c619730092c..e162f59881376 100644 --- a/src/legacy/ui/public/agg_types/__tests__/agg_param_writer.js +++ b/src/legacy/ui/public/agg_types/__tests__/agg_param_writer.js @@ -22,7 +22,7 @@ import { VisProvider } from '../../vis'; import { aggTypes } from '..'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function AggParamWriterHelper(Private) { const Vis = Private(VisProvider); const stubbedLogstashIndexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); diff --git a/src/legacy/ui/public/agg_types/__tests__/param_types/_json.js b/src/legacy/ui/public/agg_types/__tests__/param_types/_json.js index 8c2a3f96073e8..516f1c95d71ff 100644 --- a/src/legacy/ui/public/agg_types/__tests__/param_types/_json.js +++ b/src/legacy/ui/public/agg_types/__tests__/param_types/_json.js @@ -22,7 +22,7 @@ import expect from 'expect.js'; import { BaseParamType } from '../../param_types/base'; import { JsonParamType } from '../../param_types/json'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default describe('JSON', function () { const paramName = 'json_test'; let aggParam; diff --git a/src/legacy/ui/public/agg_types/__tests__/param_types/_string.js b/src/legacy/ui/public/agg_types/__tests__/param_types/_string.js index 88d10c683f7c9..e11c50077a9c8 100644 --- a/src/legacy/ui/public/agg_types/__tests__/param_types/_string.js +++ b/src/legacy/ui/public/agg_types/__tests__/param_types/_string.js @@ -22,7 +22,7 @@ import expect from 'expect.js'; import { BaseParamType } from '../../param_types/base'; import { StringParamType } from '../../param_types/string'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default describe('String', function () { const paramName = 'json_test'; let aggParam; diff --git a/src/legacy/ui/public/agg_types/__tests__/utils/_stub_agg_params.js b/src/legacy/ui/public/agg_types/__tests__/utils/_stub_agg_params.js index 5f3eb734aaf7d..a9c46b09b5370 100644 --- a/src/legacy/ui/public/agg_types/__tests__/utils/_stub_agg_params.js +++ b/src/legacy/ui/public/agg_types/__tests__/utils/_stub_agg_params.js @@ -46,7 +46,7 @@ function ParamClassStub(parent, body) { * @param {PrivateLoader} Private - The private module loader, inject by passing this function to ngMock.inject() * @return {undefined} */ -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function stubParamClasses(Private) { const BaseAggParam = Private.stub( BaseParamType, diff --git a/src/legacy/ui/public/chrome/api/apps.js b/src/legacy/ui/public/chrome/api/apps.js index feb339e163a64..7779b9612b63e 100644 --- a/src/legacy/ui/public/chrome/api/apps.js +++ b/src/legacy/ui/public/chrome/api/apps.js @@ -20,7 +20,7 @@ import { clone, get } from 'lodash'; import { resolve } from 'url'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function (chrome, internals) { if (get(internals, 'app.navLink.url')) { diff --git a/src/legacy/ui/public/chrome/api/template.js b/src/legacy/ui/public/chrome/api/template.js index d1295dc8dddaa..58281c1af6c9d 100644 --- a/src/legacy/ui/public/chrome/api/template.js +++ b/src/legacy/ui/public/chrome/api/template.js @@ -17,7 +17,7 @@ * under the License. */ -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function (chrome, internals) { /** diff --git a/src/legacy/ui/public/chrome/index.js b/src/legacy/ui/public/chrome/index.js index ad62192704a1e..a322485b25513 100644 --- a/src/legacy/ui/public/chrome/index.js +++ b/src/legacy/ui/public/chrome/index.js @@ -19,5 +19,5 @@ import { chrome } from './chrome'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default chrome; diff --git a/src/legacy/ui/public/index_patterns/route_setup/load_default.js b/src/legacy/ui/public/index_patterns/route_setup/load_default.js index 6de1eb2b812a8..669b33d731983 100644 --- a/src/legacy/ui/public/index_patterns/route_setup/load_default.js +++ b/src/legacy/ui/public/index_patterns/route_setup/load_default.js @@ -59,7 +59,7 @@ function displayBanner() { }, 15000); } -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function (opts) { opts = opts || {}; const whenMissingRedirectTo = opts.whenMissingRedirectTo || null; diff --git a/src/legacy/ui/public/jquery/find_test_subject.js b/src/legacy/ui/public/jquery/find_test_subject.js index 857909d554ee2..e30b78a121cdc 100644 --- a/src/legacy/ui/public/jquery/find_test_subject.js +++ b/src/legacy/ui/public/jquery/find_test_subject.js @@ -19,7 +19,7 @@ import testSubjSelector from '@kbn/test-subj-selector'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function bindToJquery($) { /** diff --git a/src/legacy/ui/public/routes/index.js b/src/legacy/ui/public/routes/index.js index cf92b7de94e05..74e2613c66449 100644 --- a/src/legacy/ui/public/routes/index.js +++ b/src/legacy/ui/public/routes/index.js @@ -19,5 +19,5 @@ import { uiRoutes } from './routes'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default uiRoutes; diff --git a/src/legacy/ui/public/routes/route_manager.js b/src/legacy/ui/public/routes/route_manager.js index 94c7182b369a4..6cedf775cf576 100644 --- a/src/legacy/ui/public/routes/route_manager.js +++ b/src/legacy/ui/public/routes/route_manager.js @@ -23,7 +23,7 @@ import { wrapRouteWithPrep } from './wrap_route_with_prep'; import { RouteSetupManager } from './route_setup_manager'; import { parsePathToBreadcrumbs } from './breadcrumbs'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function RouteManager() { const self = this; const setup = new RouteSetupManager(); diff --git a/src/legacy/ui/public/utils/ipv4_address.ts b/src/legacy/ui/public/utils/ipv4_address.ts index b8bf3917c471d..5268d1ad97d24 100644 --- a/src/legacy/ui/public/utils/ipv4_address.ts +++ b/src/legacy/ui/public/utils/ipv4_address.ts @@ -30,7 +30,7 @@ function isIntegerInRange(integer: number, min: number, max: number) { ); } -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export // tslint:disable:no-default-export export default class Ipv4Address { private value: number; diff --git a/src/legacy/ui/public/utils/mapping_setup.js b/src/legacy/ui/public/utils/mapping_setup.js index b2589ca6b16b2..d02c6ea686b03 100644 --- a/src/legacy/ui/public/utils/mapping_setup.js +++ b/src/legacy/ui/public/utils/mapping_setup.js @@ -20,7 +20,7 @@ import angular from 'angular'; import _ from 'lodash'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function MappingSetupService() { const mappingSetup = this; diff --git a/src/legacy/ui/public/vis/agg_config_result.js b/src/legacy/ui/public/vis/agg_config_result.js index 75da837e6ee1c..f82c12585753a 100644 --- a/src/legacy/ui/public/vis/agg_config_result.js +++ b/src/legacy/ui/public/vis/agg_config_result.js @@ -19,7 +19,7 @@ import chrome from '../chrome'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function AggConfigResult(aggConfig, parent, value, key, filters) { this.key = key; this.value = value; diff --git a/src/legacy/ui/public/vislib/index.js b/src/legacy/ui/public/vislib/index.js index 0d527d08a28a0..515e5fc9da7f1 100644 --- a/src/legacy/ui/public/vislib/index.js +++ b/src/legacy/ui/public/vislib/index.js @@ -19,5 +19,5 @@ import { VislibProvider } from './vislib'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default VislibProvider; diff --git a/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_split.js b/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_split.js index 906483966dc22..8e87a8be0b52c 100644 --- a/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_split.js +++ b/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_split.js @@ -19,7 +19,7 @@ import d3 from 'd3'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function ChartSplitFactory() { /* diff --git a/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js b/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js index ad30bf91e9f00..331a5a60ec4fd 100644 --- a/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js +++ b/src/legacy/ui/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js @@ -19,7 +19,7 @@ import d3 from 'd3'; -// eslint-disable-next-line @elastic/kibana-custom/no-default-export +// eslint-disable-next-line @kbn/eslint/no-default-export export default function ChartTitleSplitFactory() { /* diff --git a/test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js b/test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js index e135294ab95f4..75a690871c534 100644 --- a/test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js +++ b/test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js @@ -1,4 +1,4 @@ -/* eslint-disable @kbn/license-header/require-license-header */ +/* eslint-disable @kbn/eslint/require-license-header */ /** * @notice diff --git a/x-pack/plugins/ml/public/lib/angular_bootstrap_patch.js b/x-pack/plugins/ml/public/lib/angular_bootstrap_patch.js index adca80311696e..a8f1d440fe811 100644 --- a/x-pack/plugins/ml/public/lib/angular_bootstrap_patch.js +++ b/x-pack/plugins/ml/public/lib/angular_bootstrap_patch.js @@ -1,4 +1,4 @@ -/* eslint-disable @kbn/license-header/require-license-header */ +/* eslint-disable @kbn/eslint/require-license-header */ /** * @notice diff --git a/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/encode_uri_query.js b/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/encode_uri_query.js index 999144a5ce1c5..a9329a7b42da8 100644 --- a/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/encode_uri_query.js +++ b/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/encode_uri_query.js @@ -1,4 +1,4 @@ -/* eslint-disable @kbn/license-header/require-license-header */ +/* eslint-disable @kbn/eslint/require-license-header */ // This function was extracted from angular v1.3 diff --git a/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/index.js b/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/index.js index 9b78d73b39449..ee0e7c81e4849 100644 --- a/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/index.js +++ b/x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/index.js @@ -1,4 +1,4 @@ -/* eslint-disable @kbn/license-header/require-license-header */ +/* eslint-disable @kbn/eslint/require-license-header */ /** * @notice * diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index f1cfd20210000..82270b7ac00d5 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -/* eslint-disable kibana-custom/no-default-export */ +/* eslint-disable @kbn/eslint/no-default-export */ import { resolve } from 'path';