Skip to content

vue/no-shadow false positive in double script block #1800

Open
@sqal

Description

@sqal

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.9.0
  • eslint-plugin-vue version: 8.4.1
  • Node version:
  • Operating System:

Please show your full configuration:

module.exports = {
  extends: [
    'plugin:vue/vue3-recommended',
  ],
  rules: {
    'no-shadow': 'error',
  },
};

What did you do?

<script>
  export function useModal() {
    const close = () => {}

    return { close }
  }
</script>

<script setup>
  function close() {

  }
</script>

<template>
  <Modal @close="close"></Modal>
</template>

What did you expect to happen?
No errors reported for the no-shadow rule.

What actually happened?

[3:11]: 'close' is already declared in the upper scope on line 10 column 12. (no-shadow)

Repository to reproduce this issue

Online Playground

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