Skip to content

Commit 4577232

Browse files
authored
fix: lint issue in generated swr/tanstack hooks (#877)
1 parent baed462 commit 4577232

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/plugins/swr/src/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ function generateMutation(
383383
`const mutation = request.useModelMutation('${model.name}', '${method}', '${operation}', metadata, options, ${checkReadBack});`,
384384
`return {
385385
...mutation,
386-
trigger<T extends ${argsType}>(args: ${genericInputType}) {
386+
trigger: <T extends ${argsType}>(args: ${genericInputType}) => {
387387
return mutation.trigger(args, options as any) as Promise<${genericReturnType}>;
388388
}
389389
};`,

packages/plugins/tanstack-query/src/generator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ function generateMutationHook(
210210
name: 'mutation',
211211
initializer: `{
212212
..._mutation,
213-
async mutateAsync<T extends ${argsType}>(
213+
mutateAsync: async <T extends ${argsType}>(
214214
args: Prisma.SelectSubset<T, ${argsType}>,
215215
options?: ${optionsType}
216-
) {
216+
) => {
217217
return (await _mutation.mutateAsync(
218218
args,
219219
options as any
@@ -236,10 +236,10 @@ function generateMutationHook(
236236
name: 'mutation',
237237
initializer: `derived(_mutation, value => ({
238238
...value,
239-
async mutateAsync<T extends ${argsType}>(
239+
mutateAsync: async <T extends ${argsType}>(
240240
args: Prisma.SelectSubset<T, ${argsType}>,
241241
options?: ${optionsType}
242-
) {
242+
) => {
243243
return (await value.mutateAsync(
244244
args,
245245
options as any

0 commit comments

Comments
 (0)