Skip to content

Commit 027e28c

Browse files
ota-meshiFloEdelmann
authored andcommitted
Add slots+expose to vue/order-in-components default order (#2153)
1 parent 70a9e72 commit 027e28c

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

Diff for: docs/rules/order-in-components.md

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export default {
8888
"model",
8989
["props", "propsData"],
9090
"emits",
91+
"slots",
92+
"expose",
9193
"setup",
9294
"asyncData",
9395
"data",

Diff for: lib/rules/order-in-components.js

+2
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,

Diff for: tests/lib/rules/order-in-components.js

+57
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ ruleTester.run('order-in-components', rule, {
5050
model,
5151
props, propsData,
5252
emits,
53+
slots,
54+
expose,
5355
setup,
5456
data,
5557
computed,
@@ -1285,6 +1287,61 @@ ruleTester.run('order-in-components', rule, {
12851287
line: 5
12861288
}
12871289
]
1290+
},
1291+
{
1292+
filename: 'example.vue',
1293+
code: `
1294+
export default {
1295+
setup,
1296+
slots,
1297+
expose,
1298+
};
1299+
`,
1300+
output: `
1301+
export default {
1302+
slots,
1303+
setup,
1304+
expose,
1305+
};
1306+
`,
1307+
languageOptions,
1308+
errors: [
1309+
{
1310+
message:
1311+
'The "slots" property should be above the "setup" property on line 3.',
1312+
line: 4
1313+
},
1314+
{
1315+
message:
1316+
'The "expose" property should be above the "setup" property on line 3.',
1317+
line: 5
1318+
}
1319+
]
1320+
},
1321+
{
1322+
filename: 'example.vue',
1323+
code: `
1324+
export default {
1325+
slots,
1326+
setup,
1327+
expose,
1328+
};
1329+
`,
1330+
output: `
1331+
export default {
1332+
slots,
1333+
expose,
1334+
setup,
1335+
};
1336+
`,
1337+
languageOptions,
1338+
errors: [
1339+
{
1340+
message:
1341+
'The "expose" property should be above the "setup" property on line 4.',
1342+
line: 5
1343+
}
1344+
]
12881345
}
12891346
]
12901347
})

0 commit comments

Comments
 (0)