The Wayback Machine - https://web.archive.org/web/20201016235219/https://github.com/vuejs/eslint-plugin-vue/issues/1312
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

`vue/no-unused-properties` does not recognize props in functional component (Vue 2) #1312

Open
FloEdelmann opened this issue Oct 2, 2020 · 1 comment
Labels

Comments

@FloEdelmann
Copy link
Contributor

@FloEdelmann FloEdelmann commented Oct 2, 2020

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: 7.10.0
  • eslint-plugin-vue version: 7.0.0
  • Node version: 12.18.4
  • Operating System: Ubuntu 20.04

Please show your full configuration:

{
  "env": {
    "es6": true,
    "node": true
  },
  "parserOptions": {
    "ecmaVersion": 2017
  },
  "plugins": ["vue"],
  "extends": ["plugin:vue/recommended"],
  "rules": {
    "vue/no-unused-properties": ["error", {
      "groups": ["props", "data", "computed", "methods", "setup"]
    }]
  }
}

What did you do?

<template functional>
  <time :datetime="props.date.toISOString()" :title="props.date.toISOString()">{{
    props.date.toISOString().replace(/T.*?$/, ``)
  }}</time>
</template>

<script>
export default {
  props: {
    date: {
      type: Date,
      required: true,
    },
  },
};
</script>

What did you expect to happen?
No error, since the date prop is used inside the template.

What actually happened?

error: 'date' of property found, but never used (vue/no-unused-properties) at ui/components/global/OflTime.vue:10:5:
   8 | export default {
   9 |   props: {
> 10 |     date: {
     |     ^
  11 |       type: Date,
  12 |       required: true,
  13 |     },

Repository to reproduce this issue
https://github.com/OpenLightingProject/open-fixture-library/blob/master/ui/components/global/OflTime.vue

@arrudaje
Copy link

@arrudaje arrudaje commented Oct 7, 2020

@ota-meshi that's weird, I ran this exact piece of code through the test pipeline and it passed (I had to remove the replace(/T.*?$/, '') bit because it was not recognising the syntax), but when I included it in a real project in my IDE it marked it as invalid.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.