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

Feature Request: make vue/no-undef-components works in Vue class component #2546

Closed
ylc395 opened this issue Sep 5, 2024 · 5 comments
Closed

Comments

@ylc395
Copy link
Contributor

ylc395 commented Sep 5, 2024

What rule do you want to change?
vue/no-undef-components

Does this change cause the rule to produce more or fewer warnings?
fewer warning

How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior

Please provide some example code that this change will affect:

<template>
<div>
  <Foo /> <!-- This will trigger a vue/no-undef-components warning, which is incorrect-->
</div>
</template>
<script>
@Component({
  components: {
    Foo
  }
})
export default class Bar extends Vue {}
</script>

What does the rule currently do for this code?
trigger a vue/no-undef-components warning, which is incorrect

What will the rule do after it's changed?
do nothing

@ylc395
Copy link
Contributor Author

ylc395 commented Sep 5, 2024

If this feature request is acceptable, I can submit a PR.

@FloEdelmann
Copy link
Member

If this is possible without much code, then yes, please submit a PR! Make sure to also include test cases (valid and invalid ones) to verify the implementation.

@ylc395
Copy link
Contributor Author

ylc395 commented Sep 17, 2024

I almost finish the PR, but I notice that just use comment like this:

<template>
  <Bar />
</template>
<script>
// @vue/component
@Component({
  components: { Bar } 
})
export default class Foo {}
</script>

will solve this problem.

So I think we do not need support Vue class component on purpose in this case. All we should do is to add an example about Vue class component in doc

@ylc395 ylc395 closed this as completed Sep 17, 2024
@ylc395 ylc395 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2024
@FloEdelmann
Copy link
Member

Feel free to open a PR to improve the docs!

@ylc395
Copy link
Contributor Author

ylc395 commented Sep 17, 2024

OK, please check #2561

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

No branches or pull requests

2 participants