我的 Vue SPA 的 linting 存在问题。我正在使用脚本设置语法糖(https://v3.vuejs.org/api/sfc-script-setup.html)中的defineEmits函数。这些错误没有任何意义,有谁知道如何解决这个问题(无需为受影响的文件禁用这些规则,因为它发生在定义Emits的每次使用中)。奇怪的是,defineProps 函数运行时没有错误,它遵循相同的语法。有人可以帮我从这里出去吗?
我的 linter 抱怨这些错误:
22:14 error Unexpected space between function name and paren no-spaced-func
22:27 error Unexpected whitespace between function name and paren func-call-spacing
23:3 error 'e' is defined but never used no-unused-vars
23:27 error 'value' is defined but never used no-unused-vars
Run Code Online (Sandbox Code Playgroud)
生成这些错误的代码(defineEmits 是所有错误的来源:
<script lang="ts" setup>
const emit = defineEmits<{
(e: 'update:modelValue', value: string): void
}>()
defineProps<{
modelValue: string
name: string
items: string[]
}>()
const onInput = (e: Event) => { …Run Code Online (Sandbox Code Playgroud)