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

New rule: no-empty-component-block #952

Closed
1 of 4 tasks
manniL opened this issue Sep 1, 2019 · 6 comments · Fixed by #1222
Closed
1 of 4 tasks

New rule: no-empty-component-block #952

manniL opened this issue Sep 1, 2019 · 6 comments · Fixed by #1222

Comments

@manniL
Copy link
Contributor

manniL commented Sep 1, 2019

Please describe what the rule should do:
The rule should avoid empty <style scoped></style>, script or template tags. If there are no style rules, a style tag is not necessary.

Edge case: Tags that have a src attribute (should be valid).

What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<template>
  <h1>Hey</h1>
</template>

<script></script>

<style scoped></style>
<template>
  <h1>Hey</h1>
</template>

<style scoped></style>
<template>
</template>

<script>
export default { 
  render (h) { return h('div','Hi') }  // Or so
}
</script>
@daerodriguezme
Copy link

Do you know if this has any performance impact?

@manniL
Copy link
Contributor Author

manniL commented Mar 13, 2020

Do you know if this has any performance impact?

No, I don't 🙈

@tyankatsu0105
Copy link
Contributor

@ota-meshi
How about refactoring no-empty-pattern or adding an option to the rule?

@ota-meshi
Copy link
Member

Hi @tyankatsu0105
I think it's good to add a new rule vue/no-empty-component-block.

Probably with some attributes it should be ignored. e.g. <style src="...">

https://vue-loader.vuejs.org/spec.html#src-imports

@tjx666
Copy link

tjx666 commented Aug 24, 2023

Why this rule can't get auto fix? Any unsafe situation? @ota-meshi @tyankatsu0105

@FloEdelmann
Copy link
Member

Please open a new issue to discuss that.

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

Successfully merging a pull request may close this issue.

6 participants