useVueSlotNameCasing (HTML)
Language HTML
Summary
Section titled “Summary”- Rule available since:
v2.6.5 - Diagnostic Category:
lint/nursery/useVueSlotNameCasing - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
vue/slot-name-casing
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useVueSlotNameCasing": "error" } } }}Description
Section titled “Description”Enforce a consistent casing for the names of Vue slots.
A component declares its slots with <slot name="..."> elements, and the parent fills
them with v-slot:name or #name. Vue doesn’t convert slot names between camelCase and
kebab-case, so the parent must spell the name exactly as the component does. Using one
casing for every slot name makes the names easier to remember and to search for.
Only <slot> elements with a static name attribute are checked. Dynamic names, such as
:name="slotName", are ignored.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<template> <slot name="foo-bar" /></template>code-block.vue:2:14 lint/nursery/useVueSlotNameCasing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ The slot name foo-bar isn't in camelCase.
1 │ <template>
> 2 │ <slot name="foo-bar" />
│ ^^^^^^^^^
3 │ </template>
4 │
ℹ Vue doesn't convert slot names between casings, so components that fill this slot must use the exact same name. Using one casing for every slot name keeps them consistent.
ℹ Rename the slot so that it is in camelCase, and update the components that fill it.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<template> <slot name="foo_bar" /></template>code-block.vue:2:14 lint/nursery/useVueSlotNameCasing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ The slot name foo_bar isn't in camelCase.
1 │ <template>
> 2 │ <slot name="foo_bar" />
│ ^^^^^^^^^
3 │ </template>
4 │
ℹ Vue doesn't convert slot names between casings, so components that fill this slot must use the exact same name. Using one casing for every slot name keeps them consistent.
ℹ Rename the slot so that it is in camelCase, and update the components that fill it.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<template> <slot name="foo" /> <slot name="fooBar" /> <slot :name="slotName" /></template>Options
Section titled “Options”casing
Section titled “casing”Default: "camelCase"
The casing that slot names must follow:
"camelCase": slot names must be in camelCase, such asfooBar."kebab-case": slot names must be in kebab-case, such asfoo-bar."singleword": slot names must only contain lowercase letters fromatoz, such asfoo.
{ "linter": { "rules": { "nursery": { "useVueSlotNameCasing": { "level": "on", "options": { "casing": "kebab-case" } } } } }}Invalid
Section titled “Invalid”<template> <slot name="fooBar" /></template>code-block.vue:2:14 lint/nursery/useVueSlotNameCasing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ The slot name fooBar isn't in kebab-case.
1 │ <template>
> 2 │ <slot name="fooBar" />
│ ^^^^^^^^
3 │ </template>
4 │
ℹ Vue doesn't convert slot names between casings, so components that fill this slot must use the exact same name. Using one casing for every slot name keeps them consistent.
ℹ Rename the slot so that it is in kebab-case, and update the components that fill it.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<template> <slot name="foo" /> <slot name="foo-bar" /></template>{ "linter": { "rules": { "nursery": { "useVueSlotNameCasing": { "level": "on", "options": { "casing": "singleword" } } } } }}Invalid
Section titled “Invalid”<template> <slot name="fooBar" /></template>code-block.vue:2:14 lint/nursery/useVueSlotNameCasing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ The slot name fooBar isn't a single word made only of the lowercase letters a to z.
1 │ <template>
> 2 │ <slot name="fooBar" />
│ ^^^^^^^^
3 │ </template>
4 │
ℹ Vue doesn't convert slot names between casings, so components that fill this slot must use the exact same name. Using one casing for every slot name keeps them consistent.
ℹ Rename the slot so that it is a single word made only of the lowercase letters a to z, and update the components that fill it.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<template> <slot name="foo" /></template>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.