-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Salesforce LWC Markup #3849
Comments
The error message is:
It's not a valid XML format, e.g. <ui-navbar nav-items={navigationItems} ... should be <ui-navbar nav-items="{navigationItems}" ... These curly braces look like this is actually a template (also the "if:true" pseudo attributes later on) and the "XML" is probably not used as-is. In the documentation they use "HTML" for the description of this format: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_components_html "A template is valid HTML with a root tag." But HTML is not supported by PMD today (#3521). |
@adangel thanks for looking into this. So there is still something in this world like not well-formed HTML. Can you elaborate a bit on why PMD never supported HTML? Because there exist no compatible parsers or because nobody contributed it or what else? I asked in salesforce/lwc#2749 which format they use and if there is a public parser? |
Yes, nobody contributed. I had a look a https://jsoup.org/ - this is a lot more relaxed for parsing. I could successfully parse the snippet you mentioned via |
For PMD 7 I wrote a javadoc parser, which as you know includes HTML. This supports position information correctly, maybe we could extract it. I like Jsoup, but its API also allows mutating everything, which PMD rules shouldn't be doing. |
Hi @rsoesemann @adangel Will there be a plan for PMD to support LWC? |
Salesforce has 3 UI / Markup dialects from which only 2 can be parsed by PMD.
1) Visualforce: SUPPORTED using own Visualforce language module
Sample code: https://github.com/rsoesemann/salesforce-recipes/blob/master/force-app/main/default/pages/activateAccountButton.page parses using Visualforce language module
2) Aura Component Markup: SUPPORTED
Sample code: https://github.com/rsoesemann/salesforce-recipes/blob/master/force-app/main/default/aura/resultToast/resultToast.cmp parses using Visualforce language module
3) LWC Component Markup: NOT SUPPORTED
Sample code: https://raw.githubusercontent.com/trailheadapps/lwc-recipes-oss/main/src/modules/ui/app/app.html
doesn't parse. Neighter as XML nor anything else.
The text was updated successfully, but these errors were encountered: