Skip to content

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

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

Closed
FloEdelmann opened this issue Nov 6, 2019 · 0 comments · Fixed by #1107
Closed

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

FloEdelmann opened this issue Nov 6, 2019 · 0 comments · Fixed by #1107

Comments

@FloEdelmann
Copy link
Member

FloEdelmann commented Nov 6, 2019

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",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant