Skip to content

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

Closed
@FloEdelmann

Description

@FloEdelmann

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/45508de7c812e9e4d9a55c9517d969c6606d53fd/ui/components/global/OflTime.vue

Related issue: #1669

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions