vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.4k stars 658 forks source link

`vue/require-explicit-slots` doesn't recognize interface passed to the macro #2398

Open Ky6uk opened 5 months ago

Ky6uk commented 5 months ago

Tell us about your environment

Please show your full configuration:

module.exports = {
  parser: 'vue-eslint-parser',

  parserOptions: {
    parser: '@typescript-eslint/parser',
  },

  extends: ['plugin:vue/base'],

  rules: {
    'vue/require-explicit-slots': 'error',
  },
};

What did you do?

<template>
  <div>
    <slot />
  </div>
</template>

<script lang="ts" setup>
interface Slots {
  default: () => string;
}

defineSlots<Slots>();
</script>

What did you expect to happen? No error reported.

What actually happened?

test.vue
  3:5  error  Slots must be explicitly defined  vue/require-explicit-slots

✖ 1 problem (1 error, 0 warnings)

Repository to reproduce this issue https://stackblitz.com/edit/stackblitz-starters-reg1dy?file=test.vue

~$ npm run lint
Ky6uk commented 3 months ago

Updated packages to the latest version.

daniluk4000 commented 3 months ago

Same with this generic

image

sanderdewinter commented 1 week ago

I just opened #2484, feel free to contribute