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

unicorn/template-indent fights with prettier/prettier over html indentation #653

Open
andersk opened this issue Mar 9, 2022 · 0 comments
Labels

Comments

@andersk
Copy link
Contributor

andersk commented Mar 9, 2022

When using an html`…` template inside a ternary condition, unicorn/template-indent wants different indentation than prettier/prettier, so the user needs to disable one of these.

(XO 0.48.0, Prettier 2.5.1.)

import html from 'escape-goat';

export function hello(condition) {
	return condition
		? html`
				<div>
					<p>Hello, world!</p>
				</div>
		  `
		: html`<div></div>`;
}
$ npx xo --prettier

  src.js:5:9
  ⚠  5:9  Templates should be properly indented.  unicorn/template-indent

  1 warning
import html from 'escape-goat';

export function hello(condition) {
	return condition
		? html`
			<div>
				<p>Hello, world!</p>
			</div>
		`
		: html`<div></div>`;
}
$ npx xo --prettier

  src.js:6:4
  ✖  6:4  Insert ↹   prettier/prettier
  ✖  7:1  Insert ↹   prettier/prettier
  ✖  8:4  Insert ↹   prettier/prettier
  ✖  9:3  Insert ··  prettier/prettier

  4 errors
@andersk andersk changed the title unicorn/template-indent fights with prettier/prettier over html indentation unicorn/template-indent fights with prettier/prettier over ` html ` indentation Mar 9, 2022
@andersk andersk changed the title unicorn/template-indent fights with prettier/prettier over ` html ` indentation unicorn/template-indent fights with prettier/prettier over html indentation Mar 9, 2022
@fregante fregante added the bug label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants