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

"vue/no-unused-properties" work incorrect with useVModels from "@vueuse/core"

Open galsim opened this issue 3 years ago • 4 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.22.0
  • eslint-plugin-vue version: ^9.3.0
  • Node version: v16.17.1
  • Operating System: macOS 13.0.1

Please show your full configuration:

/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
  root: true,
  'extends': [
    'plugin:vue/vue3-essential',
    'eslint:recommended',
    '@vue/eslint-config-typescript'
  ],
  parserOptions: {
    ecmaVersion: 'latest'
  },
  rules: {
    "vue/no-unused-properties": ["error", {
      "groups": ["setup", "props"],
    }]
  }
}

What did you do?

<script lang="ts">
import { defineComponent } from 'vue'
import { useVModels } from '@vueuse/core'

export default defineComponent({
  props: {
    msg: {
      type: String,
      required: true
    }
  },
  setup(props,{ emit }) {
    const {
      msg: msgModel
    } = useVModels(props, emit)

    return {
      msgModel
    }
  }
})
</script>

What did you expect to happen? I expected no eslint errors, because I use msg props through useVModels

What actually happened? image

Repository to reproduce this issue https://github.com/galsim/no-unused-properties-use-v-models

galsim avatar Dec 14 '22 07:12 galsim

I don't think we should support this specific function from VueUse. But we should probably consider all props used when they are passed to a function that is not declared in the same file.

FloEdelmann avatar Jan 02 '23 21:01 FloEdelmann

Any updates here?

galsim avatar Sep 07 '23 08:09 galsim