mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[eslint] fix and skip violations for cross-boundary imports (#136911)
This commit is contained in:
parent
103aa675c7
commit
bebec37f04
379 changed files with 368 additions and 1168 deletions
103
.eslintrc.js
103
.eslintrc.js
|
@ -585,109 +585,6 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Restricted paths
|
||||
*/
|
||||
{
|
||||
files: ['**/*.{js,mjs,ts,tsx}'],
|
||||
rules: {
|
||||
'@kbn/eslint/no-restricted-paths': [
|
||||
'error',
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: ['(src|x-pack)/**/*', '!src/core/**/*'],
|
||||
from: ['src/core/utils/**/*'],
|
||||
errorMessage: `Plugins may only import from src/core/server and src/core/public.`,
|
||||
},
|
||||
{
|
||||
target: ['(src|x-pack)/plugins/*/server/**/*'],
|
||||
from: ['(src|x-pack)/plugins/*/public/**/*'],
|
||||
errorMessage: `Server code can not import from public, use a common directory.`,
|
||||
},
|
||||
{
|
||||
target: ['(src|x-pack)/plugins/*/common/**/*'],
|
||||
from: ['(src|x-pack)/plugins/*/(server|public)/**/*'],
|
||||
errorMessage: `Common code can not import from server or public, use a common directory.`,
|
||||
},
|
||||
{
|
||||
target: ['(src|x-pack)/plugins/**/(public|server)/**/*', 'examples/**/*'],
|
||||
from: [
|
||||
'src/core/public/**/*',
|
||||
'!src/core/public/index.ts', // relative import
|
||||
'!src/core/public/mocks{,.ts}',
|
||||
'!src/core/server/types{,.ts}',
|
||||
'!src/core/public/utils/**/*',
|
||||
'!src/core/public/*.test.mocks{,.ts}',
|
||||
|
||||
'src/core/server/**/*',
|
||||
'!src/core/server/index.ts', // relative import
|
||||
'!src/core/server/mocks{,.ts}',
|
||||
'!src/core/server/types{,.ts}',
|
||||
'!src/core/server/test_utils{,.ts}',
|
||||
// for absolute imports until fixed in
|
||||
// https://github.com/elastic/kibana/issues/36096
|
||||
'!src/core/server/*.test.mocks{,.ts}',
|
||||
|
||||
'target/types/**',
|
||||
],
|
||||
allowSameFolder: true,
|
||||
errorMessage:
|
||||
'Plugins may only import from top-level public and server modules in core.',
|
||||
},
|
||||
{
|
||||
target: [
|
||||
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
||||
'examples/**/*',
|
||||
'!(src|x-pack)/**/*.test.*',
|
||||
'!(x-pack/)?test/**/*',
|
||||
],
|
||||
from: [
|
||||
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
||||
'!(src|x-pack)/plugins/**/(public|server)/mocks/index.{js,mjs,ts}',
|
||||
'!(src|x-pack)/plugins/**/(public|server)/(index|mocks).{js,mjs,ts,tsx}',
|
||||
'!(src|x-pack)/plugins/**/__stories__/index.{js,mjs,ts,tsx}',
|
||||
'!(src|x-pack)/plugins/**/__fixtures__/index.{js,mjs,ts,tsx}',
|
||||
],
|
||||
allowSameFolder: true,
|
||||
errorMessage: 'Plugins may only import from top-level public and server modules.',
|
||||
},
|
||||
{
|
||||
target: [
|
||||
'(src|x-pack)/plugins/**/*',
|
||||
'!(src|x-pack)/plugins/**/server/**/*',
|
||||
|
||||
'examples/**/*',
|
||||
'!examples/**/server/**/*',
|
||||
],
|
||||
from: [
|
||||
'src/core/server',
|
||||
'src/core/server/**/*',
|
||||
'(src|x-pack)/plugins/*/server/**/*',
|
||||
'examples/**/server/**/*',
|
||||
// TODO: Remove the 'joi' eslint rule once IE11 support is dropped
|
||||
'joi',
|
||||
],
|
||||
errorMessage:
|
||||
'Server modules cannot be imported into client modules or shared modules.',
|
||||
},
|
||||
{
|
||||
target: ['src/core/**/*'],
|
||||
from: ['plugins/**/*', 'src/plugins/**/*'],
|
||||
errorMessage: 'The core cannot depend on any plugins.',
|
||||
},
|
||||
{
|
||||
target: ['(src|x-pack)/plugins/*/public/**/*'],
|
||||
from: ['ui/**/*'],
|
||||
errorMessage: 'Plugins cannot import legacy UI code.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Allow default exports
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectAttributes } from '@kbn/core/types';
|
||||
import type { SavedObjectAttributes } from '@kbn/core/types';
|
||||
|
||||
export const BOOK_SAVED_OBJECT = 'book';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectAttributes } from '@kbn/core/types';
|
||||
import type { SavedObjectAttributes } from '@kbn/core/types';
|
||||
|
||||
export interface TodoSavedObjectAttributes extends SavedObjectAttributes {
|
||||
task: string;
|
||||
|
|
|
@ -32,10 +32,8 @@ import example1SampleCode from '!!raw-loader!./examples/1_using_existing_format'
|
|||
import example2SampleCodePart1 from '!!raw-loader!../common/example_currency_format';
|
||||
// @ts-ignore
|
||||
import example2SampleCodePart2 from '!!raw-loader!./examples/2_creating_custom_formatter';
|
||||
/* eslint-disable @kbn/eslint/no-restricted-paths */
|
||||
// @ts-ignore
|
||||
import example2SampleCodePart3 from '!!raw-loader!../server/examples/2_creating_custom_formatter';
|
||||
/* eslint-enable @kbn/eslint/no-restricted-paths */
|
||||
// @ts-ignore
|
||||
import example3SampleCode from '!!raw-loader!./examples/3_creating_custom_format_editor';
|
||||
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
export { coreDeprecationProvider } from './deprecation';
|
||||
export { ensureValidConfiguration } from './ensure_valid_configuration';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export { getDeprecationsFor, getDeprecationsForGlobalSettings } from './test_utils';
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export { runSynthtrace } from './scripts/run_synthtrace';
|
||||
export { runSynthtrace } from './cli/run_synthtrace';
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
import { observer, timerange } from '..';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
import { AgentConfigFields } from '../lib/agent_config/agent_config_fields';
|
||||
|
||||
const scenario: Scenario<AgentConfigFields> = async (runOptions: RunOptions) => {
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
import { apm, timerange } from '..';
|
||||
import { ApmFields } from '../lib/apm/apm_fields';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
|
||||
const ENVIRONMENT = __filename;
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
import { stackMonitoring, timerange } from '..';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
import { ApmFields } from '../lib/apm/apm_fields';
|
||||
|
||||
const scenario: Scenario<ApmFields> = async (runOptions: RunOptions) => {
|
||||
|
|
|
@ -10,9 +10,9 @@ import { random } from 'lodash';
|
|||
import { apm, timerange } from '..';
|
||||
import { ApmFields } from '../lib/apm/apm_fields';
|
||||
import { Instance } from '../lib/apm/instance';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
|
||||
const ENVIRONMENT = __filename;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
import { random } from 'lodash';
|
||||
import { apm, timerange } from '..';
|
||||
import { Instance } from '../lib/apm/instance';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
import { ApmFields } from '../lib/apm/apm_fields';
|
||||
|
||||
const ENVIRONMENT = __filename;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
// Run with: node ./src/scripts/run ./src/scripts/examples/03_monitoring.ts --target=http://elastic:changeme@localhost:9200
|
||||
|
||||
import { stackMonitoring, timerange } from '..';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
import { StackMonitoringFields } from '../lib/stack_monitoring/stack_monitoring_fields';
|
||||
|
||||
const scenario: Scenario<StackMonitoringFields> = async (runOptions: RunOptions) => {
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
import { apm, timerange } from '..';
|
||||
import { ApmFields } from '../lib/apm/apm_fields';
|
||||
import { Instance } from '../lib/apm/instance';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { getLogger } from '../scripts/utils/get_common_services';
|
||||
import { RunOptions } from '../scripts/utils/parse_run_cli_flags';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
import { getLogger } from '../cli/utils/get_common_services';
|
||||
import { RunOptions } from '../cli/utils/parse_run_cli_flags';
|
||||
|
||||
const ENVIRONMENT = __filename;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import { compact, shuffle } from 'lodash';
|
||||
import { apm, ApmFields, EntityArrayIterable, timerange } from '..';
|
||||
import { generateLongId, generateShortId } from '../lib/utils/generate_id';
|
||||
import { Scenario } from '../scripts/scenario';
|
||||
import { Scenario } from '../cli/scenario';
|
||||
|
||||
const ENVIRONMENT = __filename;
|
||||
|
||||
|
|
|
@ -20,5 +20,6 @@ export {
|
|||
getStoryArgTypes as getSampleDataCardStoryArgTypes,
|
||||
getStoryServices as getSampleDataCardStoryServices,
|
||||
getMockDataSet as getSampleDataCardMockDataSet,
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
} from './mocks';
|
||||
export type { Params as SampleDataCardStorybookParams } from './mocks';
|
||||
|
|
|
@ -258,5 +258,6 @@ module.exports = {
|
|||
'@kbn/imports/no_unresolvable_imports': 'error',
|
||||
'@kbn/imports/uniform_imports': 'error',
|
||||
'@kbn/imports/no_unused_imports': 'error',
|
||||
'@kbn/imports/no_boundary_crossing': 'error',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -34,7 +34,6 @@ RUNTIME_DEPS = [
|
|||
"@npm//dedent",
|
||||
"@npm//eslint",
|
||||
"@npm//eslint-module-utils",
|
||||
"@npm//micromatch",
|
||||
]
|
||||
|
||||
js_library(
|
||||
|
|
|
@ -83,47 +83,6 @@ Disallows the usage of `this` into class property initializers and enforce to de
|
|||
|
||||
Disables the usage of a trailing slash in a node module import.
|
||||
|
||||
## no-restricted-paths
|
||||
|
||||
Defines a set of import paths valid to be imported for a given group of files.
|
||||
|
||||
```
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.{js,mjs,ts,tsx}'],
|
||||
rules: {
|
||||
'@kbn/eslint/no-restricted-paths': [
|
||||
'error',
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: [
|
||||
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
||||
'examples/**/*',
|
||||
'!(src|x-pack)/**/*.test.*',
|
||||
'!(x-pack/)?test/**/*',
|
||||
],
|
||||
from: [
|
||||
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
||||
'!(src|x-pack)/plugins/**/(public|server)/mocks/index.{js,mjs,ts}',
|
||||
'!(src|x-pack)/plugins/**/(public|server)/(index|mocks).{js,mjs,ts,tsx}',
|
||||
'!(src|x-pack)/plugins/**/__stories__/index.{js,mjs,ts,tsx}',
|
||||
'!(src|x-pack)/plugins/**/__fixtures__/index.{js,mjs,ts,tsx}',
|
||||
],
|
||||
allowSameFolder: true,
|
||||
errorMessage: 'Plugins may only import from top-level public and server modules.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## require-license-header
|
||||
|
||||
Requires a given license header text on a group of files.
|
||||
|
|
|
@ -10,7 +10,6 @@ module.exports = {
|
|||
rules: {
|
||||
'require-license-header': require('./rules/require_license_header'),
|
||||
'disallow-license-headers': require('./rules/disallow_license_headers'),
|
||||
'no-restricted-paths': require('./rules/no_restricted_paths'),
|
||||
module_migration: require('./rules/module_migration'),
|
||||
no_export_all: require('./rules/no_export_all'),
|
||||
no_async_promise_body: require('./rules/no_async_promise_body'),
|
||||
|
|
|
@ -1,151 +0,0 @@
|
|||
/* eslint-disable-line @kbn/eslint/require-license-header */
|
||||
/*
|
||||
* This product uses import/no-restricted-paths which is available under a
|
||||
* "MIT" license.
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-present, Ben Mosher
|
||||
* https://github.com/benmosher/eslint-plugin-import
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
const path = require('path');
|
||||
const mm = require('micromatch');
|
||||
const { getImportResolver } = require('@kbn/eslint-plugin-imports');
|
||||
|
||||
function isStaticRequire(node) {
|
||||
return (
|
||||
node &&
|
||||
node.callee &&
|
||||
node.callee.type === 'Identifier' &&
|
||||
node.callee.name === 'require' &&
|
||||
node.arguments.length === 1 &&
|
||||
node.arguments[0].type === 'Literal' &&
|
||||
typeof node.arguments[0].value === 'string'
|
||||
);
|
||||
}
|
||||
|
||||
function traverseToTopFolder(src, pattern) {
|
||||
while (mm([src], pattern).length > 0) {
|
||||
const srcIdx = src.lastIndexOf(path.sep);
|
||||
src = src.slice(0, srcIdx);
|
||||
}
|
||||
return src;
|
||||
}
|
||||
|
||||
function isSameFolderOrDescendent(src, imported, pattern) {
|
||||
// to allow to exclude file by name in pattern (e.g., !**/index*) we start with file dirname and then traverse
|
||||
const srcFileFolderRoot = traverseToTopFolder(path.dirname(src), pattern);
|
||||
const importedFileFolderRoot = traverseToTopFolder(path.dirname(imported), pattern);
|
||||
|
||||
return srcFileFolderRoot === importedFileFolderRoot;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
zones: {
|
||||
type: 'array',
|
||||
minItems: 1,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
target: {
|
||||
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
||||
},
|
||||
from: {
|
||||
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
||||
},
|
||||
allowSameFolder: { type: 'boolean' },
|
||||
errorMessage: { type: 'string' },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
},
|
||||
basePath: { type: 'string' },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const resolver = getImportResolver(context);
|
||||
|
||||
const sourcePath = context.getPhysicalFilename
|
||||
? context.getPhysicalFilename()
|
||||
: context.getFilename();
|
||||
const sourceDirname = path.dirname(sourcePath);
|
||||
|
||||
const options = context.options[0] || {};
|
||||
const zones = options.zones || [];
|
||||
const basePath = options.basePath;
|
||||
if (!basePath || !path.isAbsolute(basePath)) {
|
||||
throw new Error('basePath option must be specified and must be absolute');
|
||||
}
|
||||
|
||||
function checkForRestrictedImportPath(importPath, node) {
|
||||
const resolveReport = resolver.resolve(importPath, sourceDirname);
|
||||
|
||||
if (resolveReport?.type !== 'file' || resolveReport.nodeModule) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const { target, from, allowSameFolder, errorMessage = '' } of zones) {
|
||||
const relativeSrcFile = path.relative(basePath, sourcePath);
|
||||
const relativeImportFile = path.relative(basePath, resolveReport.absolute);
|
||||
|
||||
if (
|
||||
!mm([relativeSrcFile], target).length ||
|
||||
!mm([relativeImportFile], from).length ||
|
||||
(allowSameFolder && isSameFolderOrDescendent(relativeSrcFile, relativeImportFile, from))
|
||||
)
|
||||
continue;
|
||||
|
||||
context.report({
|
||||
node,
|
||||
message: `Unexpected path "${importPath}" imported in restricted zone.${
|
||||
errorMessage ? ' ' + errorMessage : ''
|
||||
}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ExportNamedDeclaration(node) {
|
||||
if (!node.source) return;
|
||||
checkForRestrictedImportPath(node.source.value, node.source);
|
||||
},
|
||||
ImportDeclaration(node) {
|
||||
checkForRestrictedImportPath(node.source.value, node.source);
|
||||
},
|
||||
CallExpression(node) {
|
||||
if (isStaticRequire(node)) {
|
||||
const [firstArgument] = node.arguments;
|
||||
|
||||
checkForRestrictedImportPath(firstArgument.value, firstArgument);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
|
@ -1,400 +0,0 @@
|
|||
/* eslint-disable-line @kbn/eslint/require-license-header */
|
||||
/*
|
||||
* This product uses import/no-restricted-paths which is available under a
|
||||
* "MIT" license.
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015-present, Ben Mosher
|
||||
* https://github.com/benmosher/eslint-plugin-import
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const { RuleTester } = require('eslint');
|
||||
const { REPO_ROOT } = require('@kbn/utils');
|
||||
const rule = require('./no_restricted_paths');
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parser: require.resolve('@babel/eslint-parser'),
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2018,
|
||||
requireConfigFile: false,
|
||||
},
|
||||
});
|
||||
|
||||
ruleTester.run('@kbn/eslint/no-restricted-paths', rule, {
|
||||
valid: [
|
||||
{
|
||||
code: 'import a from "../client/a.js"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/other/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'const a = require("../client/a.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/other/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'import b from "../server/b.js"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '**/no_restricted_paths/client/**/*',
|
||||
from: '**/no_restricted_paths/other/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// irrelevant function calls
|
||||
{
|
||||
code: 'notrequire("../server/b.js")',
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'notrequire("../server/b.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/client/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// no config
|
||||
{
|
||||
code: 'require("../server/b.js")',
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'import b from "../server/b.js"',
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// builtin (ignore)
|
||||
{
|
||||
code: 'require("os")',
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
code: 'const d = require("./deep/d.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
allowSameFolder: true,
|
||||
target: '__fixtures__/no_restricted_paths/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'const d = require("./deep/d.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
allowSameFolder: true,
|
||||
target: '__fixtures__/no_restricted_paths/**/*',
|
||||
from: [
|
||||
'__fixtures__/no_restricted_paths/**/*',
|
||||
'!__fixtures__/no_restricted_paths/server/b*',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
// Check if dirs that start with 'index' work correctly.
|
||||
code: 'import { X } from "./index_patterns"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: ['__fixtures__/no_restricted_paths/(public|server)/**/*'],
|
||||
from: [
|
||||
'__fixtures__/no_restricted_paths/server/**/*',
|
||||
'!__fixtures__/no_restricted_paths/server/index.{ts,tsx}',
|
||||
],
|
||||
allowSameFolder: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
invalid: [
|
||||
{
|
||||
code: 'export { b } from "../server/b.js"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/client/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "../server/b.js" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'import b from "../server/b.js"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/client/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "../server/b.js" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 15,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'import a from "../client/a"\nimport c from "./c"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/client/**/*',
|
||||
},
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/server/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/server/c.js',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "../client/a" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 15,
|
||||
},
|
||||
{
|
||||
message: 'Unexpected path "./c" imported in restricted zone.',
|
||||
line: 2,
|
||||
column: 15,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'const b = require("../server/b.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '**/no_restricted_paths/client/**/*',
|
||||
from: '**/no_restricted_paths/server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "../server/b.js" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'const b = require("../server/b.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: path.join(__dirname, '__fixtures__', 'no_restricted_paths'),
|
||||
zones: [
|
||||
{
|
||||
target: 'client/**/*',
|
||||
from: 'server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "../server/b.js" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
code: 'const d = require("./deep/d.js")',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/**/*',
|
||||
from: '__fixtures__/no_restricted_paths/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "./deep/d.js" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
// Does not allow to import deeply within Core, using "src/core/..." Webpack alias.
|
||||
code: 'const d = require("src/core/server/saved_objects")',
|
||||
filename: path.join(REPO_ROOT, './__fixtures__/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: REPO_ROOT,
|
||||
zones: [
|
||||
{
|
||||
target: '__fixtures__/no_restricted_paths/**/*',
|
||||
from: 'src/core/server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "src/core/server/saved_objects" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
// Don't use index*.
|
||||
// It won't work with dirs that start with 'index'.
|
||||
code: 'import { X } from "./index_patterns"',
|
||||
filename: path.join(__dirname, './__fixtures__/no_restricted_paths/server/b.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: ['__fixtures__/no_restricted_paths/(public|server)/**/*'],
|
||||
from: [
|
||||
'__fixtures__/no_restricted_paths/server/**/*',
|
||||
'!__fixtures__/no_restricted_paths/server/index*',
|
||||
],
|
||||
allowSameFolder: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "./index_patterns" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
|
@ -97,7 +97,10 @@ export class RepoSourceClassifier {
|
|||
}
|
||||
|
||||
const subRoot = dirs.slice(0, 2).join('/');
|
||||
if (subRoot === 'functions/external' || subRoot === 'functions/server') {
|
||||
if (subRoot === 'functions/external') {
|
||||
return 'common package';
|
||||
}
|
||||
if (subRoot === 'functions/server') {
|
||||
return 'server package';
|
||||
}
|
||||
|
||||
|
|
|
@ -10,5 +10,6 @@ export * from './format_errors';
|
|||
export * from './parse_schedule_dates';
|
||||
export * from './exact_check';
|
||||
export * from './format_errors';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export * from './test_utils';
|
||||
export * from './validate';
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
export * from './constants';
|
||||
export * from './utils';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export * from './mock';
|
||||
|
|
|
@ -15,5 +15,7 @@ export type { SharedUxPlatformService } from './platform';
|
|||
export type { SharedUxDataService } from './data';
|
||||
export type { MockServicesFactoryParams } from './mock';
|
||||
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export { mockServicesFactory, mockServiceFactories } from './mock';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export { stubServicesFactory, stubServiceFactories } from './stub';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { firstValueFrom, Subject } from 'rxjs';
|
||||
import { DiscoveredPlugin, PluginOpaqueId } from '../../server';
|
||||
import type { DiscoveredPlugin, PluginOpaqueId } from '../../server';
|
||||
import { PluginInitializerContext } from './plugin_context';
|
||||
import { read } from './plugin_reader';
|
||||
import { CoreStart, CoreSetup } from '..';
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import { omit } from 'lodash';
|
||||
import type { CoreContext } from '@kbn/core-base-browser-internal';
|
||||
import { DiscoveredPlugin } from '../../server';
|
||||
import { PluginOpaqueId, PackageInfo, EnvironmentMode } from '../../server/types';
|
||||
import type { DiscoveredPlugin } from '../../server';
|
||||
import type { PluginOpaqueId, PackageInfo, EnvironmentMode } from '../../server/types';
|
||||
import { PluginWrapper } from './plugin';
|
||||
import { PluginsServiceSetupDeps, PluginsServiceStartDeps } from './plugins_service';
|
||||
import { CoreSetup, CoreStart } from '..';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { install, paths } from '@kbn/screenshotting-plugin/server/utils';
|
||||
|
||||
export const InstallChromium = {
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
ExpressionFunctionDefinition,
|
||||
ExpressionValueRender,
|
||||
} from '@kbn/expressions-plugin/common';
|
||||
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/public';
|
||||
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
|
||||
import { CustomPaletteState } from '@kbn/charts-plugin/common';
|
||||
import {
|
||||
EXPRESSION_GAUGE_NAME,
|
||||
|
|
|
@ -16,6 +16,7 @@ import { METRIC_TYPE } from '@kbn/analytics';
|
|||
import { ExpressionGaugePluginStart } from '../plugin';
|
||||
import { EXPRESSION_GAUGE_NAME, GaugeExpressionProps, GaugeShapes } from '../../common';
|
||||
import { getFormatService, getPaletteService } from '../services';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
interface ExpressionGaugeRendererDependencies {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { gaugeFunction } from '../common';
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
|
||||
|
||||
import { CustomPaletteState } from '@kbn/charts-plugin/common';
|
||||
import { LegendSize } from '@kbn/visualizations-plugin/public';
|
||||
import type { LegendSize } from '@kbn/visualizations-plugin/public';
|
||||
import {
|
||||
EXPRESSION_HEATMAP_NAME,
|
||||
EXPRESSION_HEATMAP_LEGEND_NAME,
|
||||
|
|
|
@ -27,6 +27,7 @@ import {
|
|||
getUISettings,
|
||||
} from '../services';
|
||||
import { getTimeZone } from '../utils/get_timezone';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
interface ExpressioHeatmapRendererDependencies {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { heatmapFunction, heatmapLegendConfig, heatmapGridConfig } from '../common';
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import { Datatable } from '@kbn/expressions-plugin/common';
|
|||
import { StartServicesGetter } from '@kbn/kibana-utils-plugin/public';
|
||||
import { ExpressionLegacyMetricPluginStart } from '../plugin';
|
||||
import { EXPRESSION_METRIC_NAME, MetricVisRenderConfig, VisParams } from '../../common';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
// @ts-ignore
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { metricVisFunction } from '../common';
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import type { IInterpreterRenderHandlers, Datatable } from '@kbn/expressions-plu
|
|||
import { getColumnByAccessor } from '@kbn/visualizations-plugin/common/utils';
|
||||
import { ExpressionMetricPluginStart } from '../plugin';
|
||||
import { EXPRESSION_METRIC_NAME, MetricVisRenderConfig, VisParams } from '../../common';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
async function metricFilterable(
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { metricVisFunction } from '../common';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import type { PaletteOutput } from '@kbn/coloring';
|
|||
import { Datatable, DatatableColumn } from '@kbn/expressions-plugin/common';
|
||||
import { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
|
||||
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
|
||||
import { LegendSize } from '@kbn/visualizations-plugin/public';
|
||||
import type { LegendSize } from '@kbn/visualizations-plugin/public';
|
||||
import { ChartTypes, ExpressionValuePartitionLabels } from './expression_functions';
|
||||
|
||||
export enum EmptySizeRatios {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ThemeService } from '@kbn/charts-plugin/public/services';
|
||||
import { uiSettings } from './ui_settings';
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import { METRIC_TYPE } from '@kbn/analytics';
|
|||
import { VisTypePieDependencies } from '../plugin';
|
||||
import { PARTITION_VIS_RENDERER_NAME } from '../../common/constants';
|
||||
import { ChartTypes, RenderValue } from '../../common/types';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
export const strings = {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { ChartsPluginSetup } from '@kbn/charts-plugin/public';
|
||||
import type { ChartsPluginSetup } from '@kbn/charts-plugin/public';
|
||||
|
||||
export interface TagCloudTypeProps {
|
||||
palettes: ChartsPluginSetup['palettes'];
|
||||
|
|
|
@ -18,6 +18,7 @@ import { METRIC_TYPE } from '@kbn/analytics';
|
|||
import { ExpressionTagcloudRendererDependencies } from '../plugin';
|
||||
import { TagcloudRendererConfig } from '../../common/types';
|
||||
import { EXPRESSION_NAME } from '../../common';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
export const strings = {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { tagcloudFunction } from '../common/expression_functions';
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { HorizontalAlignment, Position, VerticalAlignment } from '@elastic/chart
|
|||
import { $Values } from '@kbn/utility-types';
|
||||
import type { PaletteOutput } from '@kbn/coloring';
|
||||
import { Datatable, ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common';
|
||||
import { LegendSize } from '@kbn/visualizations-plugin/public';
|
||||
import { LegendSize } from '@kbn/visualizations-plugin/common';
|
||||
import { EventAnnotationOutput } from '@kbn/event-annotation-plugin/common';
|
||||
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import { isDataLayer } from '../../common/utils/layer_types_guards';
|
|||
import { LayerTypes, SeriesTypes } from '../../common/constants';
|
||||
import type { CommonXYLayerConfig, XYChartProps } from '../../common';
|
||||
import type { BrushEvent, FilterEvent } from '../types';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { extractContainerType, extractVisualizationType } from '../../../common';
|
||||
|
||||
export type GetStartDepsFn = () => Promise<{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import { PluginServices } from '@kbn/presentation-util-plugin/public';
|
||||
import { ControlsDataViewsService } from './data_views';
|
||||
import { ControlsOverlaysService } from './overlays';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { registry as stubRegistry } from './stub';
|
||||
import { ControlsPluginStart } from '../types';
|
||||
import { ControlsDataService } from './data';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectReference } from '@kbn/core/public';
|
||||
import type { SavedObjectReference } from '@kbn/core/public';
|
||||
import type { Serializable } from '@kbn/utility-types';
|
||||
|
||||
import { GridData } from '..';
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
*/
|
||||
|
||||
export type { HomePublicPluginSetup } from '@kbn/home-plugin/public';
|
||||
export { FeatureCatalogueCategory } from '@kbn/home-plugin/public';
|
||||
export type { FeatureCatalogueCategory } from '@kbn/home-plugin/public';
|
||||
|
|
|
@ -15,8 +15,7 @@ import { Assign, Ensure } from '@kbn/utility-types';
|
|||
import { ExpressionAstExpression, ExpressionAstArgument } from '@kbn/expressions-plugin/common';
|
||||
import type { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
|
||||
import { FieldFormatParams } from '@kbn/field-formats-plugin/common';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ISearchOptions, ISearchSource } from '../../../public';
|
||||
import type { ISearchOptions, ISearchSource } from '../../../public';
|
||||
|
||||
import { IAggType } from './agg_type';
|
||||
import { writeParams } from './agg_params';
|
||||
|
|
|
@ -16,12 +16,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
|||
import type { IndexPatternLoadExpressionFunctionDefinition } from '@kbn/data-views-plugin/common';
|
||||
import { buildExpression, buildExpressionFunction } from '@kbn/expressions-plugin/common';
|
||||
|
||||
import type {
|
||||
IEsSearchResponse,
|
||||
ISearchOptions,
|
||||
ISearchSource,
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
} from '../../../public';
|
||||
import type { IEsSearchResponse, ISearchOptions, ISearchSource } from '../../../public';
|
||||
import type { EsaggsExpressionFunctionDefinition } from '../expressions';
|
||||
import { AggConfig, AggConfigSerialized, IAggConfig } from './agg_config';
|
||||
import type { IAggType } from './agg_type';
|
||||
|
|
|
@ -15,8 +15,7 @@ import type { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
|
|||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { FieldFormatParams } from '@kbn/field-formats-plugin/common';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ISearchSource } from '../../../public';
|
||||
import type { ISearchSource } from '../../../public';
|
||||
import { initParams } from './agg_params';
|
||||
import { AggConfig } from './agg_config';
|
||||
import { IAggConfigs } from './agg_configs';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { get } from 'lodash';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { IUiSettingsClient } from '@kbn/core/public';
|
||||
import type { IUiSettingsClient } from '@kbn/core/public';
|
||||
|
||||
import { KBN_FIELD_TYPES, UI_SETTINGS } from '../../..';
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*/
|
||||
|
||||
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ISearchOptions, ISearchSource } from '../../../../public';
|
||||
import type { ISearchOptions, ISearchSource } from '../../../../public';
|
||||
import { IAggConfigs } from '../agg_configs';
|
||||
import { IAggConfig } from '../agg_config';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { KibanaRequest } from '@kbn/core/server';
|
||||
import { buildEsQuery } from '@kbn/es-query';
|
||||
import { castEsToKbnFieldTypeName, ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types';
|
||||
|
@ -21,7 +20,6 @@ import { RequestAdapter } from '@kbn/inspector-plugin/common';
|
|||
import { zipObject } from 'lodash';
|
||||
import { Observable, defer, throwError } from 'rxjs';
|
||||
import { catchError, map, switchMap, tap } from 'rxjs/operators';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { NowProviderPublicContract } from '../../../public';
|
||||
import { getEsQueryConfig } from '../../es_query';
|
||||
import { getTime } from '../../query';
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { RequestStatistics } from '@kbn/inspector-plugin/common';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { ISearchSource } from '../../../../public';
|
||||
|
||||
/** @public */
|
||||
|
|
|
@ -12,8 +12,7 @@ import { SerializableRecord } from '@kbn/utility-types';
|
|||
import { PersistableStateService } from '@kbn/kibana-utils-plugin/common';
|
||||
import type { Filter } from '@kbn/es-query';
|
||||
import type { DataView, DataViewSpec } from '@kbn/data-views-plugin/common';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { AggConfigSerialized, IAggConfigs } from '../../../public';
|
||||
import type { AggConfigSerialized, IAggConfigs } from '../../../public';
|
||||
import type { SearchSource } from './search_source';
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
import { handleResponse } from './handle_response';
|
||||
|
||||
// Temporary disable eslint, will be removed after moving to new platform folder
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { notificationServiceMock } from '@kbn/core/public/notifications/notifications_service.mock';
|
||||
import { setNotifications } from '../../services';
|
||||
import { IKibanaSearchResponse } from '../../../common';
|
||||
|
|
|
@ -13,7 +13,6 @@ import type {
|
|||
SavedObjectsFindResponse,
|
||||
SavedObjectsUpdateResponse,
|
||||
SavedObjectsFindOptions,
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
} from '@kbn/core/server';
|
||||
import type { SearchSessionSavedObjectAttributes } from '../../../common';
|
||||
export type SearchSessionSavedObject = SavedObject<SearchSessionSavedObjectAttributes>;
|
||||
|
|
|
@ -10,7 +10,6 @@ import type { MockedKeys } from '@kbn/utility-types-jest';
|
|||
import { CoreSetup, CoreStart } from '@kbn/core/public';
|
||||
import moment from 'moment';
|
||||
import { coreMock } from '@kbn/core/public/mocks';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { SavedObjectsFindResponse } from '@kbn/core/server';
|
||||
import { SessionsClient } from '../../..';
|
||||
import { SearchSessionStatus } from '../../../../../common';
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { PackageInfo } from '@kbn/core/server';
|
||||
import type { PackageInfo } from '@kbn/core/server';
|
||||
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
|
||||
import { DataViewsContract } from '@kbn/data-views-plugin/common';
|
||||
import { SearchUsageCollector } from './collectors';
|
||||
|
|
|
@ -7,5 +7,4 @@
|
|||
*/
|
||||
|
||||
export * from '../common/stubs';
|
||||
// eslint-disable-next-line @kbn/imports/uniform_imports,@kbn/eslint/no-restricted-paths
|
||||
export { createStubDataView } from '../../data_views/public/data_views/data_view.stub';
|
||||
export { createStubDataView } from '@kbn/data-views-plugin/public/data_views/data_view.stub';
|
||||
|
|
|
@ -26,7 +26,6 @@ import type {
|
|||
ISearchStrategy,
|
||||
} from '.';
|
||||
import { NoSearchIdInSessionError } from '.';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks';
|
||||
import { createSearchSessionsClientMock } from './mocks';
|
||||
import { ENHANCED_ES_SEARCH_STRATEGY } from '../../common';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectsClientContract } from '@kbn/core/public';
|
||||
import type { SavedObjectsClientContract } from '@kbn/core/public';
|
||||
import { DATA_VIEW_SAVED_OBJECT_TYPE } from '../constants';
|
||||
import { DataViewAttributes } from '../types';
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { SavedObjectAttributes } from '@kbn/core/server';
|
||||
import type { SavedObjectAttributes } from '@kbn/core/server';
|
||||
import { IEmbeddable } from './i_embeddable';
|
||||
import { EmbeddableFactory } from './embeddable_factory';
|
||||
import { EmbeddableInput, EmbeddableOutput } from '..';
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { HttpSetup } from '@kbn/core/public';
|
||||
import type { HttpSetup } from '@kbn/core/public';
|
||||
import React, { createContext, useContext } from 'react';
|
||||
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { useRequest } from '../../../public/request';
|
||||
|
||||
import { Privileges, Error as CustomError } from '../types';
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import { EuiSpacer, EuiEmptyPrompt, EuiPageContent } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { APP_WRAPPER_CLASS } from '@kbn/core/public';
|
||||
import { Error } from '../types';
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import { errors } from '@elastic/elasticsearch';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { kibanaResponseFactory as response } from '@kbn/core/server';
|
||||
import { handleEsError } from './handle_es_error';
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*/
|
||||
|
||||
import { errors } from '@elastic/elasticsearch';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { IKibanaResponse, KibanaResponseFactory } from '@kbn/core/server';
|
||||
import type { IKibanaResponse, KibanaResponseFactory } from '@kbn/core/server';
|
||||
import { getEsCause } from './es_error_parser';
|
||||
|
||||
interface EsErrorHandlerParams {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { imageFunction } from '../common/expression_functions';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { metricFunction } from '../common';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { repeatImageFunction } from '../common';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { revealImageFunction } from '../common';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import { ExpressionsServerStart, ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
|
||||
import { shapeFunction, progressFunction } from '../common/expression_functions';
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import type { SerializableRecord } from '@kbn/utility-types';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { KibanaRequest } from '@kbn/core/server';
|
||||
import type { KibanaExecutionContext } from '@kbn/core/public';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { KibanaRequest } from '@kbn/core/server';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ExpressionFunctionDefinition } from '../..';
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
import { Observable } from 'rxjs';
|
||||
import type { Logger } from '@kbn/logging';
|
||||
import type { SerializableRecord } from '@kbn/utility-types';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { KibanaRequest } from '@kbn/core/server';
|
||||
import type { KibanaExecutionContext } from '@kbn/core/public';
|
||||
|
||||
|
|
|
@ -10,5 +10,6 @@ export * from './create_error';
|
|||
export * from './get_by_alias';
|
||||
export * from './tables_adapter';
|
||||
export * from './expressions_inspector_adapter';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export * from './test_utils';
|
||||
export * from './create_default_inspector_adapters';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { CoreSetup, PluginInitializerContext } from '@kbn/core/server';
|
||||
import { SavedObject } from '@kbn/core/public';
|
||||
import type { SavedObject } from '@kbn/core/public';
|
||||
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
||||
import { CustomIntegrationsPluginSetup } from '@kbn/custom-integrations-plugin/server';
|
||||
import {
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
ERROR_OUTSIDE_PREBOOT_STAGE,
|
||||
ERROR_PING_FAILURE,
|
||||
} from '../common';
|
||||
import { interactiveSetupMock } from '../server/mocks'; // eslint-disable-line @kbn/eslint/no-restricted-paths
|
||||
import { interactiveSetupMock } from '../server/mocks';
|
||||
import { SubmitErrorCallout } from './submit_error_callout';
|
||||
|
||||
describe('SubmitErrorCallout', () => {
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
createKbnUrlStateStorage,
|
||||
syncState,
|
||||
INullableBaseStateContainer,
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
} from '../../public/state_sync';
|
||||
|
||||
const tick = () => new Promise((resolve) => setTimeout(resolve));
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
*/
|
||||
|
||||
export * from './utils';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
export * from './test_helpers';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreTheme } from '@kbn/core/public';
|
||||
import type { CoreTheme } from '@kbn/core/public';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export const defaultTheme$: Observable<CoreTheme> = new Observable((subscriber) =>
|
||||
|
|
|
@ -11,6 +11,7 @@ import { PluginServices } from './create';
|
|||
import { PresentationCapabilitiesService } from './capabilities';
|
||||
import { PresentationDashboardsService } from './dashboards';
|
||||
import { PresentationLabsService } from './labs';
|
||||
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
|
||||
import { registry as stubRegistry } from './stub';
|
||||
import { PresentationDataViewsService } from './data_views';
|
||||
import { registerExpressionsLanguage } from '..';
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { SavedObjectsFindOptionsReference } from '@kbn/core/server';
|
||||
import type { SavedObjectsFindOptionsReference } from '@kbn/core/server';
|
||||
import { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public';
|
||||
|
||||
export const getTagFindReferences = ({
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
import { LocatorDefinition } from './types';
|
||||
import { Locator, LocatorDependencies } from './locator';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { KibanaLocation } from '../../../public';
|
||||
import { LocatorGetUrlParams } from '.';
|
||||
import { decompressFromBase64 } from 'lz-string';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import type { SerializableRecord } from '@kbn/utility-types';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import type { SavedObjectReference } from '@kbn/core/server';
|
||||
import { DependencyList } from 'react';
|
||||
import type { PersistableState } from '@kbn/kibana-utils-plugin/common';
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
import type { SerializableRecord } from '@kbn/utility-types';
|
||||
import { MigrateFunctionsObject } from '@kbn/kibana-utils-plugin/common';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { SavedObjectReference } from '@kbn/core/server';
|
||||
import type { SavedObjectReference } from '@kbn/core/server';
|
||||
import type { LocatorDependencies } from './locator';
|
||||
import type { LocatorDefinition, LocatorPublic, ILocatorClient, LocatorData } from './types';
|
||||
import { Locator } from './locator';
|
||||
|
|
|
@ -11,7 +11,7 @@ import fn from './abs';
|
|||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
const seriesList = require('./fixtures/series_list')();
|
||||
import invoke from './helpers/invoke_series_fn';
|
||||
import invoke from './test_helpers/invoke_series_fn';
|
||||
|
||||
describe('abs.js', function () {
|
||||
it('should return the positive value of every value', function () {
|
||||
|
|
|
@ -10,7 +10,7 @@ import fn from '.';
|
|||
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
import invoke from '../helpers/invoke_series_fn';
|
||||
import invoke from '../test_helpers/invoke_series_fn';
|
||||
|
||||
describe('aggregate', () => {
|
||||
let seriesList;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue