Skip to content

Commit f843307

Browse files
committed
refactor: provide a default labelComponents empty array
1 parent c2bcae5 commit f843307

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/rules/form-control-has-label.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ function isLabelElement(
2121
| AST.VDocumentFragment
2222
| AST.VText
2323
| AST.VExpressionContainer,
24-
options: FormControlHasLabelOptions
24+
{ labelComponents = [] }: FormControlHasLabelOptions
2525
) {
26-
const labelComponents = (options.labelComponents || []).map(makeKebabCase).concat("label");
27-
return node.type === "VElement" && labelComponents.includes(getElementType(node));
26+
const allLabelComponents = labelComponents.map(makeKebabCase).concat("label");
27+
return node.type === "VElement" && allLabelComponents.includes(getElementType(node));
2828
}
2929

3030
function hasLabelElement(node: AST.VElement, options: FormControlHasLabelOptions): boolean {

0 commit comments

Comments
 (0)