Skip to content
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

Update binding-positions rule for Lit v2 #98

Open
stramel opened this issue May 17, 2021 · 2 comments
Open

Update binding-positions rule for Lit v2 #98

stramel opened this issue May 17, 2021 · 2 comments

Comments

@stramel
Copy link
Contributor

stramel commented May 17, 2021

In Lit v2 you can achieve some of these invalid binding positions by using import { html } from 'lit/static-html.js'; .

We should probably warn about the binding positions if they're not utilizing the static html function.

https://lit.dev/docs/api/static-html/
https://lit.dev/docs/templates/expressions/#expression-locations
https://lit.dev/docs/templates/expressions/#static-expressions

@aboutsimon
Copy link

aboutsimon commented May 5, 2022

Same issue with no-invalid-html, when trying to use e.g. the code from the lit docs

  render() {
    return html`
      <${this.tag} ${this.activeAttribute}?=${this.active}>
        <p>${this.caption}</p>
      </${this.tag}>`;
  }

Results in

Template contained invalid HTML syntax, error was: invalid-first-character-of-tag-name eslint lit/no-invalid-html

@43081j
Copy link
Owner

43081j commented May 6, 2022

that one in particular is because our placeholders are currently comments except in the case of attributes, then they are placeholder attributes.

we need to implement better placeholder/substitution to account for tags/attributes/etc.

i was hoping peter on the lit team would finish the analyzer he started building first, so we could just use the same analysis here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants