-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
Question: do you enforce multiline new lines for destructuring? #2435
Comments
Yes, those examples you’re asking about are bad (the 2nd, 4th, and 6th). Any multi-part construct that can’t fit entirely on a single line, must have each part on its own line. For destructuring, that means either the entire statement is on one line, or each property being destructured must be on its own line. |
To be clear, the guide dictates this, and it’s irrelevant that the linter config does not, as not everything in the guide is, or needs to be, lintable. |
@ljharb Thank you very much for the clarification. Would you be willing to point to where in the guide this is dictated? This isn't the first time this has come up for our team, as I believe half of us are misinterpreting the guide around this concept. I would like to update our documentation appropriately to make sure we are all on the same page moving forward. |
You’re right; i don’t see an explicit section in the guide about it - but it should follow from principles of consistency. A PR to make the guide more explicit here would be appreciated. |
We are having a debate around whether the AirBnB guidelines for object-curly-newline (10.8) should affect destructuring or not, particularly for props.
Example:
We know eslint does not support this at all (and have chosen not to), so if we want to do it we have to use prettier or eslint-plugin-putout. We are curious if AirBnB standards have been defined for this circumstance? There has been many discussions around whether rules 7.15 and 10.8 were intended to affect this.
Many thanks for your time. I apologize if this was answered elsewhere, couldn't seem to find it.
The text was updated successfully, but these errors were encountered: