From 8a7e15460caf8118f8ac4f9fbd687045a0c96862 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Sun, 28 Sep 2025 10:15:00 +0800 Subject: [PATCH] chore: turn on ts/method-signature-style (#55167) --- components/message/interface.ts | 4 ++-- components/modal/useModal/index.tsx | 2 +- components/notification/interface.ts | 2 +- eslint.config.mjs | 1 - typings/jest.d.ts | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/components/message/interface.ts b/components/message/interface.ts index 3e014ef68b..fe9d4c54c5 100644 --- a/components/message/interface.ts +++ b/components/message/interface.ts @@ -70,6 +70,6 @@ export interface MessageInstance { error: TypeOpen; warning: TypeOpen; loading: TypeOpen; - open(args: ArgsProps): MessageType; - destroy(key?: React.Key): void; + open: (args: ArgsProps) => MessageType; + destroy: (key?: React.Key) => void; } diff --git a/components/modal/useModal/index.tsx b/components/modal/useModal/index.tsx index 3065169696..e737bbc019 100644 --- a/components/modal/useModal/index.tsx +++ b/components/modal/useModal/index.tsx @@ -16,7 +16,7 @@ interface ElementsHolderRef { // Add `then` field for `ModalFunc` return instance. export type ModalFuncWithPromise = (...args: Parameters) => ReturnType & { - then(resolve: (confirmed: boolean) => T, reject: VoidFunction): Promise; + then: (resolve: (confirmed: boolean) => T, reject: VoidFunction) => Promise; }; export type HookAPI = Omit, 'warn'>; diff --git a/components/notification/interface.ts b/components/notification/interface.ts index 36daa75a9b..1093ac6d91 100644 --- a/components/notification/interface.ts +++ b/components/notification/interface.ts @@ -49,7 +49,7 @@ export interface NotificationInstance { info: StaticFn; warning: StaticFn; open: StaticFn; - destroy(key?: React.Key): void; + destroy: (key?: React.Key) => void; } export interface GlobalConfigProps { diff --git a/eslint.config.mjs b/eslint.config.mjs index aa03be2297..6c200de815 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -33,7 +33,6 @@ export default antfu( 'ts/explicit-function-return-type': 'off', 'ts/ban-ts-comment': 'off', // TODO: remove this 'ts/consistent-type-definitions': 'off', - 'ts/method-signature-style': 'off', // TODO: remove this 'ts/no-non-null-asserted-optional-chain': 'off', 'unicorn/prefer-node-protocol': 'off', 'unicorn/prefer-includes': 'off', // TODO: remove this diff --git a/typings/jest.d.ts b/typings/jest.d.ts index 5db2d7b6c8..9ccf9d3082 100644 --- a/typings/jest.d.ts +++ b/typings/jest.d.ts @@ -1,5 +1,5 @@ declare namespace jest { interface Matchers { - toHaveNoViolations(): R; + toHaveNoViolations: () => R; } }