# vue/order-in-components

enforce order of properties in components

  • ⚙️ This rule is included in "plugin:vue/vue3-recommended" and "plugin:vue/recommended".
  • 🔧 The --fix option on the command line (opens new window) can automatically fix some of the problems reported by this rule.

# 📖 Rule Details

This rule makes sure you keep declared order of properties in components. Recommended order of properties can be found here (opens new window).

<script> /* ✓ GOOD */ export default { name: 'app', props: { propA: Number }, data () { return { msg: 'Welcome to Your Vue.js App' } } } </script>
Now loading...
<script> /* ✗ BAD */ export default { name: 'app', data () { return { msg: 'Welcome to Your Vue.js App' } }, props: { propA: Number } } </script>
Now loading...

# 🔧 Options

{
  "vue/order-in-components": ["error", {
    "order": [
      "el",
      "name",
      "key",
      "parent",
      "functional",
      ["delimiters", "comments"],
      ["components", "directives", "filters"],
      "extends",
      "mixins",
      ["provide", "inject"],
      "ROUTER_GUARDS",
      "layout",
      "middleware",
      "validate",
      "scrollToTop",
      "transition",
      "loading",
      "inheritAttrs",
      "model",
      ["props", "propsData"],
      "emits",
      "setup",
      "asyncData",
      "data",
      "fetch",
      "head",
      "computed",
      "watch",
      "watchQuery",
      "LIFECYCLE_HOOKS",
      "methods",
      ["template", "render"],
      "renderError"
    ]
  }]
}

# 📚 Further Reading

# 🚀 Version

This rule was introduced in eslint-plugin-vue v3.2.0

# 🔍 Implementation

Last Updated: 12/24/2020, 2:51:18 AM