Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 1.64 KB

one-component-per-file.md

File metadata and controls

67 lines (44 loc) · 1.64 KB
pageClass sidebarDepth title description since
rule-details
0
vue/one-component-per-file
enforce that each component should be in its own file
v7.0.0

vue/one-component-per-file

enforce that each component should be in its own file

  • ⚙️ This rule is included in all of "plugin:vue/strongly-recommended", *.configs["flat/strongly-recommended"], "plugin:vue/vue2-strongly-recommended", *.configs["flat/vue2-strongly-recommended"], "plugin:vue/recommended", *.configs["flat/recommended"], "plugin:vue/vue2-recommended" and *.configs["flat/vue2-recommended"].

📖 Rule Details

This rule checks if there is only one component per file.

/* ✗ BAD */

Vue.component('TodoList', {
  // ...
})

Vue.component('TodoItem', {
  // ...
})
<script>
/* ✓ GOOD */
export default {
  name: 'my-component'
}
</script>

🔧 Options

Nothing.

👫 Related Rules

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v7.0.0

🔍 Implementation