web-component-analyzer icon indicating copy to clipboard operation
web-component-analyzer copied to clipboard

Request Support for LWC Components

Open Digadadave opened this issue 4 years ago • 2 comments

I would love to see support for Lightning Web Components (LWC).

LWC Repo: https://github.com/salesforce/lwc

Digadadave avatar Feb 28 '20 23:02 Digadadave

Hi, thanks for opening this issue :-)

I think I need some more information. What specifically isn't supported?

I'm just guessing, but currently there are some issues analyzing dependencies that don't ship typings. However, I have a plan for how to add the support for that, I just haven't yet come around to do it.

Is that what you are experiencing?

runem avatar Mar 06 '20 14:03 runem

@runem Hi Rune, I'm currently looking at integrating LWC with Storybook and wca. I created a sample project here https://github.com/priandsf/lwc-storybook to conduct the experiment.

I'm getting some decent results after adding the JSDoc. I'll figure out what is missing, if any.

To answer your question above, LWC is a bit different from native web component:

  • The components must inherit from LightningElement and not HTMLElement. Moreover, many libraries are organizing components in an hierarchy with base classes.
  • LWC uses a few proprietary decorators (@api, @track, @wire) that can carry useful information.
  • LWC needs a wrapper to be registered as custom elements (see: buildCustomElementConstructor)
  • LWC uses a template file containing the HTML to render
  • there might be others that we'll discover...

Also, Salesforce could use an XML meta-data file, describing the component, in particular when it is consumed by a GUI builder. This file can provide useful information.

I'll be happy to collaborate.

priandsf avatar Jul 10 '20 18:07 priandsf