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 up"standard --fix" alters indentation on comments #649
Comments
This comment has been minimized.
This comment has been minimized.
|
I just realized that my comments were not being indented, it's that they were not being un-indented along with the rest of my code. Is there a way to apply the 2-space indenting rule to comments as well? |
This comment has been minimized.
This comment has been minimized.
|
can you give a concrete example? |
This comment has been minimized.
This comment has been minimized.
|
Space after // this is okay
//this is not okayAs for your other issue, you'll need to provide a code example where it happens before we can look into it. |
feross
added
the
need more info
label
Oct 7, 2016
This comment has been minimized.
This comment has been minimized.
|
Of course, sorry about that. So, for example something like this (which uses 4 spaces for indentation): const testFun = () => {
//comment
const test = 'test'
return test
}will be corrected to use 2 spaces, except for the comment: const testFun = () => {
// comment
const test = 'test'
return test
}Just to clarify, I have no issue with the space after |
This comment has been minimized.
This comment has been minimized.
|
@11tracer Thanks for the code example. You're right -- confirmed. |
feross
added
bug
and removed
need more info
labels
Oct 7, 2016
This comment has been minimized.
This comment has been minimized.
|
Turns out this is a longstanding issue in ESLint (eslint/eslint#3845). There's a rewrite of the So going to close this issue as there's nothing for us to do. We'll get the fix for free in a future ESLint version. |
rmtracey commentedOct 6, 2016
I'm trying out standard and I've noticed a bit of an odd behavior. It seems to enforce that all comments have a space before they start:
// like soHowever, when I run "standard --fix" on my code, it will indent some comments that it fixes one or two extra times, like this, causing them to become misaligned with the code below them:
Before fixing:
After fixing:
This doesn't look right to me. Is this the intended behavior?