mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] File upload enable consistent-type-imports eslint rule (#212044)
Enabling `consistent-type-imports` rule and running `node scripts/eslint --no-cache --fix` to fix every type import. Every other ML owned plugin has this rule enabled. Originally added in https://github.com/elastic/kibana/pull/176921 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
17931c5c5b
commit
b26d85bd98
35 changed files with 76 additions and 67 deletions
|
@ -1089,6 +1089,7 @@ module.exports = {
|
|||
'x-pack/platform/plugins/private/transform/**/*.{js,mjs,ts,tsx}',
|
||||
'x-pack/platform/packages/shared/ml/**/*.{js,mjs,ts,tsx}',
|
||||
'x-pack/platform/packages/private/ml/**/*.{js,mjs,ts,tsx}',
|
||||
'x-pack/platform/plugins/private/file_upload/**/*.{js,mjs,ts,tsx}',
|
||||
],
|
||||
rules: {
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { estypes } from '@elastic/elasticsearch';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
import type { ES_FIELD_TYPES } from '@kbn/data-plugin/common';
|
||||
|
||||
export interface InputOverrides {
|
||||
[key: string]: string | undefined;
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import { EuiSkeletonText } from '@elastic/eui';
|
||||
import { FileUploadComponentProps, lazyLoadModules } from '../lazy_load_bundle';
|
||||
import type { FileUploadComponentProps } from '../lazy_load_bundle';
|
||||
import { lazyLoadModules } from '../lazy_load_bundle';
|
||||
|
||||
interface State {
|
||||
GeoUploadWizard: React.ComponentType<FileUploadComponentProps> | null;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import React from 'react';
|
||||
import { EuiSkeletonText } from '@elastic/eui';
|
||||
import { lazyLoadModules } from '../lazy_load_bundle';
|
||||
import { IndexNameFormProps } from '..';
|
||||
import type { IndexNameFormProps } from '..';
|
||||
|
||||
interface State {
|
||||
IndexNameForm: React.ComponentType<IndexNameFormProps> | null;
|
||||
|
|
|
@ -5,19 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { ChangeEvent, Component } from 'react';
|
||||
import {
|
||||
EuiForm,
|
||||
EuiFormRow,
|
||||
EuiSpacer,
|
||||
EuiSelect,
|
||||
EuiSwitch,
|
||||
EuiSwitchEvent,
|
||||
EuiToolTip,
|
||||
} from '@elastic/eui';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import type { EuiSwitchEvent } from '@elastic/eui';
|
||||
import { EuiForm, EuiFormRow, EuiSpacer, EuiSelect, EuiSwitch, EuiToolTip } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import { GeoFilePicker, OnFileSelectParameters } from './geo_file_picker';
|
||||
import type { OnFileSelectParameters } from './geo_file_picker';
|
||||
import { GeoFilePicker } from './geo_file_picker';
|
||||
import { IndexNameForm } from './index_name_form';
|
||||
import { validateIndexName } from '../../validate_index_name';
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import React, { ChangeEvent, Component } from 'react';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { EuiFormRow, EuiFieldText, EuiCallOut, EuiSpacer } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { validateIndexName } from '../../validate_index_name';
|
||||
|
|
|
@ -10,11 +10,12 @@ import { i18n } from '@kbn/i18n';
|
|||
import { EuiProgress, EuiText } from '@elastic/eui';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import { getDataViewsService } from '../kibana_services';
|
||||
import { GeoUploadForm, OnFileSelectParameters } from './geo_upload_form';
|
||||
import type { OnFileSelectParameters } from './geo_upload_form';
|
||||
import { GeoUploadForm } from './geo_upload_form';
|
||||
import { ImportCompleteView } from './import_complete_view';
|
||||
import type { FileUploadComponentProps, FileUploadGeoResults } from '../lazy_load_bundle';
|
||||
import { ImportResults } from '../importer';
|
||||
import { GeoFileImporter } from '../importer/geo';
|
||||
import type { ImportResults } from '../importer';
|
||||
import type { GeoFileImporter } from '../importer/geo';
|
||||
import { hasImportPermission } from '../api';
|
||||
import { getPartialImportMessage } from './utils';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { CodeEditor } from '@kbn/code-editor';
|
||||
import { getDocLinks, getHttp, getUiSettings, getSettings, getTheme } from '../kibana_services';
|
||||
import { ImportResults } from '../importer';
|
||||
import type { ImportResults } from '../importer';
|
||||
import { getPartialImportMessage } from './utils';
|
||||
|
||||
const services = {
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ReactNode } from 'react';
|
||||
import { Feature } from 'geojson';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { Feature } from 'geojson';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import { GeoFileImporter, GeoFilePreview } from './types';
|
||||
import { CreateDocsResponse, ImportResults } from '../types';
|
||||
import type { GeoFileImporter, GeoFilePreview } from './types';
|
||||
import type { CreateDocsResponse, ImportResults } from '../types';
|
||||
import { Importer, IMPORT_RETRIES, MAX_CHUNK_CHAR_COUNT } from '../importer';
|
||||
import { MB } from '../../../common/constants';
|
||||
import type { ImportDoc, ImportFailure, ImportResponse } from '../../../common/types';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Feature } from 'geojson';
|
||||
import type { Feature } from 'geojson';
|
||||
import { createChunks, toEsDoc } from './create_chunks';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Feature, Point } from 'geojson';
|
||||
import type { Feature, Point } from 'geojson';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import type { ImportDoc } from '../../../common/types';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Feature } from 'geojson';
|
||||
import type { Feature } from 'geojson';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { Batch } from '@loaders.gl/schema';
|
||||
import { JSONLoader, type JSONLoaderOptions } from '@loaders.gl/json';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Feature } from 'geojson';
|
||||
import type { Feature } from 'geojson';
|
||||
import { _BrowserFileSystem as BrowserFileSystem, loadInBatches } from '@loaders.gl/core';
|
||||
import { DBFLoader, ShapefileLoader } from '@loaders.gl/shapefile';
|
||||
import type { ImportFailure } from '../../../../common/types';
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Feature } from 'geojson';
|
||||
import { ReactNode } from 'react';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import { IImporter } from '../types';
|
||||
import type { Feature } from 'geojson';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import type { IImporter } from '../types';
|
||||
import type { ImportFailure } from '../../../common/types';
|
||||
|
||||
export interface GeoFilePreview {
|
||||
|
|
|
@ -23,7 +23,7 @@ import type {
|
|||
IngestPipeline,
|
||||
IngestPipelineWrapper,
|
||||
} from '../../common/types';
|
||||
import { CreateDocsResponse, IImporter, ImportResults } from './types';
|
||||
import type { CreateDocsResponse, IImporter, ImportResults } from './types';
|
||||
import { callImportRoute, callInitializeImportRoute } from './routes';
|
||||
|
||||
const CHUNK_SIZE = 5000;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { MessageImporter } from './message_importer';
|
||||
import { NdjsonImporter } from './ndjson_importer';
|
||||
import { TikaImporter } from './tika_importer';
|
||||
import { ImportFactoryOptions } from './types';
|
||||
import type { ImportFactoryOptions } from './types';
|
||||
import { FILE_FORMATS } from '../../common/constants';
|
||||
|
||||
export function importerFactory(format: string, options: ImportFactoryOptions) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { Importer } from './importer';
|
||||
import { CreateDocsResponse } from './types';
|
||||
import type { CreateDocsResponse } from './types';
|
||||
|
||||
export class NdjsonImporter extends Importer {
|
||||
constructor() {
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import { fromByteArray } from 'base64-js';
|
||||
import { ImportDocTika } from '../../common/types';
|
||||
import type { ImportDocTika } from '../../common/types';
|
||||
import { Importer } from './importer';
|
||||
import { CreateDocsResponse } from './types';
|
||||
import type { CreateDocsResponse } from './types';
|
||||
|
||||
export class TikaImporter extends Importer {
|
||||
constructor() {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { FileUploadStartDependencies } from './plugin';
|
||||
import type { CoreStart } from '@kbn/core/public';
|
||||
import type { FileUploadStartDependencies } from './plugin';
|
||||
|
||||
let coreStart: CoreStart;
|
||||
let pluginsStart: FileUploadStartDependencies;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { FeatureCollection } from 'geojson';
|
||||
import { HttpStart } from '@kbn/core/public';
|
||||
import { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import { IImporter, ImportFactoryOptions } from '../importer';
|
||||
import type React from 'react';
|
||||
import type { FeatureCollection } from 'geojson';
|
||||
import type { HttpStart } from '@kbn/core/public';
|
||||
import type { ES_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import type { IImporter, ImportFactoryOptions } from '../importer';
|
||||
import { getHttp } from '../kibana_services';
|
||||
import { IndexNameFormProps } from '..';
|
||||
import type { IndexNameFormProps } from '..';
|
||||
|
||||
export interface FileUploadGeoResults {
|
||||
indexPatternId: string;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreStart, Plugin } from '@kbn/core/public';
|
||||
import type { CoreStart, Plugin } from '@kbn/core/public';
|
||||
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
||||
import type { FileUploadStartApi } from './api';
|
||||
import {
|
||||
FileUploadStartApi,
|
||||
FileUploadComponent,
|
||||
importerFactory,
|
||||
hasImportPermission,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type {
|
||||
AnalysisResult,
|
||||
FormattedOverrides,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { setupCapabilities } from './capabilities';
|
||||
import { coreMock, httpServerMock } from '@kbn/core/server/mocks';
|
||||
import { Capabilities, CoreStart } from '@kbn/core/server';
|
||||
import type { Capabilities, CoreStart } from '@kbn/core/server';
|
||||
import { securityMock } from '@kbn/security-plugin/server/mocks';
|
||||
|
||||
describe('setupCapabilities', () => {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreSetup } from '@kbn/core/server';
|
||||
import type { CoreSetup } from '@kbn/core/server';
|
||||
import { checkFileUploadPrivileges } from './check_privileges';
|
||||
import { StartDeps } from './types';
|
||||
import type { StartDeps } from './types';
|
||||
|
||||
export const setupCapabilities = (
|
||||
core: Pick<CoreSetup<StartDeps>, 'capabilities' | 'getStartServices'>
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { KibanaRequest } from '@kbn/core/server';
|
||||
import { AuthorizationServiceSetup, CheckPrivilegesPayload } from '@kbn/security-plugin/server';
|
||||
import type { KibanaRequest } from '@kbn/core/server';
|
||||
import type {
|
||||
AuthorizationServiceSetup,
|
||||
CheckPrivilegesPayload,
|
||||
} from '@kbn/security-plugin/server';
|
||||
|
||||
interface Deps {
|
||||
request: KibanaRequest;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { boomify, isBoom } from '@hapi/boom';
|
||||
import { ResponseError, CustomHttpResponseOptions } from '@kbn/core/server';
|
||||
import type { ResponseError, CustomHttpResponseOptions } from '@kbn/core/server';
|
||||
|
||||
export function wrapError(error: any): CustomHttpResponseOptions<ResponseError> {
|
||||
const boom = isBoom(error)
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type { estypes } from '@elastic/elasticsearch';
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
|
||||
export async function getTimeFieldRange(
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from '@kbn/core/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
|
||||
export const plugin = async (initializerContext: PluginInitializerContext) => {
|
||||
const { FileUploadPlugin } = await import('./plugin');
|
||||
|
|
|
@ -6,13 +6,19 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from '@kbn/core/server';
|
||||
import type {
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
Logger,
|
||||
Plugin,
|
||||
PluginInitializerContext,
|
||||
} from '@kbn/core/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { fileUploadRoutes } from './routes';
|
||||
import { initFileUploadTelemetry } from './telemetry';
|
||||
import { MAX_FILE_SIZE, UI_SETTING_MAX_FILE_SIZE } from '../common/constants';
|
||||
import { setupCapabilities } from './capabilities';
|
||||
import { StartDeps, SetupDeps } from './types';
|
||||
import type { StartDeps, SetupDeps } from './types';
|
||||
|
||||
export class FileUploadPlugin implements Plugin {
|
||||
private readonly _logger: Logger;
|
||||
|
|
|
@ -24,7 +24,7 @@ import type { StartDeps } from './types';
|
|||
import { checkFileUploadPrivileges } from './check_privileges';
|
||||
import { previewIndexTimeRange } from './preview_index_time_range';
|
||||
import { previewTikaContents } from './preview_tika_contents';
|
||||
import { IngestPipelineWrapper } from '../common/types';
|
||||
import type { IngestPipelineWrapper } from '../common/types';
|
||||
|
||||
/**
|
||||
* Routes for the file upload.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SavedObjectsServiceStart, ISavedObjectsRepository } from '@kbn/core/server';
|
||||
import type { SavedObjectsServiceStart, ISavedObjectsRepository } from '@kbn/core/server';
|
||||
|
||||
let internalRepository: ISavedObjectsRepository | null = null;
|
||||
export const setInternalRepository = (
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SavedObjectsType } from '@kbn/core/server';
|
||||
import type { SavedObjectsType } from '@kbn/core/server';
|
||||
import { TELEMETRY_DOC_ID } from './telemetry';
|
||||
|
||||
export const telemetryMappingsType: SavedObjectsType = {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { isEmpty } from 'lodash';
|
||||
import { ISavedObjectsRepository } from '@kbn/core/server';
|
||||
import type { ISavedObjectsRepository } from '@kbn/core/server';
|
||||
|
||||
import { getInternalRepository } from './internal_repository';
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreSetup } from '@kbn/core/server';
|
||||
import type { CoreSetup } from '@kbn/core/server';
|
||||
|
||||
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
||||
import { getTelemetry, initTelemetry, Telemetry } from './telemetry';
|
||||
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
||||
import type { Telemetry } from './telemetry';
|
||||
import { getTelemetry, initTelemetry } from './telemetry';
|
||||
import { telemetryMappingsType } from './mappings';
|
||||
import { getInternalRepository, setInternalRepository } from './internal_repository';
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SecurityPluginStart } from '@kbn/security-plugin/server';
|
||||
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
||||
import type { SecurityPluginStart } from '@kbn/security-plugin/server';
|
||||
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
||||
|
||||
export interface StartDeps {
|
||||
security?: SecurityPluginStart;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue