microsoft / typescript-lit-html-plugin

TypeScript server plugin that adds intellisense for lit-html template strings
MIT License
255 stars 21 forks source link

Syntax error (colon expected) with style attribute (in html template literal) #19

Closed mjbvz closed 5 years ago

mjbvz commented 6 years ago

From @ncodefun on July 15, 2018 21:32

I'm reporting this here since it's this plugin that reports the error, but the context is that I work with lit-html and the vscode-lit-html extension ... So I have this: ts-styled-error

This only happens with the style attribute, and only when the template string is multi-line. Tried with other styles before or after the expression and it doesn't work either (I thought maybe it looks for at least one colon/semi-colon pair).

Copied from original issue: Microsoft/typescript-styled-plugin#64

anneb commented 5 years ago

Below is a full example.
Generates error for template_c: [ts-styled-plugin] colon expected

import {html} from '@polymer/lit-element';

const style = "color:red";
const template_a = html`<div style="color:red"></div>`;
const template_b = html`<div style="${style}"></div>`;
const template_c = html`<div 
style="${style}"></div>`;
justinfagnani commented 5 years ago

This has been annoying me recently. I think we need an option to turn off linting all together until the linters can correctly handle expressions.