Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require-explicit-slots reports on slots with dynamic names #2589

Closed
2 tasks done
andreww2012 opened this issue Nov 1, 2024 · 0 comments · Fixed by #2591
Closed
2 tasks done

require-explicit-slots reports on slots with dynamic names #2589

andreww2012 opened this issue Nov 1, 2024 · 0 comments · Fixed by #2591

Comments

@andreww2012
Copy link

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: 9.13.0
  • eslint-plugin-vue version: 9.30.3
  • Vue version: 3.5.12
  • Node version:
  • Operating System:

What did you do?

Hello! vue/require-explicit-slots reports on slots with dynamic names. Paste the following code on the rule page:

<template>
  <div>
    <slot :name="`${hello} ${world}`"></slot>

    <slot :name="'foo'"></slot>
  </div>
</template>

<script setup lang="ts">
const hello = 'hello';
const world = 'world';

defineSlots<{
  foo: () => unknown;
}>();
</script>

(Obviously, I don't expect the second slot not be reported - I just decided to test both options)

I think that either (A) such slots should just be ignored or (B) the rule should require the presence of something like {[K in string]: () => unknown;} in defineSlots (although the intersections & are not recognized at this moment).

What did you expect to happen?

What actually happened?

Repository to reproduce this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant