runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
500 stars 61 forks source link

LWC: Allow on platform folder structure and/or use LWC config files to validate #267

Open lukethacoder opened 1 year ago

lukethacoder commented 1 year ago

On platform folder structure is a tad different from the open sourced LWC version.

On platform development has no concept of namespaces* (unless you're doing package development) and follows a generic folder structure of:

└── force-app/
    └── main/
        └── default/
            └── lwc/
                └── componentName/
                    ├── componentName.css
                    ├── componentName.html
                    ├── componentName.js
                    └── componentName.js-meta.xml

Through config, the force-app/main/default path may be different. From what I can see in the documentation, the namespacing is expecting the LWCs parent directory to match with the component name.

<lwc-component-name/> is what wca currently would expect from the above folder structure, but the above component would be referenced via <c-component-name/> on platform (c being the default namespace).

On platform development features an sfdx-project.json file to configure package paths. Off platform has the lwr.config.json or lwc.config.json to define namespaces and package folders. Would be neat if these config files could be used to determine if it is a valid LWC vs custom logic around parent folder names.