Skip to content
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

Destructuring variable declarations: continuation cannot be more than +2 spaces #55

Open
jcao219 opened this issue Feb 26, 2019 · 3 comments

Comments

@jcao219
Copy link

jcao219 commented Feb 26, 2019

const {fieldFoo, fieldBar, fieldBaz,
       fieldLast} = myObject;

Raises an error, but since this a continuation, I believe this syntax should be allowed?

@jcao219 jcao219 changed the title Destructuring variable declarations -- continuation cannot be more than +2 spaces Destructuring variable declarations: continuation cannot be more than +2 spaces Feb 26, 2019
@philipwalton
Copy link
Contributor

What is the error you're getting?

I believe the preferred indentation for this would be four spaces:

const {fieldFoo, fieldBar, fieldBaz,
    fieldLast} = myObject;

I believe technically Google style allows (but discourages) more than 4 spaces, though I don't think there's any way to configure ESLint to allow that (without writing a custom plugin).

@jcao219
Copy link
Author

jcao219 commented Feb 26, 2019

For your example, I'm getting:

error Expected indentation of 2 spaces but found 4 indent

By the way, I tend to like to write line continuations like this for my personal visual preference, but I'm not sure if it's best:

doStuffWithThese(longArgumentName, quiteAFewArguments, probablyCodeSmell
                 longArgumentNameAgain);
nextLine();
someMoreWork();

@philipwalton
Copy link
Contributor

I think, unfortunately, ESLint is not able to detect the difference between a line continuation in an object block and normal block indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants