From e9193343e806e79aa4e7836b0075494102a3ea25 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 30 Mar 2023 10:53:36 +0200 Subject: [PATCH] chore: format --- .../src/rules/top-level-function.test.ts | 6 +++--- .../eslint-plugin-antfu/src/rules/top-level-function.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin-antfu/src/rules/top-level-function.test.ts b/packages/eslint-plugin-antfu/src/rules/top-level-function.test.ts index e975e45..06c671b 100644 --- a/packages/eslint-plugin-antfu/src/rules/top-level-function.test.ts +++ b/packages/eslint-plugin-antfu/src/rules/top-level-function.test.ts @@ -26,7 +26,7 @@ const invalids = [ ], [ 'const foo = (as: string, bar: number): Omit => as + bar', - 'function foo (as: string, bar: number): Omit { return as + bar }', + 'function foo (as: string, bar: number): Omit {\n return as + bar\n}', ], [ 'export const foo = () => {}', @@ -34,11 +34,11 @@ const invalids = [ ], [ 'export const foo = () => ({})', - 'export function foo () { return {} }', + 'export function foo () {\n return {}\n}', ], [ 'export const foo = async () => ({})', - 'export async function foo () { return {} }', + 'export async function foo () {\n return {}\n}', ], ] diff --git a/packages/eslint-plugin-antfu/src/rules/top-level-function.ts b/packages/eslint-plugin-antfu/src/rules/top-level-function.ts index 0986f4a..601c1fc 100644 --- a/packages/eslint-plugin-antfu/src/rules/top-level-function.ts +++ b/packages/eslint-plugin-antfu/src/rules/top-level-function.ts @@ -60,7 +60,7 @@ export default createEslintRule({ : '' const textBody = body.type === 'BlockStatement' ? code.slice(body.range[0], body.range[1]) - : `{ return ${code.slice(body.range[0], body.range[1])} }` + : `{\n return ${code.slice(body.range[0], body.range[1])}\n}` const textGeneric = arrowFn.typeParameters ? code.slice(arrowFn.typeParameters.range[0], arrowFn.typeParameters.range[1]) : ''