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

no-undef-properties does not take into account second <script> section #2515

Open
2 tasks done
andreww2012 opened this issue Jul 26, 2024 · 0 comments
Open
2 tasks done

Comments

@andreww2012
Copy link

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-plugin-vue version: 9.27.0

What did you do?

If both <script setup> and regular <script> sections are present, the latter will be ignored by no-undef-properties rule. To reproduce, go the rule's page on the website and paste the following snippet in the editor:

<template>
  <!-- ✓ GOOD -->
  <div>{{ name }}: {{ count }}</div>
  <!-- ✗ BAD -->
  <div>{{ label }}: {{ cnt }}</div>

  <!-- From <script>: -->
  {{ myComputed }}
</template>

<script>
export default {
  computed: {
    myComputed() {
      return 'any';
    },
  },
};
</script>

<script setup>
const prop = defineProps(['name', 'def'])
let count = 0

/* ✓ GOOD */
watch(() => prop.def, () => console.log('Updated!'))

/* ✗ BAD */
watch(() => prop.undef, () => console.log('Updated!'))
</script>

If you then remove <script setup> section, myComputed will be recognized.

What did you expect to happen?

Properties from both <script setup> and <script> sections are recognized by this rule.

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

No branches or pull requests

1 participant