Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8ec6225
added eslint rule for consistent-type-imports and fixed the errors fo…
georgianaonoleata1904 Feb 25, 2025
1f26430
removed /
georgianaonoleata1904 Feb 25, 2025
8573aff
fixed eslint type errors for alerting
georgianaonoleata1904 Feb 25, 2025
4992a32
applied type rule only for alerting and response-ops
georgianaonoleata1904 Feb 26, 2025
a31e291
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Feb 28, 2025
5ecd533
fixed eslint error
georgianaonoleata1904 Feb 28, 2025
0bb2516
Merge branch 'type-imports-eslint-ro' of https://github.com/georgiana…
georgianaonoleata1904 Feb 28, 2025
673e430
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 28, 2025
c05b224
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 3, 2025
4cc7a16
fixed no_unresolvable_imports issues
georgianaonoleata1904 Mar 3, 2025
e4e7f58
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 5, 2025
f81fc02
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Mar 5, 2025
3795562
fixed missing import
georgianaonoleata1904 Mar 5, 2025
d2afd27
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 10, 2025
5f99e74
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 10, 2025
ea7de36
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 10, 2025
fffb7ef
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Mar 10, 2025
a4ff244
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 10, 2025
04a0df9
Merge branch 'main' into type-imports-eslint-ro
georgianaonoleata1904 Mar 11, 2025
53d7db4
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Mar 11, 2025
ca170d2
Merge branch 'main' into type-imports-eslint-ro
elasticmachine Mar 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 15 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1607,9 +1607,9 @@ module.exports = {
{
// typescript for front and back end
files: [
'x-pack/platform/plugins/shared/actions/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/alerting/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/stack_alerts/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/actions/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/task_manager/**/*.{ts,tsx}',
'x-pack/platform/plugins/shared/event_log/**/*.{ts,tsx}',
],
Expand All @@ -1628,6 +1628,20 @@ module.exports = {
},
},

/**
* ResponseOps overrides
*/

{
files: [
'src/platform/packages/shared/response-ops/**/*.{ts, tsx}',
'x-pack/platform/plugins/shared/alerting/**/*.{ts,tsx}',
],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
},
},

