-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Description
What if I have a LocalComponent that's not intended for use outside of MyComponent - how do I name CSS classes? Would that be ok?
export default function MyComponent(..) {
return <MyComponent className="MyComponent">
<ul className="MyComponent-localComponents"> ----- plural name for the descendant
<LocalComponent/> -- for loop here
</ul>
</MyComponent>
}
function LocalComponent(..) {
// can't use "LocalComponent" because that's ambiguous
// could use MyComponentLocalComponent but that's too long
return <li className="MyComponent_LocalComponent">
<AnotherLocalComponentInfo/>
<form className="MyComponent_LocalComponent-form">...</form>
</li>
}
function AnotherLocalComponentInfo(..) {
return <div className="MyComponent_LocalComponent_AnotherLocalComponentInfo">
<Image className="MyComponent_LocalComponent_AnotherLocalComponentInfo-logo"/>
...
</div>I'm using the underscored name for the descendant but I have to overwrite the Stylelint regexp:
componentName: /^[A-Z][a-zA-Z0-9]+$/,to ^[A-Z][a-zA-Z0-9]+(_[A-Z][a-zA-Z0-9]+)*$
It feels a little off but I think it's ok. I didn't find any docs on that use case, just wanted to confirm.
Metadata
Metadata
Assignees
Labels
No labels