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 upIndentation of code with a multiline tagged template literal string seems off #1236
Comments
This comment has been minimized.
This comment has been minimized.
stale
bot
commented
Mar 22, 2019
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
stale
bot
added
the
stale
label
Mar 22, 2019
stale
bot
closed this
Mar 29, 2019
lock
bot
locked as resolved and limited conversation to collaborators
Jun 27, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
nerdo commentedDec 22, 2018
•
edited
What version of standard?
12.0.1
What operating system, Node.js, and npm version?
macOS Mojave 10.14.1
Node.js 10.11.0
npm 6.5.0
Input file
test.jsWhat did you expect to happen?
Running standard on
test.jsreveals severalindenterrors, however, it seems to me that the indentation in the original file is correct.For example, if one were to remove the tagged template literal altogether, it would be a normal function call and the
indenterrors disappear.What actually happened?
Taking it one step further, running
standard --fixon the file produces the following:Thoughts
This only seems to apply to multiline tagged template literals. If one changes
test.jsand puts the tagged template literal on one line, it behaves as expected... as if it were just a simple function call. Clearly, the indentation of the template literal is affecting theindentrule.I believe this is a problem with eslint. I have, in fact, run into the same issue with it using just eslint in the past and was able to fix it adding this to my .eslintrc (https://stackoverflow.com/a/53094449/2057996):