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 601c1fc722..b0ce043038 100644 --- a/packages/eslint-plugin-antfu/src/rules/top-level-function.ts +++ b/packages/eslint-plugin-antfu/src/rules/top-level-function.ts @@ -48,8 +48,8 @@ export default createEslintRule({ context.report({ node, loc: { - start: node.loc.start, - end: node.loc.end, + start: id.loc.start, + end: body.loc.start, }, messageId: 'topLevelFunctionDeclaration', fix(fixer) {