VIEW002: duplicate-component-name
Sibling components share a name
| Code | VIEW002 |
| Name | duplicate-component-name |
| Category | View structure (VIEW) |
| Default severity | error |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports a component whose meta.name equals the name of an earlier
sibling (a component with the same parent).
Why is this bad?
Section titled “Why is this bad?”Perspective addresses components by name: getChild('Label'),
getSibling('Label'), {../Label.props.text} and /root/Panel/Label all
resolve to the first sibling with that name, so the second component can
never be reached and bindings silently read the wrong one. The Designer
normally prevents duplicates; they appear after hand edits, merges or
copy-paste between views.
Example
Section titled “Example”"children": [ {"type": "ia.display.label", "meta": {"name": "Label"}}, {"type": "ia.display.label", "meta": {"name": "Label"}}]Use instead:
"children": [ {"type": "ia.display.label", "meta": {"name": "Title"}}, {"type": "ia.display.label", "meta": {"name": "Subtitle"}}]Generated from the rule metadata by iglint generate-docs; iglint rule VIEW002 prints the same page in the terminal. Source: docs/rules/VIEW002.md.