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

do not auto insert attribute quotes in template literals inside of lit-html #5538

Closed
markcellus opened this issue Nov 23, 2018 · 0 comments
Closed
Labels
area:multiparser Issues with printing one language inside another, like CSS-in-JS lang:html Issues affecting HTML (and SVG but not JSX) lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Milestone

Comments

@markcellus
Copy link

For some reason, prettier is adding quotes around JS objects in template literals that I need to pass as properties to lit-html. See example below.

Prettier 1.15.2
Playground link

--jsx-single-quote
--parser typescript

Input:

function HelloWorld() {
	const obj = {};
	return html`<my-element obj=${obj}></my-element>`;
}

Output:

function HelloWorld() {
  const obj = {};
  return html`
    <my-element obj="${obj}"></my-element>
  `;
}

Expected behavior:

I expect for quotes not to be inserted around ${obj} because I want to pass the object as it is.
Note, however, that the quotes are not added if I'm not using lit-html's html parser.

@j-f1 j-f1 added type:bug Issues identifying ugly output, or a defect in the program lang:javascript Issues affecting JS area:multiparser Issues with printing one language inside another, like CSS-in-JS lang:html Issues affecting HTML (and SVG but not JSX) labels Nov 23, 2018
@ikatyang ikatyang added the priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! label Nov 23, 2018
@ikatyang ikatyang added this to the 1.15.3 milestone Nov 23, 2018
@ikatyang ikatyang added the status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! label Nov 24, 2018
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Feb 23, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:multiparser Issues with printing one language inside another, like CSS-in-JS lang:html Issues affecting HTML (and SVG but not JSX) lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

3 participants