Skip to content

Commit

Permalink
Add slots+expose to vue/order-in-components default order (#2153)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored and FloEdelmann committed Dec 19, 2024
1 parent 70a9e72 commit 027e28c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/rules/order-in-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export default {
"model",
["props", "propsData"],
"emits",
"slots",
"expose",
"setup",
"asyncData",
"data",
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/order-in-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const defaultOrder = [
'model',
['props', 'propsData'],
'emits', // for Vue.js 3.x
'slots',
'expose',

// Note:
// The `setup` option is included in the "Composition" category,
Expand Down
57 changes: 57 additions & 0 deletions tests/lib/rules/order-in-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ ruleTester.run('order-in-components', rule, {
model,
props, propsData,
emits,
slots,
expose,
setup,
data,
computed,
Expand Down Expand Up @@ -1285,6 +1287,61 @@ ruleTester.run('order-in-components', rule, {
line: 5
}
]
},
{
filename: 'example.vue',
code: `
export default {
setup,
slots,
expose,
};
`,
output: `
export default {
slots,
setup,
expose,
};
`,
languageOptions,
errors: [
{
message:
'The "slots" property should be above the "setup" property on line 3.',
line: 4
},
{
message:
'The "expose" property should be above the "setup" property on line 3.',
line: 5
}
]
},
{
filename: 'example.vue',
code: `
export default {
slots,
setup,
expose,
};
`,
output: `
export default {
slots,
expose,
setup,
};
`,
languageOptions,
errors: [
{
message:
'The "expose" property should be above the "setup" property on line 4.',
line: 5
}
]
}
]
})

0 comments on commit 027e28c

Please sign in to comment.