Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upTemplate string indentation style #1138
Comments
This comment has been minimized.
This comment has been minimized.
|
I think that the problem is that you are basically writing JavaScript that looks like this: const text = (
getText('./css1.css')
+ getText('./css2.css')
)I don't have a strong opinion here, but I might be leaning towards not changing anything btw. you could do it like this, no? const fHtml = formatHtml(`
<style>
${getText('./css1.css')}
${getText('./css2.css')}
</style>
`) |
This comment has been minimized.
This comment has been minimized.
1const text = (
getText('./css1.css')
+ getText('./css2.css')
)It can indeed be done. But I don't want to write more code and variables. 2const fHtml = formatHtml(`
<style>
${getText('./css1.css')}
${getText('./css2.css')}
</style>
`)
3I think this is where we should discuss. |
This comment has been minimized.
This comment has been minimized.
|
The const text = (
getText('./css1.css')
+ getText('./css2.css')
)The I could potentially see that this should be legal though: const text = `
<style>
${
foo() +
bar()
}
</style>
`although to be honest, I'm not 100% sure that I think it looks that good It's hard to think about without a valid use-case, I can't see a scenario where you would want to do arithmetic addition on a long list of variables inside a template string... |
This comment has been minimized.
This comment has been minimized.
|
@LinusU I am focused on explaining it: The Thank you。 |
This comment has been minimized.
This comment has been minimized.
|
The JSX indent rules have some bugs with edge cases like this, in my experience. @wll8 I think for your use case, @LinusU's suggestion works perfectly fine. Even though, you're technically right that I'm going to try to change rules in standard v12 to make JSX indentation work better, if it's at all possible. In the meantime, I think we can close this issue. |

wll8 commentedMay 21, 2018
What version of standard?
What operating system, Node.js, and npm version?
operating system
Mac OS X 10.13.1node
v8.9.4npm
v5.6.0What did you expect to happen?
I hope the style:
What actually happened?
Get error:
[eslint] Expected indentation of 2 spaces but found 12. (indent)Do I have to use the following style?