/**
* Lens overrides
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { HttpStart } from '@kbn/core-http-browser';
import type { HttpStart } from '@kbn/core-http-browser';
import { nodeBuilder } from '@kbn/es-query';

const INTERNAL_FIND_RULES_URL = '/internal/alerting/rules/_find';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { HttpSetup } from '@kbn/core/public';
import type { HttpSetup } from '@kbn/core/public';
import { BASE_ALERTING_API_PATH } from '../constants';

export interface MuteAlertInstanceParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { HttpSetup } from '@kbn/core/public';
import type { HttpSetup } from '@kbn/core/public';
import { BASE_ALERTING_API_PATH } from '../constants';

export interface UnmuteAlertInstanceParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { IHttpFetchError, ResponseErrorBody } from '@kbn/core-http-browser';
import type { IHttpFetchError, ResponseErrorBody } from '@kbn/core-http-browser';

export type ServerError = IHttpFetchError<ResponseErrorBody>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { css } from '@emotion/react';
import { UseEuiTheme } from '@elastic/eui';
import type { UseEuiTheme } from '@elastic/eui';

export const styles = {
badgesGroup: ({ euiTheme }: { euiTheme: UseEuiTheme['euiTheme'] }) => css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { UseEuiTheme } from '@elastic/eui';
import type { UseEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';

export const styles = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EcsMetadata } from '@kbn/alerts-as-data-utils/src/field_maps/types';
import {
ALERT_CASE_IDS,
ALERT_MAINTENANCE_WINDOW_IDS,
DefaultAlertFieldName,
} from '@kbn/rule-data-utils';
import type { EcsMetadata } from '@kbn/alerts-as-data-utils/src/field_maps/types';
import type { DefaultAlertFieldName } from '@kbn/rule-data-utils';
import { ALERT_CASE_IDS, ALERT_MAINTENANCE_WINDOW_IDS } from '@kbn/rule-data-utils';
import type { BrowserField, BrowserFields } from '@kbn/rule-registry-plugin/common';
import { isEmpty } from 'lodash/fp';
import { CASES, MAINTENANCE_WINDOWS } from './translations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types';
import type { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types';
import type { BrowserFields } from '@kbn/rule-registry-plugin/common';

const DEFAULT_INDEX_PATTERN = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { CaseStatuses } from '@kbn/cases-components';
import { HttpStart } from '@kbn/core-http-browser';
import type { CaseStatuses } from '@kbn/cases-components';
import type { HttpStart } from '@kbn/core-http-browser';

const INTERNAL_BULK_GET_CASES_URL = '/internal/cases/_bulk_get';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
ALERT_STATUS,
TIMESTAMP,
} from '@kbn/rule-data-utils';
import { SortCombinations } from '@elastic/elasticsearch/lib/api/types';
import type { SortCombinations } from '@elastic/elasticsearch/lib/api/types';
import { i18n } from '@kbn/i18n';
import { FEATURE_LABEL } from './translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
import type { EuiIconType } from '@elastic/eui/src/components/icon/icon';
import { AlertConsumers } from '@kbn/rule-data-utils';
import type { SortCombinations } from '@elastic/elasticsearch/lib/api/types';
import {
Expand All @@ -22,7 +22,7 @@ import {
STACK_MONITORING_DISPLAY_NAME,
UPTIME_DISPLAY_NAME,
} from './translations';
import { AlertsTableSupportedConsumers } from './types';
import type { AlertsTableSupportedConsumers } from './types';

interface AlertProducerData {
displayName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { EuiDataGridColumn } from '@elastic/eui';
import type { EuiDataGridColumn } from '@elastic/eui';
import { ALERT_CASE_IDS, ALERT_MAINTENANCE_WINDOW_IDS } from '@kbn/rule-data-utils';
import * as i18n from '../translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React, { useCallback, useEffect, useMemo } from 'react';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
import type React from 'react';
import { useCallback, useEffect, useMemo } from 'react';
import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
import { ALERT_CASE_IDS, isSiemRuleType } from '@kbn/rule-data-utils';
import type { HttpStart } from '@kbn/core-http-browser';
import type { NotificationsStart } from '@kbn/core-notifications-browser';
Expand Down Expand Up @@ -306,7 +307,7 @@ export function useBulkActions({
updateBulkActionsState({ action: BulkActionsVerbs.clear });
}, [updateBulkActionsState]);
const setIsBulkActionsLoading = useCallback(
(isLoading: boolean = true) => {
(isLoading = true) => {
updateBulkActionsState({ action: BulkActionsVerbs.updateAllLoadingState, isLoading });
},
[updateBulkActionsState]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { generatePath } from 'react-router-dom';
import useObservable from 'react-use/lib/useObservable';
import { useCallback } from 'react';
import { ApplicationStart } from '@kbn/core-application-browser';
import type { ApplicationStart } from '@kbn/core-application-browser';

type NavigateToCaseView = (pathParams: { caseId: string }) => void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

import { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { EuiDataGridColumn, EuiDataGridOnColumnResizeData } from '@elastic/eui';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { BrowserField, BrowserFields } from '@kbn/alerting-types';
import type { EuiDataGridColumn, EuiDataGridOnColumnResizeData } from '@elastic/eui';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import type { BrowserField, BrowserFields } from '@kbn/alerting-types';
import { isEmpty } from 'lodash';
import { useFetchAlertsFieldsQuery } from '@kbn/alerts-ui-shared/src/common/hooks/use_fetch_alerts_fields_query';
import { AlertsQueryContext } from '@kbn/alerts-ui-shared/src/common/contexts/alerts_query_context';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { renderHook, act } from '@testing-library/react';
import { PaginationProps, usePagination } from './use_pagination';
import type { PaginationProps } from './use_pagination';
import { usePagination } from './use_pagination';

describe('usePagination', () => {
const onPageChange = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { useCallback, useEffect, useState } from 'react';
import type { RuleRegistrySearchRequestPagination } from '@kbn/rule-registry-plugin/common';
import { BulkActionsVerbs } from '../types';
import { AdditionalContext, RenderContext } from '../types';
import type { AdditionalContext, RenderContext } from '../types';

export type PaginationProps = RuleRegistrySearchRequestPagination & {
bulkActionsStore: RenderContext<AdditionalContext>['bulkActionsStore'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import type { SortCombinations } from '@elastic/elasticsearch/lib/api/types';
import type { EuiDataGridSorting } from '@elastic/eui';
import { EuiDataGridColumnSortingConfig } from '@elastic/eui/src/components/datagrid/data_grid_types';
import type { EuiDataGridColumnSortingConfig } from '@elastic/eui/src/components/datagrid/data_grid_types';
import { useCallback, useMemo, useState } from 'react';
import { defaultSort } from '../constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { BulkActionsReducerAction, BulkActionsState, BulkActionsVerbs } from '../types';
import type { BulkActionsReducerAction, BulkActionsState } from '../types';
import { BulkActionsVerbs } from '../types';

const getAllRowsInPage = (rowCount: number) =>
new Map(Array.from(Array(rowCount).keys()).map((idx) => [idx, { isLoading: false }]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
RefAttributes,
SetStateAction,
} from 'react';
import {
import type {
AlertConsumers,
ALERT_CASE_IDS,
ALERT_STATUS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React, { forwardRef, memo, ReactElement } from 'react';
import type { ReactElement } from 'react';
import type React from 'react';
import { forwardRef, memo } from 'react';

/**
* A `React.memo` variant that keeps generic type information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import type { MockedKeys } from '@kbn/utility-types-jest';
import { Storage } from './storage';
import { IStorageWrapper, IStorage } from '@kbn/kibana-utils-plugin/public';
import type { IStorageWrapper, IStorage } from '@kbn/kibana-utils-plugin/public';

const payload = { first: 'john', last: 'smith' };
const createMockStore = (): MockedKeys<IStorage> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Storage implements IStorageWrapper {
}
};

public set = (key: string, value: any, includeUndefined: boolean = false) => {
public set = (key: string, value: any, includeUndefined = false) => {
const replacer = includeUndefined
? (_: string, currentValue: any) =>
typeof currentValue === 'undefined' ? null : currentValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { DeepPartial } from 'utility-types';
import type { DeepPartial } from 'utility-types';
import MaybeMockedDeep = jest.MaybeMockedDeep;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

import { httpServiceMock } from '@kbn/core/public/mocks';
import { RuleTypeParams } from '../../types';
import type { RuleTypeParams } from '../../types';
import { createRule } from './create_rule';
import { CreateRuleBody } from './types';
import type { CreateRuleBody } from './types';

const http = httpServiceMock.createStartContract();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import type { HttpSetup } from '@kbn/core/public';
import type { AsApiContract } from '@kbn/actions-types';
import type { Rule } from '../../types';
import { CreateRuleBody, transformCreateRuleBody } from '.';
import type { CreateRuleBody } from '.';
import { transformCreateRuleBody } from '.';
import { BASE_ALERTING_API_PATH } from '../../../constants';
import { transformRule } from '../../transformations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { RewriteResponseCase } from '@kbn/actions-types';
import { CreateRuleBody } from './types';
import { Rule } from '../../types';
import type { RewriteResponseCase } from '@kbn/actions-types';
import type { CreateRuleBody } from './types';
import type { Rule } from '../../types';

const transformCreateRuleFlapping = (flapping: Rule['flapping']) => {
if (!flapping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Rule, RuleTypeParams } from '../../types';
import type { Rule, RuleTypeParams } from '../../types';

export interface CreateRuleBody<Params extends RuleTypeParams = RuleTypeParams> {
name: Rule<Params>['name'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { HttpSetup } from '@kbn/core/public';
import type { HttpSetup } from '@kbn/core/public';
import type { AsApiContract, RewriteRequestCase } from '@kbn/actions-types';
import type { RuleType } from '@kbn/triggers-actions-ui-types';
import { BASE_ALERTING_API_PATH } from '../../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import type { HttpStart } from '@kbn/core-http-browser';
import { BASE_TRIGGERS_ACTIONS_UI_API_PATH } from '../../../constants';
import { UiConfig } from '.';
import type { UiConfig } from '.';

export const fetchUiConfig = async ({ http }: { http: HttpStart }): Promise<UiConfig> => {
return http.get<UiConfig>(`${BASE_TRIGGERS_ACTIONS_UI_API_PATH}/_config`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { HttpSetup } from '@kbn/core-http-browser';
import { AsApiContract } from '@kbn/actions-types';
import type { HttpSetup } from '@kbn/core-http-browser';
import type { AsApiContract } from '@kbn/actions-types';
import { INTERNAL_BASE_ALERTING_API_PATH } from '../../../constants';
import { transformResolvedRule } from '../../transformations';
import { ResolvedRule } from '../../types';
import type { ResolvedRule } from '../../types';

export async function resolveRule({
http,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { RuleTypeParams } from '../../types';
import type { RuleTypeParams } from '../../types';
import { transformUpdateRuleBody } from './transform_update_rule_body';
import { UpdateRuleBody } from './types';
import type { UpdateRuleBody } from './types';

const ruleToUpdate: UpdateRuleBody<RuleTypeParams> = {
params: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { RewriteResponseCase } from '@kbn/actions-types';
import { UpdateRuleBody } from './types';
import { Rule } from '../../types';
import type { RewriteResponseCase } from '@kbn/actions-types';
import type { UpdateRuleBody } from './types';
import type { Rule } from '../../types';

const transformUpdateRuleFlapping = (flapping: Rule['flapping']) => {
if (!flapping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/

import { httpServiceMock } from '@kbn/core/public/mocks';
import { updateRule, UpdateRuleBody } from '.';
import type { UpdateRuleBody } from '.';
import { updateRule } from '.';

const http = httpServiceMock.createStartContract();

Expand Down
Loading