Skip to content

Add all Nuxt properties in order-in-components #980

Closed
@FloEdelmann

Description

@FloEdelmann

Nuxt.js's asyncData, fetch and head component properties were already added to the order-in-components rule.

There are others, though:

Additionally, Vue Router defines three in-component navigation guards:

  • beforeRouteEnter
  • beforeRouteUpdate
  • beforeRouteLeave

It would be useful to have them included in the default rule config to enforce a consistent style.

I'd like to suggest the following order:

   // side effects
   "el",

   // global awareness
   "name",
+  "key",
   "parent",

   // component type
   "functional",

   // template modifiers
   ["delimiters", "comments"],

   // template dependencies
   ["components", "directives", "filters"],

   // composition
   "extends",
   "mixins",

+  // new category: page validation
+  "beforeRouteEnter",
+  "beforeRouteUpdate",
+  "beforeRouteLeave",
+  "middleware",
+  "validate",

   // interface
   "inheritAttrs",
   "model",
   ["props", "propsData"],

   // local state
   "fetch",
   "asyncData",
   "data",
   "computed",

   // events
   "watch",
+  "watchQuery",
   "LIFECYCLE_HOOKS",

   // non-reactive properties
   "methods",
   "head",

   // rendering
+  "layout",
   ["template", "render"],
   "renderError",
+  "transition",
+  "loading",
+  "scrollToTop",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions