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 upFunction argument alignment causes false positive about indentation #208
Comments
This comment has been minimized.
This comment has been minimized.
julien-f
commented
Jul 27, 2015
|
What about this? export function create (
id, xfilter, rawType,
width=defaultWidth, height=defaultHeight,
footerHeight=defaultFooterHeight,
padding=defaultPadding
) {
// ... function body, indented two spaces
}Anyway, IMHO with so many arguments you should use named parameters with an object and destructuring. |
This comment has been minimized.
This comment has been minimized.
|
@idan What version of standard? Run |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
julien-f
commented
Jul 27, 2015
|
@idan Nope, not so much: export function create ({
id, xfilter, rawType,
width=defaultWidth, height=defaultHeight,
footerHeight=defaultFooterHeight,
padding=defaultPadding
} = {}) {
// ... function body, indented two spaces
} |
This comment has been minimized.
This comment has been minimized.
|
@julien-f nifty! Thanks for the educational moment. |
This comment has been minimized.
This comment has been minimized.
|
@julien-f that's sexy! This looks like an indentation bug in eslint. Bug filed here: eslint/eslint#3173 |
feross
added
bug
blocked
labels
Jul 27, 2015
feross
changed the title
Indentation of function arguments?
Function argument alignment causes false positive about indentation
Aug 4, 2015
This comment has been minimized.
This comment has been minimized.
|
Fixed in eslint master, so this will be fixed in a future |
feross
closed this
Aug 21, 2015
lock
bot
locked as resolved and limited conversation to collaborators
May 11, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
idan commentedJul 27, 2015
So, I have an unfortunate function with a slew of default parameters like so:
However this gets me complaints about the function body not being indented 26 spaces.😦
I tried putting the opening brace on the following line in column zero, and it netted me a separate warning about the brace not being on the same line as the controlling statement.
One way I've found to keep standard happy is by doing this:
.. which doesn't read well for me.
Another is this, which is more legible to my eye:
I feel like I'm missing something. What's the proper way to author standardjs-compliant functions with multiline arguments?