Skip to content

Commit d408844

Browse files
authored
chore: turn on no-unsafe-function-type eslint rule (kyma-project#4437)
1 parent 4cdff68 commit d408844

File tree

16 files changed

+36
-35
lines changed

16 files changed

+36
-35
lines changed

src/command-pallette/CommandPalletteUI/CommandPaletteSearchBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import './CommandPaletteSearchBar.scss';
1414
type CommandPaletteSearchBarProps = {
1515
slot?: string;
1616
shouldFocus?: boolean;
17-
setShouldFocus?: Function;
17+
setShouldFocus?: (_: boolean) => void;
1818
shellbarRef?: RefObject<HTMLElement>;
1919
};
2020

src/command-pallette/CommandPalletteUI/handlers/clusterResourceHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ async function fetchClusterResources(context: CommandPaletteContext) {
123123
function sendNamespaceSwitchMessage(
124124
newNamespace: string,
125125
activeClusterName: string,
126-
navigate: Function,
126+
navigate: (_: string) => void,
127127
) {
128128
const matchedRoute =
129129
matchPath(

src/command-pallette/CommandPalletteUI/handlers/crHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function navigateTo({
8585
}: {
8686
matchingNode?: NavNode;
8787
namespace: string | null;
88-
navigate: Function;
88+
navigate: (_: string) => void;
8989
activeClusterName: string;
9090
crd: CustomResourceDefinition;
9191
crName?: string;

src/command-pallette/CommandPalletteUI/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TFunction } from 'react-i18next';
1+
import { TFunction } from 'i18next';
22
import { NavNode } from 'state/types';
33
import { useClustersInfoType } from 'state/utils/getClustersInfo';
44
import { K8sResource } from 'types';
@@ -23,7 +23,7 @@ export type CommandPaletteContext = {
2323
setOpenPreferencesModal: (open: boolean) => void;
2424
setShowYamlUpload: (show: boolean) => void;
2525
clustersInfo: useClustersInfoType;
26-
navigate: Function;
26+
navigate: (_: string) => void;
2727
};
2828

2929
type CRHelpEntries = {

src/components/KymaCompanion/components/Chat/CodePanel/CodePanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ interface CodePanelProps {
8282
language: string;
8383
withAction?: boolean;
8484
link?: CodeSegmentLink | null;
85-
fetchFn?: Function;
85+
fetchFn?: (_: string) => boolean;
8686
}
8787

8888
export default function CodePanel({

src/components/KymaCompanion/components/Chat/chatHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export const parseParams = (url: string, resource: string) => {
246246
export const useDoesNamespaceExist = (
247247
url: string,
248248
resource: string,
249-
fetchFn?: Function,
249+
fetchFn?: (_: string) => boolean,
250250
) => {
251251
const fetch = useFetch();
252252

@@ -299,7 +299,7 @@ export const useDoesNamespaceExist = (
299299
export const useDoesResourceExist = (
300300
url: string,
301301
resource: string,
302-
fetchFn?: Function,
302+
fetchFn?: (_: string) => boolean,
303303
) => {
304304
const fetch = useFetch();
305305
const { parsedResource, namespace } = parseParams(url, resource);

src/components/Modules/community/CommunityModulesAddModule.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { UnsavedMessageBox } from 'shared/components/UnsavedMessageBox/UnsavedMe
4646
import { createPortal } from 'react-dom';
4747
import { Description } from 'shared/components/Description/Description';
4848
import { CommunityModulesSourcesList } from './components/CommunityModulesSourcesList';
49+
import { TFunction } from 'i18next';
4950

5051
type VersionDisplayInfo = {
5152
moduleTemplate: {
@@ -130,7 +131,7 @@ function transformDataForDisplay(
130131
}
131132

132133
async function upload(
133-
t: Function,
134+
t: TFunction,
134135
communityModulesTemplatesToUpload: { map: Map<string, ModuleTemplateType> },
135136
setModulesTemplatesToUpload: React.Dispatch<
136137
SetStateAction<{ map: Map<string, ModuleTemplateType> }>
@@ -139,7 +140,7 @@ async function upload(
139140
namespaceNodes: any,
140141
postRequest: PostFn,
141142
patchRequest: MutationFn,
142-
singleGet: Function,
143+
singleGet: (_: any) => Promise<Response>,
143144
notification: NotificationContextArgs,
144145
callback: CallbackFn,
145146
) {

src/components/Modules/community/CommunityModulesEdit.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { ModuleTemplatesContext } from 'components/Modules/providers/ModuleTempl
3333

3434
import 'components/Modules/community/CommunityModule.scss';
3535
import { SetStateAction, useSetAtom } from 'jotai';
36+
import { TFunction } from 'i18next';
3637

3738
const isModuleInstalled = (
3839
foundModuleTemplate: ModuleTemplateType,
@@ -98,10 +99,10 @@ function onVersionChange(
9899
}
99100

100101
function onSave(
101-
uploadResources: Function,
102-
setIsResourceEdited: Function,
102+
uploadResources: () => void,
103+
setIsResourceEdited: (_: any) => void,
103104
notification: NotificationContextArgs,
104-
t: Function,
105+
t: TFunction,
105106
) {
106107
return () => {
107108
try {
@@ -124,7 +125,6 @@ function onSave(
124125

125126
function transformDataForDisplay(
126127
availableCommunityModules: Map<string, VersionInfo[]>,
127-
t: Function,
128128
): ModuleDisplayInfo[] {
129129
return Array.from(availableCommunityModules, ([moduleName, versions]) => {
130130
return {
@@ -205,7 +205,6 @@ export default function CommunityModulesEdit() {
205205

206206
const communityModulesToDisplay = transformDataForDisplay(
207207
availableCommunityModules,
208-
t,
209208
);
210209

211210
if (isCommunityModulesEnabled) {

src/components/Modules/community/communityModulesHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export async function postForCommunityResources(post: PostFn, link: string) {
178178

179179
export async function fetchResourcesToApply(
180180
communityModulesToApply: Map<string, ModuleTemplateType>,
181-
setResourcesToApply: Function,
181+
setResourcesToApply: (_: { value: any }[]) => void,
182182
post: PostFn,
183183
) {
184184
const resourcesLinks = [...communityModulesToApply.values()]

src/components/Modules/community/communityModulesInstallHelpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function installCommunityModule(
2121
namespaceNodes: any,
2222
postRequest: PostFn,
2323
patchRequest: MutationFn,
24-
singleGet: Function,
24+
singleGet: (_: string) => any,
2525
callback: CallbackFn,
2626
) {
2727
try {
@@ -95,7 +95,7 @@ async function uploadResources(
9595
namespaceNodes: any,
9696
postRequest: PostFn,
9797
patchRequest: MutationFn,
98-
singleGet: Function,
98+
singleGet: (_: string) => any,
9999
kindFilter?: string,
100100
): Promise<any[]> {
101101
let resourcesToUpload: any[] = resources;
@@ -133,7 +133,7 @@ async function uploadResource(
133133
namespaceNodes: any,
134134
post: PostFn,
135135
patchRequest: MutationFn,
136-
singleGet: Function,
136+
singleGet: (_: string) => any,
137137
) {
138138
const url = await getUrl(
139139
resource.value,
@@ -167,7 +167,7 @@ async function uploadResource(
167167

168168
async function checkIfResourceExist(
169169
url: string,
170-
singleGet: Function,
170+
singleGet: (_: string) => any,
171171
): Promise<any> {
172172
try {
173173
const response = await singleGet(url);

0 commit comments

Comments
 (0)