@priandsf Definitely - let's join forces. @mattwu-24 Is working on this for us at Vlocity during his internship & I'll be picking it up once that comes to an end this month. With regards to your points
You're right. The way you've done refineFeatures looks like the right approach for this.
Yep - I saw the global html attributes list. We hadn't even considered that. I'll work with Matt to try get this integrated into his current solution from your fork.
Seems reasonable - we'll rename it.
One piece we want to fix up still is the hierarchy checking of the class. What are your thoughts on the following:
Checking that the component has LightningElement in it's parent hierarchy?
Checking that the @api decorator is coming from the lwc node module?
Scanning for elements and surfacing them?
Scanning for new CustomEvent() calls. I feel like this one could be very tricky as the event may be created much earlier in the code than it's fired from.
On a separate related note. I saw your comment on the LWC ticket that you're working on Storybook integration. Matt has been working on that too for us. We've posted our code solution for it over here: https://github.com/muenzpraeger/create-lwc-app/issues/74 . It'd be great to join forces on that too - perhaps drop me an email (matt at vlocity.com) and we can discuss in more detail offline.
Great - I sent you an email. If you do not receive it, please drop me one.
Guessing if a component is an LWC one is tricky.
Checking for LightningElement in the hierarchy seems safe, but it assumes that you have access to the hierarchy. It might fail if the component inherits from a library that does not have TS types.
@api, or any other annotation, assumes that it is being used in the component which is not always the case
lwc.config.json (or package.json) is not reliable either
In our examples, we are using the explicit JSDoc @element annotation to discover the components. That felt reasonable for now.
Going forward, there is an RFC for generating canonical meta-data: https://rfcs.lwc.dev/rfcs/lwc/0000-canonical-metadata. That should help a lot!
@priandsf Definitely - let's join forces. @mattwu-24 Is working on this for us at Vlocity during his internship & I'll be picking it up once that comes to an end this month. With regards to your points
One piece we want to fix up still is the hierarchy checking of the class. What are your thoughts on the following:
LightningElement
in it's parent hierarchy?@api
decorator is coming from thelwc
node module?new CustomEvent()
calls. I feel like this one could be very tricky as the event may be created much earlier in the code than it's fired from.On a separate related note. I saw your comment on the LWC ticket that you're working on Storybook integration. Matt has been working on that too for us. We've posted our code solution for it over here: https://github.com/muenzpraeger/create-lwc-app/issues/74 . It'd be great to join forces on that too - perhaps drop me an email (matt at vlocity.com) and we can discuss in more detail offline.