From c3e5d472fada01bb344ba00071f8de780e5a7a51 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:15:55 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- .../__tests__/transforms/transformElement.spec.ts | 8 ++------ packages/compiler-vapor/src/generators/component.ts | 7 ++----- packages/compiler-vapor/src/generators/event.ts | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts b/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts index 560d5dd76d4..b26f7c776f3 100644 --- a/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts @@ -389,9 +389,7 @@ describe('compiler: element transform', () => { ) expect(code).toMatchSnapshot() expect(code).contains(`onBar: () => _on_bar`) - expect(code).contains( - `const _on_bar = () => _ctx.handler`, - ) + expect(code).contains(`const _on_bar = () => _ctx.handler`) expect(ir.block.operation).toMatchObject([ { type: IRNodeTypes.CREATE_COMPONENT_NODE, @@ -445,9 +443,7 @@ describe('compiler: element transform', () => { `const _on_bar = $event => (_ctx.handleBar($event))`, ) expect(code).contains(`onBar: () => _on_bar1`) - expect(code).contains( - `const _on_bar1 = () => _ctx.handler`, - ) + expect(code).contains(`const _on_bar1 = () => _ctx.handler`) expect(ir.block.operation).toMatchObject([ { type: IRNodeTypes.CREATE_COMPONENT_NODE, diff --git a/packages/compiler-vapor/src/generators/component.ts b/packages/compiler-vapor/src/generators/component.ts index 36873ee00ee..c0a8fb8f4d6 100644 --- a/packages/compiler-vapor/src/generators/component.ts +++ b/packages/compiler-vapor/src/generators/component.ts @@ -54,7 +54,7 @@ export function genCreateComponent( const inlineHandlers: CodeFragment[] = handlers.reduce( (acc, { name, value }) => { // TODO should support .once modifier on component event - const handler = genEventHandler(context, value, undefined,false) + const handler = genEventHandler(context, value, undefined, false) return [...acc, `const ${name} = `, ...handler, NEWLINE] }, [], @@ -94,10 +94,7 @@ export function genCreateComponent( } } -function getUniqueHandlerName( - context: CodegenContext, - name: string -): string { +function getUniqueHandlerName(context: CodegenContext, name: string): string { const { seenInlineHandlerNames } = context const count = seenInlineHandlerNames[name] || 0 seenInlineHandlerNames[name] = count + 1 diff --git a/packages/compiler-vapor/src/generators/event.ts b/packages/compiler-vapor/src/generators/event.ts index d1057e81fe7..c0b7e1095ce 100644 --- a/packages/compiler-vapor/src/generators/event.ts +++ b/packages/compiler-vapor/src/generators/event.ts @@ -118,7 +118,7 @@ export function genEventHandler( handlerExp = genWithModifiers(context, handlerExp, nonKeys) if (keys.length) handlerExp = genWithKeys(context, handlerExp, keys) - if(needWrap) handlerExp.unshift(`() => `) + if (needWrap) handlerExp.unshift(`() => `) return handlerExp }