Skip to content

vue/use-v-on-exact - false positive on multiple @keydown.* attributes #2455

Open
@petrkotek

Description

@petrkotek

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.57.0
  • eslint-plugin-vue version: 9.25.0
  • Vue version: 3.4.23
  • Node version: v20.11.1
  • Operating System: macOS 12.7.4 (21H1123)

Please show your full configuration:

/* eslint-env node */
module.exports = {
  root: true,
  'extends': [
    'plugin:vue/vue3-essential',
    'eslint:recommended'
  ],
  parserOptions: {
    ecmaVersion: 'latest'
  }
}

What did you do?

<script lang="ts">
export default {
  methods: {
    save(): void {}
  }
}
</script>

<template>
  <!-- OK -->
  <input @keydown.ctrl.enter.exact="save()" />
  <!-- OK -->
  <input @keydown.stop />
  <!-- ERROR - Fails with vue/use-v-on-exact -> Consider to use '.exact' modifier on the @keydown.stop line -->
  <input
    @keydown.ctrl.enter.exact="save()"
    @keydown.stop
  />
</template>

What did you expect to happen?
I expected that @keydown.stop is OK to use and doesn't need .exact modifier.

What actually happened?

vue/use-v-on-exact returned an error that .exact should be used - on the @keydown.stop line.

$ npm run lint

> vue-project@0.0.0 lint
> eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore


/<redacted>/bugreports/vue-project/src/components/HelloWorld.vue
  17:5  error  Consider to use '.exact' modifier  vue/use-v-on-exact

✖ 1 problem (1 error, 0 warnings)

Repository to reproduce this issue
https://github.com/petrkotek/bugreports (See https://github.com/petrkotek/bugreports/blob/main/vue-project/src/components/HelloWorld.vue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions