Skip to content

Commit a465e17

Browse files
waynzhFloEdelmann
andauthored
Apply suggestions from code review
Co-authored-by: Flo Edelmann <[email protected]>
1 parent c5730a8 commit a465e17

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

docs/rules/slot-name-casing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description: enforce specific casing for the slot name
1313

1414
## :book: Rule Details
1515

16-
This rule enforce proper casing of slot names in vue components.
16+
This rule enforces proper casing of slot names in Vue components.
1717

1818
<eslint-code-block :rules="{'vue/slot-name-casing': ['error']}">
1919

lib/rules/slot-name-casing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
meta: {
2929
type: 'suggestion',
3030
docs: {
31-
description: 'enforce specific casing for the slot name',
31+
description: 'enforce specific casing for slot names',
3232
categories: undefined,
3333
url: 'https://eslint.vuejs.org/rules/slot-name-casing.html'
3434
},

tests/lib/rules/slot-name-casing.js

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,34 @@ tester.run('slot-name-casing', rule, {
2525
{
2626
filename: 'test.vue',
2727
code: `
28-
<template>
29-
<slot name="foo" />
30-
<slot name="foo-bar" />
31-
<slot :name="fooBar" />
32-
</template>`,
28+
<template>
29+
<slot name="foo" />
30+
<slot name="foo-bar" />
31+
<slot :name="fooBar" />
32+
</template>
33+
`,
3334
options: ['kebab-case']
3435
},
3536
{
3637
filename: 'test.vue',
3738
code: `
38-
<template>
39-
<slot name="foo" />
40-
<slot :name="fooBar" />
41-
</template>`,
39+
<template>
40+
<slot name="foo" />
41+
<slot :name="fooBar" />
42+
</template>
43+
`,
4244
options: ['singleword']
4345
}
4446
],
4547
invalid: [
4648
{
4749
filename: 'test.vue',
4850
code: `
49-
<template>
50-
<slot name="foo-bar" />
51-
<slot name="foo-Bar_baz" />
52-
</template>`,
51+
<template>
52+
<slot name="foo-bar" />
53+
<slot name="foo-Bar_baz" />
54+
</template>
55+
`,
5356
errors: [
5457
{
5558
messageId: 'invalidCase',
@@ -58,7 +61,7 @@ tester.run('slot-name-casing', rule, {
5861
caseType: 'camelCase'
5962
},
6063
line: 3,
61-
column: 13
64+
column: 17
6265
},
6366
{
6467
messageId: 'invalidCase',
@@ -67,17 +70,18 @@ tester.run('slot-name-casing', rule, {
6770
caseType: 'camelCase'
6871
},
6972
line: 4,
70-
column: 13
73+
column: 17
7174
}
7275
]
7376
},
7477
{
7578
filename: 'test.vue',
7679
code: `
77-
<template>
78-
<slot name="fooBar" />
79-
<slot name="foo-Bar_baz" />
80-
</template>`,
80+
<template>
81+
<slot name="fooBar" />
82+
<slot name="foo-Bar_baz" />
83+
</template>
84+
`,
8185
options: ['kebab-case'],
8286
errors: [
8387
{
@@ -87,7 +91,7 @@ tester.run('slot-name-casing', rule, {
8791
caseType: 'kebab-case'
8892
},
8993
line: 3,
90-
column: 13
94+
column: 17
9195
},
9296
{
9397
messageId: 'invalidCase',
@@ -96,18 +100,19 @@ tester.run('slot-name-casing', rule, {
96100
caseType: 'kebab-case'
97101
},
98102
line: 4,
99-
column: 13
103+
column: 17
100104
}
101105
]
102106
},
103107
{
104108
filename: 'test.vue',
105109
code: `
106-
<template>
107-
<slot name="foo-bar" />
108-
<slot name="fooBar" />
109-
<slot name="foo-Bar_baz" />
110-
</template>`,
110+
<template>
111+
<slot name="foo-bar" />
112+
<slot name="fooBar" />
113+
<slot name="foo-Bar_baz" />
114+
</template>
115+
`,
111116
options: ['singleword'],
112117
errors: [
113118
{
@@ -117,7 +122,7 @@ tester.run('slot-name-casing', rule, {
117122
caseType: 'singleword'
118123
},
119124
line: 3,
120-
column: 13
125+
column: 17
121126
},
122127
{
123128
messageId: 'invalidCase',
@@ -126,7 +131,7 @@ tester.run('slot-name-casing', rule, {
126131
caseType: 'singleword'
127132
},
128133
line: 4,
129-
column: 13
134+
column: 17
130135
},
131136
{
132137
messageId: 'invalidCase',
@@ -135,7 +140,7 @@ tester.run('slot-name-casing', rule, {
135140
caseType: 'singleword'
136141
},
137142
line: 5,
138-
column: 13
143+
column: 17
139144
}
140145
]
141146
}

0 commit comments

Comments
 (0)