-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Remove legacy plugins support #77599
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
Changes from 36 commits
0ac0df2
67b4d8a
1f8249b
4a8c362
28db307
5e76aeb
aa4de2b
f721040
2361249
e6fb281
8467833
982494e
7363722
75a1a47
1498f79
719280a
5e5b448
1a10e3b
c5d7612
462388a
a20cc66
6be4612
8443d96
eced562
60e6963
14569f0
90e5073
beed1f9
59572bc
6ba8682
7e4a35b
91d2a6b
a570f53
ccf62c7
18bb41c
ca6412c
7c54be0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,6 @@ | |
| * under the License. | ||
| */ | ||
|
|
||
| const { readdirSync } = require('fs'); | ||
| const { resolve } = require('path'); | ||
|
|
||
| const APACHE_2_0_LICENSE_HEADER = ` | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
|
|
@@ -288,7 +285,7 @@ module.exports = { | |
| }, | ||
| { | ||
| target: [ | ||
| '(src|x-pack)/legacy/**/*', | ||
| 'src/legacy/**/*', | ||
| '(src|x-pack)/plugins/**/(public|server)/**/*', | ||
| 'examples/**/*', | ||
| ], | ||
|
|
@@ -319,14 +316,11 @@ module.exports = { | |
| }, | ||
| { | ||
| target: [ | ||
| '(src|x-pack)/legacy/**/*', | ||
| 'src/legacy/**/*', | ||
| '(src|x-pack)/plugins/**/(public|server)/**/*', | ||
| 'examples/**/*', | ||
| '!(src|x-pack)/**/*.test.*', | ||
| '!(x-pack/)?test/**/*', | ||
| // next folder contains legacy browser tests which can't be migrated to jest | ||
| // which import np files | ||
| '!src/legacy/core_plugins/kibana/public/__tests__/**/*', | ||
| ], | ||
| from: [ | ||
| '(src|x-pack)/plugins/**/(public|server)/**/*', | ||
|
|
@@ -341,14 +335,6 @@ module.exports = { | |
| '(src|x-pack)/plugins/**/*', | ||
| '!(src|x-pack)/plugins/**/server/**/*', | ||
|
|
||
| 'src/legacy/core_plugins/**/*', | ||
| '!src/legacy/core_plugins/**/server/**/*', | ||
| '!src/legacy/core_plugins/**/index.{js,mjs,ts,tsx}', | ||
|
|
||
| 'x-pack/legacy/plugins/**/*', | ||
| '!x-pack/legacy/plugins/**/server/**/*', | ||
| '!x-pack/legacy/plugins/**/index.{js,mjs,ts,tsx}', | ||
|
|
||
| 'examples/**/*', | ||
| '!examples/**/server/**/*', | ||
| ], | ||
|
|
@@ -370,12 +356,7 @@ module.exports = { | |
| }, | ||
| { | ||
| target: ['src/core/**/*'], | ||
| from: [ | ||
| 'plugins/**/*', | ||
| 'src/plugins/**/*', | ||
| 'src/legacy/core_plugins/**/*', | ||
| 'src/legacy/ui/**/*', | ||
| ], | ||
| from: ['plugins/**/*', 'src/plugins/**/*', 'src/legacy/ui/**/*'], | ||
| errorMessage: 'The core cannot depend on any plugins.', | ||
| }, | ||
| { | ||
|
|
@@ -388,12 +369,6 @@ module.exports = { | |
| target: [ | ||
| 'test/plugin_functional/plugins/**/public/np_ready/**/*', | ||
| 'test/plugin_functional/plugins/**/server/np_ready/**/*', | ||
| 'src/legacy/core_plugins/**/public/np_ready/**/*', | ||
| 'src/legacy/core_plugins/vis_type_*/public/**/*', | ||
| '!src/legacy/core_plugins/vis_type_*/public/legacy*', | ||
| 'src/legacy/core_plugins/**/server/np_ready/**/*', | ||
| 'x-pack/legacy/plugins/**/public/np_ready/**/*', | ||
| 'x-pack/legacy/plugins/**/server/np_ready/**/*', | ||
| ], | ||
| allowSameFolder: true, | ||
| errorMessage: | ||
|
|
@@ -443,22 +418,14 @@ module.exports = { | |
| settings: { | ||
| // instructs import/no-extraneous-dependencies to treat certain modules | ||
| // as core modules, even if they aren't listed in package.json | ||
| 'import/core-modules': ['plugins', 'legacy/ui'], | ||
| 'import/core-modules': ['plugins'], | ||
|
|
||
| 'import/resolver': { | ||
| '@kbn/eslint-import-resolver-kibana': { | ||
| forceNode: false, | ||
| rootPackageName: 'kibana', | ||
| kibanaPath: '.', | ||
| pluginMap: readdirSync(resolve(__dirname, 'x-pack/legacy/plugins')).reduce( | ||
| (acc, name) => { | ||
| if (!name.startsWith('_')) { | ||
| acc[name] = `x-pack/legacy/plugins/${name}`; | ||
| } | ||
| return acc; | ||
| }, | ||
| {} | ||
| ), | ||
| pluginMap: {}, | ||
|
Comment on lines
-453
to
+428
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this rule makes any sense without any legacy plugin. I changed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that the custom eslint-import-resolver-kibana settings for x-pack are only required for the legacy import syntax support for things like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't it mean that we can remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually still necessary. See https://github.com/elastic/kibana/pull/77599/checks?check_run_id=1147976384 |
||
| }, | ||
| }, | ||
| }, | ||
|
|
@@ -764,16 +731,6 @@ module.exports = { | |
| }, | ||
| }, | ||
|
|
||
| /** | ||
| * GIS overrides | ||
| */ | ||
| { | ||
| files: ['x-pack/legacy/plugins/maps/**/*.js'], | ||
| rules: { | ||
| 'react/prefer-stateless-function': [0, { ignorePureComponents: false }], | ||
| }, | ||
| }, | ||
|
|
||
| /** | ||
| * ML overrides | ||
| */ | ||
|
|
@@ -812,7 +769,7 @@ module.exports = { | |
| }, | ||
| { | ||
| // typescript only for front and back end | ||
| files: ['x-pack/{,legacy/}plugins/security_solution/**/*.{ts,tsx}'], | ||
| files: ['x-pack/plugins/security_solution/**/*.{ts,tsx}'], | ||
| rules: { | ||
| // This will be turned on after bug fixes are complete | ||
| // '@typescript-eslint/explicit-member-accessibility': 'warn', | ||
|
|
@@ -858,7 +815,7 @@ module.exports = { | |
| // }, | ||
| { | ||
| // typescript and javascript for front and back end | ||
| files: ['x-pack/{,legacy/}plugins/security_solution/**/*.{js,mjs,ts,tsx}'], | ||
| files: ['x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}'], | ||
| plugins: ['eslint-plugin-node', 'react'], | ||
| env: { | ||
| mocha: true, | ||
|
|
@@ -1089,7 +1046,7 @@ module.exports = { | |
| { | ||
| // typescript only for front and back end | ||
| files: [ | ||
| 'x-pack/{,legacy/}plugins/{alerts,alerting_builtins,actions,task_manager,event_log}/**/*.{ts,tsx}', | ||
| 'x-pack/plugins/{alerts,alerting_builtins,actions,task_manager,event_log}/**/*.{ts,tsx}', | ||
| ], | ||
| rules: { | ||
| '@typescript-eslint/no-explicit-any': 'error', | ||
|
|
@@ -1238,10 +1195,7 @@ module.exports = { | |
| * TSVB overrides | ||
| */ | ||
| { | ||
| files: [ | ||
| 'src/plugins/vis_type_timeseries/**/*.{js,mjs,ts,tsx}', | ||
| 'src/legacy/core_plugins/vis_type_timeseries/**/*.{js,mjs,ts,tsx}', | ||
| ], | ||
| files: ['src/plugins/vis_type_timeseries/**/*.{js,mjs,ts,tsx}'], | ||
| rules: { | ||
| 'import/no-default-export': 'error', | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,6 @@ export { Public, Server }; | |
| /** | ||
| * All exports from TS ambient definitions (where types are added for JS source in a .d.ts file). | ||
| */ | ||
| import * as LegacyKibanaPluginSpec from './src/legacy/plugin_discovery/plugin_spec/plugin_spec_options'; | ||
| import * as LegacyKibanaServer from './src/legacy/server/kbn_server'; | ||
|
|
||
| /** | ||
|
|
@@ -39,8 +38,4 @@ export namespace Legacy { | |
| export type Request = LegacyKibanaServer.Request; | ||
| export type ResponseToolkit = LegacyKibanaServer.ResponseToolkit; | ||
| export type Server = LegacyKibanaServer.Server; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There shouldn't be any plugin code relying on the Hapi types. Created #77997 |
||
|
|
||
| export type InitPluginFunction = LegacyKibanaPluginSpec.InitPluginFunction; | ||
| export type UiExports = LegacyKibanaPluginSpec.UiExports; | ||
| export type PluginSpecOptions = LegacyKibanaPluginSpec.PluginSpecOptions; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,11 +48,6 @@ const CAN_CLUSTER = canRequire(CLUSTER_MANAGER_PATH); | |
| const REPL_PATH = resolve(__dirname, '../repl'); | ||
| const CAN_REPL = canRequire(REPL_PATH); | ||
|
|
||
| // xpack is installed in both dev and the distributable, it's optional if | ||
| // install is a link to the source, not an actual install | ||
| const XPACK_DIR = resolve(__dirname, '../../../x-pack'); | ||
| const XPACK_INSTALLED = canRequire(XPACK_DIR); | ||
|
|
||
| const pathCollector = function () { | ||
| const paths = []; | ||
| return function (path) { | ||
|
|
@@ -137,16 +132,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) { | |
| if (opts.logFile) set('logging.dest', opts.logFile); | ||
|
|
||
| set('plugins.scanDirs', _.compact([].concat(get('plugins.scanDirs'), opts.pluginDir))); | ||
| set( | ||
| 'plugins.paths', | ||
| _.compact( | ||
| [].concat( | ||
| get('plugins.paths'), | ||
| opts.pluginPath, | ||
| XPACK_INSTALLED && !opts.oss ? [XPACK_DIR] : [] | ||
| ) | ||
| ) | ||
| ); | ||
| set('plugins.paths', _.compact([].concat(get('plugins.paths'), opts.pluginPath))); | ||
|
Comment on lines
-140
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was only used to specify the legacy xpack plugin's path. KP's xpack path is handled in |
||
|
|
||
| merge(extraCliOptions); | ||
| merge(readKeystore()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.