Skip to content

Commit bf6a876

Browse files
committed
fix: component-name-in-template-casing rule
1 parent e42f737 commit bf6a876

File tree

3 files changed

+7
-32
lines changed

3 files changed

+7
-32
lines changed

Diff for: lib/rules/component-name-in-template-casing.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ module.exports = {
9393
if (
9494
(!utils.isHtmlElementNode(node) && !utils.isSvgElementNode(node)) ||
9595
utils.isHtmlWellKnownElementName(node.rawName) ||
96-
utils.isSvgWellKnownElementName(node.rawName)
96+
utils.isSvgWellKnownElementName(node.rawName) ||
97+
utils.isBuiltInComponentName(node.rawName)
9798
) {
9899
return false
99100
}

Diff for: lib/utils/vue2-builtin-components.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ module.exports = [
88
'transition-group',
99
'TransitionGroup',
1010
'keep-alive',
11-
'KeepAlive'
11+
'KeepAlive',
12+
'client-only',
13+
'ClientOnly'
1214
]

Diff for: tests/lib/rules/component-name-in-template-casing.js

+2-30
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ tester.run('component-name-in-template-casing', rule, {
159159
<client-only />
160160
<keep-alive />
161161
</template>
162-
`
162+
`,
163+
options: ['PascalCase', { registeredComponentsOnly: false }]
163164
},
164165

165166
{
@@ -811,35 +812,6 @@ tester.run('component-name-in-template-casing', rule, {
811812
'Component name "FooBar_Baz-qux" is not kebab-case.'
812813
]
813814
},
814-
{
815-
// built-in components (behave the same way as other components)
816-
code: `
817-
<template>
818-
<component />
819-
<suspense />
820-
<teleport />
821-
<client-only />
822-
<keep-alive />
823-
</template>
824-
`,
825-
output: `
826-
<template>
827-
<Component />
828-
<Suspense />
829-
<Teleport />
830-
<ClientOnly />
831-
<KeepAlive />
832-
</template>
833-
`,
834-
options: ['PascalCase', { registeredComponentsOnly: false }],
835-
errors: [
836-
'Component name "component" is not PascalCase.',
837-
'Component name "suspense" is not PascalCase.',
838-
'Component name "teleport" is not PascalCase.',
839-
'Component name "client-only" is not PascalCase.',
840-
'Component name "keep-alive" is not PascalCase.'
841-
]
842-
},
843815
{
844816
code: `
845817
<template>

0 commit comments

Comments
 (0)