-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Add template-indent
rule
#1478
Add template-indent
rule
#1478
Conversation
Because your template literal can be anywhere, use something like Imaging foo.innerHTML = /* HTML */ `
// ...
`; $(foo).html(/* HTML */ `
// ...
`) div.insertAdjacentHTML(
'beforebegin',
/* HTML */ `
// ...
`
); Object.assign(div, {
innerHTML: /* HTML */ `
`,
}); You don't have to list all those cases in
It's very simple, use |
Also add comments to docs.
b5f89a1
to
e445d32
Compare
@fisker anything else you feel should be added here? |
I'll take a look ASAP. |
We need test for foo = outdent`
before
before${
expression
}after
after
`; foo = outdent`
before
before${
expression
}after
after
`; foo = outdent`
before
before${
outdent`
inner
`
}after
after
`; foo = outdent`
before
before${
normalTemplate`
inner
`
}after
after
`; |
98edb67
to
84ada62
Compare
@fisker added tests in 84ada62. Note that this rule is unopinionated about how parent variables are indented, and only cares about the template literals themselves, so outdent`
before
before${
outdent`
inner
`
}after
after
`; becomes outdent`
before
before${
outdent`
inner
`
}after
after
`; etc. even though the outer template is indented with spaces and the inner with tabs. It should work nicely with other rules that do care about the indentation level of the parent, like prettier or whatever. Good call to make sure this behaviour doesn't get regressed though. 👍 |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #580
Todo:
comments