Skip to content

The rule vue/no-unused-properties does not check refs in the template #1195

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

Closed
danyadev opened this issue Jun 6, 2020 · 1 comment · Fixed by #1198
Closed

The rule vue/no-unused-properties does not check refs in the template #1195

danyadev opened this issue Jun 6, 2020 · 1 comment · Fixed by #1198
Labels

Comments

@danyadev
Copy link
Contributor

danyadev commented Jun 6, 2020

Tell us about your environment

  • ESLint version: 7.2.0
  • eslint-plugin-vue version: 7.0.0-alpha.5
  • Node version: v12.16.3

Please show your full configuration:

module.exports = {
  root: true,

  parserOptions: {
    sourceType: 'module'
  },

  env: {
    browser: true,
    node: true,
    es2020: true
  },

  plugins: ['import'],

  settings: {
    'import/resolver': 'webpack',
    'import/ignore': []
  },

  extends: ['plugin:vue/vue3-recommended'],

  rules: {
    // *eslint rules*
    // *import rules*
    // *other vue rules*

    'vue/no-unused-properties': ['error', {
      groups: ['props', 'setup']
    }]
  }
};

What did you do?

<template>
  <div ref="divRef">foo</div>
</template>

<script>
import { ref, onMounted } from 'vue';

export default {
  setup() {
    const divRef = ref(null);

    onMounted(() => {
      console.log(divRef);
    });

    return {
      divRef
    };
  }
};
</script>

What did you expect to happen?
No errors

What actually happened?

17:7  error  'divRef' of property returned from `setup()` found, but never used  vue/no-unused-properties
@danyadev danyadev changed the title vue/no-unused-properties didn't check refs in template The rule vue/no-unused-properties does not check refs in the template Jun 6, 2020
@ota-meshi
Copy link
Member

Thank you for reporting these.

I will check and fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants