Closed andrico1234 closed 2 years ago
I'm away on annual leave at the min but will take a look at importing the analyzer in the openwc stuff when I'm back. Then just see which gaps need filling in and how (incl this)
Hi @43081j , a friendly bump 😊
sorry has been a busy couple of weeks, i'll take a look this weekend 👍
@andrico1234 it is being tackled here: 43081j/eslint-plugin-lit#117
once that lands, then openwc can make use of it
I've opened up a PR in open-wc's eslint-plugin-lit-a11y package to implement an eslint rule that checks to see if the
<html>'s
lang` attribute receives a compliant value. (W3 validate against this rule, see here and here)Unfortunately, since we're using
parse5
'sparseFragment
function to generate the AST, the resulting object strips out the elements like<HTML>
,<body>
, and<head>
, which is not good since we want to run validation against the<html>
element.The way I've gotten around this is by extending the
template-analyzer
to check if an element is an<html>
element via the following functionThen inside of the template-analyzer's constructor we make the following modification:
I created a PR to implement this here but this causes open-wc's template-analyzer to become out sync with the one written in
eslint-plugin-lit
.@thepassle left a comment in the PR about possibly importing your template-analyzer instead of open-wc rolling their own.
If you think it appropriate, I'd be happy to create a PR to add the
isRootElement
check, to enable your package, and other consumers of thetemplate-analyzer
to add lint rules that target the<html>
element.