Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typescript-eslint to v6 (main) - autoclosed #173233

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ module.exports = {
rules: {
'import/no-nodejs-modules': 'error',
'no-duplicate-imports': 'off',
'@typescript-eslint/no-duplicate-imports': ['error'],
'import/no-duplicates': ['error'],
'no-restricted-imports': [
'error',
{
Expand Down Expand Up @@ -1216,7 +1216,7 @@ module.exports = {
'require-atomic-updates': 'error',
'symbol-description': 'error',
'vars-on-top': 'error',
'@typescript-eslint/no-duplicate-imports': ['error'],
'import/no-duplicates': ['error'],
},
overrides: [
{
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
"**/@hello-pangea/dnd": "16.2.0",
"**/@langchain/core": "0.1.53",
"**/@types/node": "20.10.5",
"**/@typescript-eslint/utils": "5.62.0",
"**/axios": "1.6.3",
"**/@typescript-eslint/utils": "7.7.1",
"**/chokidar": "^3.5.3",
"**/follow-redirects": "1.15.2",
"**/globule/minimatch": "^3.1.2",
Expand Down Expand Up @@ -1539,9 +1538,9 @@
"@types/yauzl": "^2.9.1",
"@types/yazl": "^2.4.2",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/typescript-estree": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@typescript-eslint/typescript-estree": "^7.7.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
"@yarnpkg/lockfile": "^1.1.0",
"abab": "^2.0.4",
Expand Down Expand Up @@ -1585,7 +1584,7 @@
"ejs": "^3.1.8",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.2",
"eslint": "^8.46.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-ban": "^1.6.0",
"eslint-plugin-cypress": "^2.15.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-ambient-ftr-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ declare namespace Mocha {
*
* @see https://mochajs.org/api/Runnable.html#currentRetry
*/
protected currentRetry(): number;
currentRetry(): number;

/**
* Set or get current retry
*
* @see https://mochajs.org/api/Runnable.html#currentRetry
*/
protected currentRetry(n: number): void;
currentRetry(n: number): void;

/**
* Return the full title generated by recursively concatenating the parent's full title.
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-eslint-config/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ module.exports = {
match: false
}
},
{
selector: 'import',
format: ['camelCase', 'PascalCase']
},
{
selector: 'variable',
format: [
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-eslint-plugin-eslint/rules/no_export_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
create: (context) => {
return {
ExportAllDeclaration(node) {
const services = /** @type ParserServices */ (context.parserServices);
const services = /** @type ParserServices */ (context.sourceCode.parserServices);
const esNode = /** @type EsTreeExportAllDeclaration */ (node);
const tsnode = /** @type ExportDeclaration */ (services.esTreeNodeToTSNodeMap.get(esNode));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ let importResolverCache: ImportResolver | undefined;
*/
export function getImportResolver(context: Rule.RuleContext): ImportResolver {
if (RUNNING_IN_EDITOR) {
return (context.parserServices.kibanaImportResolver ||= ImportResolver.create(REPO_ROOT));
return (context.sourceCode.parserServices.kibanaImportResolver ||=
ImportResolver.create(REPO_ROOT));
}

return (importResolverCache ||= ImportResolver.create(REPO_ROOT));
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = {
transformIgnorePatterns: [
// ignore all node_modules except monaco-editor, monaco-yaml and react-monaco-editor which requires babel transforms to handle dynamic import()
// since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842)
'[/\\\\]node_modules(?![\\/\\\\](byte-size|monaco-editor|monaco-yaml|monaco-languageserver-types|monaco-marker-data-provider|monaco-worker-manager|vscode-languageserver-types|react-monaco-editor|d3-interpolate|d3-color|langchain|langsmith|@cfworker|gpt-tokenizer|flat|@langchain))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](ts-api-utils|byte-size|monaco-editor|monaco-yaml|monaco-languageserver-types|monaco-marker-data-provider|monaco-worker-manager|vscode-languageserver-types|react-monaco-editor|d3-interpolate|d3-color|langchain|langsmith|@cfworker|gpt-tokenizer|flat|@langchain))[/\\\\].+\\.js$',
'packages/kbn-pm/dist/index.js',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|@langchain))/dist/[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|@langchain))/dist/util/[/\\\\].+\\.js$',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
* 2.0.
*/
import type { IEmbeddable } from '@kbn/embeddable-plugin/public';
import type { LensSavedObjectAttributes } from '@kbn/lens-plugin/public';
import { LENS_EMBEDDABLE_TYPE, type Embeddable as LensEmbeddable } from '@kbn/lens-plugin/public';
import type {
LensSavedObjectAttributes,
LENS_EMBEDDABLE_TYPE,
type Embeddable as LensEmbeddable,
} from '@kbn/lens-plugin/public';
import { LENS_ATTACHMENT_TYPE } from '../../../../common/constants/visualizations';
import type { PersistableStateAttachmentPayload } from '../../../../common/types/domain';
import { AttachmentType } from '../../../../common/types/domain';
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/osquery/public/agents/agent_grouper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ describe('AgentGrouper', () => {
agentGrouper.setTotalAgents(100);
const groups = agentGrouper.generateOptions();

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const allGroup = groups[AGENT_GROUP_KEY.All].options![0];
expect(allGroup.label).toEqual(ALL_AGENTS_LABEL);
const size: number = (allGroup.value as GroupOptionValue).size;
Expand All @@ -99,7 +98,6 @@ describe('AgentGrouper', () => {
expect(options).toBeTruthy();

data.forEach((datum, i) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const opt = options![i];
expect(opt.label).toEqual(`test ${dataName} ${i} (${datum.id})`);
expect(opt.key).toEqual(datum.id);
Expand Down Expand Up @@ -130,7 +128,6 @@ describe('AgentGrouper', () => {
const options = groups[0].options;
expect(options).toBeTruthy();
agentData.forEach((ag, i) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const opt = options![i];
expect(opt.label).toEqual(
`${ag.local_metadata.host.hostname} (${ag.local_metadata.elastic.agent.id})`
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/osquery/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,5 @@ export class OsqueryPlugin implements Plugin<OsqueryPluginSetup, OsqueryPluginSt
};
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
public stop() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class OsqueryAppContextService {
this.fleetActionsClient = dependencies.createFleetActionsClient?.('osquery');
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
public stop() {}

public getAgentService(): AgentService | undefined {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/osquery/server/lib/telemetry/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class OsqueryTelemetryTask {
state: updatedState,
};
},
// eslint-disable-next-line @typescript-eslint/no-empty-function

cancel: async () => {},
};
},
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/osquery/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class OsqueryPlugin implements Plugin<OsqueryPluginSetup, OsqueryPluginSt
...plugins.fleet,
ruleRegistryService: plugins.ruleRegistry,
// @ts-expect-error update types
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

config: this.config!,
logger: this.logger,
registerIngestCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

import type { ProductLine } from './configs';
import { setupActiveSections, updateActiveSections } from './helpers';
import type { ExpandedCardSteps, ReducerActions } from './types';
import { type CardId, type StepId, type TogglePanelReducer, OnboardingActions } from './types';
import type {
ExpandedCardSteps,
ReducerActions,
type CardId,
type StepId,
type TogglePanelReducer,
OnboardingActions,
} from './types';

export const reducer = (state: TogglePanelReducer, action: ReducerActions): TogglePanelReducer => {
if (action.type === OnboardingActions.ToggleProduct) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*/
import React from 'react';

import type { Step, StepId } from './types';
import {
import type {
Step,
StepId,
SectionId,
QuickStartSectionCardsId,
OverviewSteps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* 2.0.
*/
import { renderHook } from '@testing-library/react-hooks';
import type { UseInsightDataProvidersProps, Provider } from './use_insight_data_providers';
import type { TimelineEventsDetailsItem } from '../../../../../../common/search_strategy';
import {
import type {
UseInsightDataProvidersProps,
Provider,
useInsightDataProviders,
type UseInsightDataProvidersResult,
} from './use_insight_data_providers';
import type { TimelineEventsDetailsItem } from '../../../../../../common/search_strategy';
import { mockAlertDetailsData } from '../../../event_details/__mocks__';

const mockAlertDetailsDataWithIsObject = mockAlertDetailsData.map((detail) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* 2.0.
*/

import type { ReactElement, ReactNode } from 'react';
import React, { type VFC, useMemo, useCallback } from 'react';
import React, type { ReactElement, ReactNode , type VFC, useMemo, useCallback } from 'react';
import { type Criteria, EuiBasicTable, formatDate } from '@elastic/eui';
import { Severity } from '@kbn/securitysolution-io-ts-alerting-types';
import type { Filter } from '@kbn/es-query';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import { EuiAccordion, EuiFlexGroup, EuiSpacer, EuiTitle, useGeneratedHtmlId } from '@elastic/eui';
import type { EuiFlexGroupProps } from '@elastic/eui';
import type { ReactElement } from 'react';
import React, { type VFC } from 'react';
import React, type { ReactElement , type VFC } from 'react';
import { useAccordionState } from '../hooks/use_accordion_state';

export const HEADER_TEST_ID = 'Header';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
isActionType,
isAgentType,
} from '../../../../../common/endpoint/service/response_actions/type_guards';
import type { ResponseActionType } from '../../../../../common/endpoint/service/response_actions/constants';
import {
import type {
ResponseActionType,
type ConsoleResponseActionCommands,
RESPONSE_ACTION_API_COMMANDS_NAMES,
RESPONSE_ACTION_STATUS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { EuiEmptyPrompt, EuiFlexItem } from '@elastic/eui';
import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import type { ResponseActionAgentType } from '../../../../common/endpoint/service/response_actions/constants';
import {
import type {
ResponseActionAgentType,
RESPONSE_CONSOLE_COMMAND_TO_API_COMMAND_MAP,
type ResponseActionsApiCommandNames,
type ResponseActionStatus,
Expand Down
Loading