eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

`vue/no-unused-properties` does not work with `defineNuxtComponent()`

Open uralogical opened this issue 2 years ago • 3 comments

Checklist

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

Tell us about your environment

  • ESLint version: 8.41.0
  • eslint-plugin-vue version: 9.14.0
  • Node version: 18
  • Operating System: MacOS 13.3.1 (a)(22E772610a)

Please show your full configuration:

module.exports = {
  extends: [
    "plugin:vue/vue3-recommended",
  ],
  rules: {
    "vue/no-unused-properties": [
      "error",
      {
        groups: ["props", "data", "computed", "methods"],
        deepData: false,
        ignorePublicMembers: false,
      },
    ],
  },
};

What did you do?

<template>
  <div>
    <span>Hello</span>
  </div>
</template>

<script lang="ts">
export default defineNuxtComponent({
  name: 'App',
  data() {
    return {
      msg: 'Welcome to Nuxt3', // This data is not used.
    };
  },
});
</script>

What did you expect to happen? Data msg should be warned like below. This warning is shown without defineNuxtComponent.

スクリーンショット 2023-05-25 21 34 25

It seems to be rerated to https://github.com/vuejs/eslint-plugin-vue/issues/2057.

What actually happened? No warning is shown.

Repository to reproduce this issue https://github.com/uralogical/nuxt3_playground feat/add_eslint is reproduction branch.

uralogical avatar May 25 '23 12:05 uralogical

defineNuxtComponent is not yet supported. We might add this for v10, see #2166.

FloEdelmann avatar May 25 '23 13:05 FloEdelmann

FWIW, I'm using this for now:

import { defineNuxtComponent as defineComponent } from '#imports'

export default defineComponent({
  ...
})

IlyaSemenov avatar Jun 10 '23 18:06 IlyaSemenov

my workaround https://github.com/vuejs/eslint-plugin-vue/pull/2311

sugitata avatar Nov 13 '23 03:11 sugitata