Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9c4fe7d

Browse filesBrowse files
committed
Change vue/order-in-components rule to enforce ordering on slots and expose defaults
1 parent e1747fc commit 9c4fe7d
Copy full SHA for 9c4fe7d

File tree

3 files changed

+61
-0
lines changed
Filter options

3 files changed

+61
-0
lines changed

‎docs/rules/order-in-components.md

Copy file name to clipboardExpand all lines: docs/rules/order-in-components.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export default {
8686
"model",
8787
["props", "propsData"],
8888
"emits",
89+
"slots",
90+
"expose",
8991
"setup",
9092
"asyncData",
9193
"data",

‎lib/rules/order-in-components.js

Copy file name to clipboardExpand all lines: lib/rules/order-in-components.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const defaultOrder = [
4848
'model',
4949
['props', 'propsData'],
5050
'emits', // for Vue.js 3.x
51+
'slots',
52+
'expose',
5153

5254
// Note:
5355
// The `setup` option is included in the "Composition" category,

‎tests/lib/rules/order-in-components.js

Copy file name to clipboardExpand all lines: tests/lib/rules/order-in-components.js
+57Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ ruleTester.run('order-in-components', rule, {
5151
model,
5252
props, propsData,
5353
emits,
54+
slots,
55+
expose,
5456
setup,
5557
data,
5658
computed,
@@ -943,6 +945,61 @@ ruleTester.run('order-in-components', rule, {
943945
line: 5
944946
}
945947
]
948+
},
949+
{
950+
filename: 'example.vue',
951+
code: `
952+
export default {
953+
setup,
954+
slots,
955+
expose,
956+
};
957+
`,
958+
parserOptions,
959+
output: `
960+
export default {
961+
slots,
962+
setup,
963+
expose,
964+
};
965+
`,
966+
errors: [
967+
{
968+
message:
969+
'The "slots" property should be above the "setup" property on line 3.',
970+
line: 4
971+
},
972+
{
973+
message:
974+
'The "expose" property should be above the "setup" property on line 3.',
975+
line: 5
976+
}
977+
]
978+
},
979+
{
980+
filename: 'example.vue',
981+
code: `
982+
export default {
983+
slots,
984+
setup,
985+
expose,
986+
};
987+
`,
988+
parserOptions,
989+
output: `
990+
export default {
991+
slots,
992+
expose,
993+
setup,
994+
};
995+
`,
996+
errors: [
997+
{
998+
message:
999+
'The "expose" property should be above the "setup" property on line 4.',
1000+
line: 5
1001+
}
1002+
]
9461003
}
9471004
]
9481005
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.