Skip to content

Default Nuxt 4 project with ESLint fails to parse defineEmits in <script setup lang="ts"> #622

@ineptchan

Description

@ineptchan

Environment

  • Operating System: Windows_NT
  • Node Version: v22.18.0
  • Nuxt Version: 4.1.3
  • CLI Version: 3.29.3
  • Nitro Version: 2.12.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Package

None

Reproduction

Create a new clean project and select only @nuxt/eslint module

pnpm create nuxt@latest nuxt_test

√ Installation completed.                                                                                nuxi 17:10:24
undefined
√ Initialize git repository?
undefined No
undefined
√ Would you like to install any of the official modules?
undefined Yes
undefined
√ Pick the modules to install:
undefined @nuxt/eslint – Project-aware, easy-to-use, extensible and future-proof ESLint integration

Create a Vue component components/Test.vue

<template>
    <div>

    </div>
</template>
<script lang="ts" setup>
const emit = defineEmits<{
    change: [id: number]
    update: [value: string]
}>()
//or
const emit = defineEmits<{
    (e: 'change', id: number): void
    (e: 'update', value: string): void
}>()
</script>

Describe the bug

In a fresh Nuxt 4 project generated via pnpm create nuxt@latest,
using defineEmits inside <script setup lang="ts"> triggers an ESLint parsing error:

Parsing error: Unexpected token

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions