1717 * under the License.
1818 */
1919
20- const { readdirSync } = require ( 'fs' ) ;
21- const { resolve } = require ( 'path' ) ;
22-
2320const APACHE_2_0_LICENSE_HEADER = `
2421/*
2522 * Licensed to Elasticsearch B.V. under one or more contributor
@@ -288,7 +285,7 @@ module.exports = {
288285 } ,
289286 {
290287 target : [
291- '( src|x-pack) /legacy/**/*' ,
288+ 'src/legacy/**/*' ,
292289 '(src|x-pack)/plugins/**/(public|server)/**/*' ,
293290 'examples/**/*' ,
294291 ] ,
@@ -319,14 +316,11 @@ module.exports = {
319316 } ,
320317 {
321318 target : [
322- '( src|x-pack) /legacy/**/*' ,
319+ 'src/legacy/**/*' ,
323320 '(src|x-pack)/plugins/**/(public|server)/**/*' ,
324321 'examples/**/*' ,
325322 '!(src|x-pack)/**/*.test.*' ,
326323 '!(x-pack/)?test/**/*' ,
327- // next folder contains legacy browser tests which can't be migrated to jest
328- // which import np files
329- '!src/legacy/core_plugins/kibana/public/__tests__/**/*' ,
330324 ] ,
331325 from : [
332326 '(src|x-pack)/plugins/**/(public|server)/**/*' ,
@@ -341,14 +335,6 @@ module.exports = {
341335 '(src|x-pack)/plugins/**/*' ,
342336 '!(src|x-pack)/plugins/**/server/**/*' ,
343337
344- 'src/legacy/core_plugins/**/*' ,
345- '!src/legacy/core_plugins/**/server/**/*' ,
346- '!src/legacy/core_plugins/**/index.{js,mjs,ts,tsx}' ,
347-
348- 'x-pack/legacy/plugins/**/*' ,
349- '!x-pack/legacy/plugins/**/server/**/*' ,
350- '!x-pack/legacy/plugins/**/index.{js,mjs,ts,tsx}' ,
351-
352338 'examples/**/*' ,
353339 '!examples/**/server/**/*' ,
354340 ] ,
@@ -370,12 +356,7 @@ module.exports = {
370356 } ,
371357 {
372358 target : [ 'src/core/**/*' ] ,
373- from : [
374- 'plugins/**/*' ,
375- 'src/plugins/**/*' ,
376- 'src/legacy/core_plugins/**/*' ,
377- 'src/legacy/ui/**/*' ,
378- ] ,
359+ from : [ 'plugins/**/*' , 'src/plugins/**/*' , 'src/legacy/ui/**/*' ] ,
379360 errorMessage : 'The core cannot depend on any plugins.' ,
380361 } ,
381362 {
@@ -388,12 +369,6 @@ module.exports = {
388369 target : [
389370 'test/plugin_functional/plugins/**/public/np_ready/**/*' ,
390371 'test/plugin_functional/plugins/**/server/np_ready/**/*' ,
391- 'src/legacy/core_plugins/**/public/np_ready/**/*' ,
392- 'src/legacy/core_plugins/vis_type_*/public/**/*' ,
393- '!src/legacy/core_plugins/vis_type_*/public/legacy*' ,
394- 'src/legacy/core_plugins/**/server/np_ready/**/*' ,
395- 'x-pack/legacy/plugins/**/public/np_ready/**/*' ,
396- 'x-pack/legacy/plugins/**/server/np_ready/**/*' ,
397372 ] ,
398373 allowSameFolder : true ,
399374 errorMessage :
@@ -413,6 +388,7 @@ module.exports = {
413388 */
414389 {
415390 files : [
391+ '**/*.stories.tsx' ,
416392 'x-pack/test/apm_api_integration/**/*.ts' ,
417393 'x-pack/test/functional/apps/**/*.js' ,
418394 'x-pack/plugins/apm/**/*.js' ,
@@ -443,22 +419,14 @@ module.exports = {
443419 settings : {
444420 // instructs import/no-extraneous-dependencies to treat certain modules
445421 // as core modules, even if they aren't listed in package.json
446- 'import/core-modules' : [ 'plugins' , 'legacy/ui' ] ,
422+ 'import/core-modules' : [ 'plugins' ] ,
447423
448424 'import/resolver' : {
449425 '@kbn/eslint-import-resolver-kibana' : {
450426 forceNode : false ,
451427 rootPackageName : 'kibana' ,
452428 kibanaPath : '.' ,
453- pluginMap : readdirSync ( resolve ( __dirname , 'x-pack/legacy/plugins' ) ) . reduce (
454- ( acc , name ) => {
455- if ( ! name . startsWith ( '_' ) ) {
456- acc [ name ] = `x-pack/legacy/plugins/${ name } ` ;
457- }
458- return acc ;
459- } ,
460- { }
461- ) ,
429+ pluginMap : { } ,
462430 } ,
463431 } ,
464432 } ,
@@ -764,16 +732,6 @@ module.exports = {
764732 } ,
765733 } ,
766734
767- /**
768- * GIS overrides
769- */
770- {
771- files : [ 'x-pack/legacy/plugins/maps/**/*.js' ] ,
772- rules : {
773- 'react/prefer-stateless-function' : [ 0 , { ignorePureComponents : false } ] ,
774- } ,
775- } ,
776-
777735 /**
778736 * ML overrides
779737 */
@@ -812,7 +770,7 @@ module.exports = {
812770 } ,
813771 {
814772 // typescript only for front and back end
815- files : [ 'x-pack/{,legacy/} plugins/security_solution/**/*.{ts,tsx}' ] ,
773+ files : [ 'x-pack/plugins/security_solution/**/*.{ts,tsx}' ] ,
816774 rules : {
817775 // This will be turned on after bug fixes are complete
818776 // '@typescript-eslint/explicit-member-accessibility': 'warn',
@@ -858,7 +816,7 @@ module.exports = {
858816 // },
859817 {
860818 // typescript and javascript for front and back end
861- files : [ 'x-pack/{,legacy/} plugins/security_solution/**/*.{js,mjs,ts,tsx}' ] ,
819+ files : [ 'x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}' ] ,
862820 plugins : [ 'eslint-plugin-node' , 'react' ] ,
863821 env : {
864822 mocha : true ,
@@ -1088,9 +1046,7 @@ module.exports = {
10881046 */
10891047 {
10901048 // typescript only for front and back end
1091- files : [
1092- 'x-pack/{,legacy/}plugins/{alerts,alerting_builtins,actions,task_manager,event_log}/**/*.{ts,tsx}' ,
1093- ] ,
1049+ files : [ 'x-pack/plugins/{alerts,stack_alerts,actions,task_manager,event_log}/**/*.{ts,tsx}' ] ,
10941050 rules : {
10951051 '@typescript-eslint/no-explicit-any' : 'error' ,
10961052 } ,
@@ -1222,13 +1178,7 @@ module.exports = {
12221178 } ,
12231179 } ,
12241180 {
1225- files : [ 'x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts/**/*.js' ] ,
1226- env : {
1227- jquery : true ,
1228- } ,
1229- } ,
1230- {
1231- files : [ 'x-pack/plugins/monitoring/public/lib/jquery_flot/**/*.js' ] ,
1181+ files : [ 'packages/kbn-ui-shared-deps/flot_charts/**/*.js' ] ,
12321182 env : {
12331183 jquery : true ,
12341184 } ,
@@ -1238,10 +1188,7 @@ module.exports = {
12381188 * TSVB overrides
12391189 */
12401190 {
1241- files : [
1242- 'src/plugins/vis_type_timeseries/**/*.{js,mjs,ts,tsx}' ,
1243- 'src/legacy/core_plugins/vis_type_timeseries/**/*.{js,mjs,ts,tsx}' ,
1244- ] ,
1191+ files : [ 'src/plugins/vis_type_timeseries/**/*.{js,mjs,ts,tsx}' ] ,
12451192 rules : {
12461193 'import/no-default-export' : 'error' ,
12471194 } ,
@@ -1275,5 +1222,20 @@ module.exports = {
12751222 '@typescript-eslint/prefer-ts-expect-error' : 'error' ,
12761223 } ,
12771224 } ,
1225+ {
1226+ files : [
1227+ '**/public/**/*.{js,mjs,ts,tsx}' ,
1228+ '**/common/**/*.{js,mjs,ts,tsx}' ,
1229+ 'packages/**/*.{js,mjs,ts,tsx}' ,
1230+ ] ,
1231+ rules : {
1232+ 'no-restricted-imports' : [
1233+ 'error' ,
1234+ {
1235+ patterns : [ 'lodash/*' , '!lodash/fp' ] ,
1236+ } ,
1237+ ] ,
1238+ } ,
1239+ } ,
12781240 ] ,
12791241} ;
0 commit comments