From ffc3e0e42da18a5bb167094c28176c98f14d92bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Mon, 18 Feb 2019 11:24:17 +0100 Subject: [PATCH 1/4] chore: Keep Nuxt's 'asyncData' and 'fetch' with 'data' Change the order of asyncData and fetch properties to be next to data property. All those are function-wise more or less equivalent so IMO it makes sense to keep them together. asyncData and fetch are primarily for setting up component's data. --- lib/rules/order-in-components.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/rules/order-in-components.js b/lib/rules/order-in-components.js index a63b477e5..bc66e9374 100644 --- a/lib/rules/order-in-components.js +++ b/lib/rules/order-in-components.js @@ -19,11 +19,9 @@ const defaultOrder = [ 'inheritAttrs', 'model', ['props', 'propsData'], - 'data', + ['asyncData', 'fetch', 'data'], 'computed', 'watch', - 'asyncData', - 'fetch', 'LIFECYCLE_HOOKS', 'methods', ['template', 'render'], From 3aaa5e6c14ca1b75a822ecf2aafd372e08847653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Mon, 18 Feb 2019 14:17:46 +0100 Subject: [PATCH 2/4] Update order per review --- lib/rules/order-in-components.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rules/order-in-components.js b/lib/rules/order-in-components.js index bc66e9374..d0580410b 100644 --- a/lib/rules/order-in-components.js +++ b/lib/rules/order-in-components.js @@ -19,7 +19,9 @@ const defaultOrder = [ 'inheritAttrs', 'model', ['props', 'propsData'], - ['asyncData', 'fetch', 'data'], + 'fetch', + 'asyncData', + 'data', 'computed', 'watch', 'LIFECYCLE_HOOKS', From 1fdc10fc5afb273ce5e7a978e4b6231b02a5a4be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Mon, 25 Feb 2019 14:49:46 +0100 Subject: [PATCH 3/4] Add also 'head' property --- lib/rules/order-in-components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rules/order-in-components.js b/lib/rules/order-in-components.js index d0580410b..5dc200433 100644 --- a/lib/rules/order-in-components.js +++ b/lib/rules/order-in-components.js @@ -19,6 +19,7 @@ const defaultOrder = [ 'inheritAttrs', 'model', ['props', 'propsData'], + 'head', 'fetch', 'asyncData', 'data', From a1119c16726e02442095afc2e54f86038f2ece99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Mon, 25 Feb 2019 15:09:48 +0100 Subject: [PATCH 4/4] Change order of 'head' --- docs/rules/order-in-components.md | 3 +++ lib/rules/order-in-components.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/rules/order-in-components.md b/docs/rules/order-in-components.md index c28e283b4..d215cf1ee 100644 --- a/docs/rules/order-in-components.md +++ b/docs/rules/order-in-components.md @@ -74,11 +74,14 @@ export default { "inheritAttrs", "model", ["props", "propsData"], + "fetch", + "asyncData", "data", "computed", "watch", "LIFECYCLE_HOOKS", "methods", + "head", ["template", "render"], "renderError" ] diff --git a/lib/rules/order-in-components.js b/lib/rules/order-in-components.js index 5dc200433..35510c045 100644 --- a/lib/rules/order-in-components.js +++ b/lib/rules/order-in-components.js @@ -19,7 +19,6 @@ const defaultOrder = [ 'inheritAttrs', 'model', ['props', 'propsData'], - 'head', 'fetch', 'asyncData', 'data', @@ -27,6 +26,7 @@ const defaultOrder = [ 'watch', 'LIFECYCLE_HOOKS', 'methods', + 'head', ['template', 'render'], 'renderError' ]