Skip to content

vue/no-unused-emit-declarations reporting with defineEmits() and defineModel() compiler marcos #2351

Closed as not planned
@n0099

Description

@n0099

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 8.56.0
  • eslint-plugin-vue version: 9.19.2
  • Node version: 21.4.0
  • Operating System: Windows 8.1

Please show your full configuration:

https://github.com/n0099/open-tbm/blob/1403ed2ffc75f200426def765ecb66142ed6c085/fe/.eslintrc.cjs

What did you do?

https://github.com/n0099/open-tbm/blob/1403ed2ffc75f200426def765ecb66142ed6c085/fe/src/components/Post/queryForm/widgets/InputNumericParam.vue#L22

defineEmits({
    'update:modelValue': (p: KnownNumericParams) =>
        _.isString(p.name) && _.isString(p.value)
        && numericParamSubParamRangeValues.includes(p.subParam.range)
});
const modelValue = defineModel<KnownNumericParams>({ required: true });

What did you expect to happen?
Not reporting since mutate the ref modelValue will emit the event update:modelValue under the hood.

What actually happened?

`update:modelValue` is defined as emit but never used.(vue/no-unused-emit-declarations)

Repository to reproduce this issue

https://github.com/n0099/open-tbm/blob/1403ed2ffc75f200426def765ecb66142ed6c085/fe

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