43081j / eslint-plugin-lit

lit-html support for ESLint
120 stars 22 forks source link

Add some lit v2 support and tidy up useless-literals rule #78

Closed 43081j closed 3 years ago

43081j commented 3 years ago

Still need to get the coverage back up because i added a bunch of complexity to compute property maps.

43081j commented 3 years ago

I suppose we need to understand things like:

<foo ${directive()}> - an element expression, which presumably means the directive is given an ElementPart

<${tag}> - an element name from using literal is now possible

stramel commented 3 years ago

Will try to throw in a review this week

43081j commented 3 years ago

@stramel to the rescue :D

i think i might just allow <${tag}> since the linter can't really get enough context to know if you're templating in a literal or not. so probably better to allow it than not

43081j commented 3 years ago

FYI the changes are fairly big for the useless literals rule because it has changed from:

"any literal in any template"

to:

"any literal in any template which isn't a property binding"

which now means it needs knowledge of the HTML AST... so it uses the analyzer

stramel commented 3 years ago

@43081j Shoot, sorry about not getting to this one. I thought the other one was what I had committed to reviewing. Will get on this ASAP.