Performance: Component naming conventions
LOW IMPACT
Component naming conventions mainly affect developer experience and maintainability, indirectly influencing performance by enabling better code organization and reuse.
<!-- Use PascalCase with descriptive names like <UserCard> --> <script> import UserCard from './UserCard.svelte'; </script> <UserCard />
<!-- Using inconsistent or generic names like <component1> or <mycomponent> --> <script> import Component1 from './Component1.svelte'; </script> <Component1 />
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Generic or inconsistent names | May cause duplicate components in DOM | Potential extra reflows if duplicates render | Higher paint cost due to redundant nodes | [X] Bad |
| Consistent PascalCase descriptive names | Clear single component instance in DOM | Minimal reflows due to reuse | Lower paint cost with optimized DOM | [OK] Good |