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

Best way to deal with operator-linebreak and long line length #1926

Closed
KayakinKoder opened this issue Oct 1, 2018 · 4 comments
Closed

Best way to deal with operator-linebreak and long line length #1926

KayakinKoder opened this issue Oct 1, 2018 · 4 comments
Labels

Comments

@KayakinKoder
Copy link

In a few places where code is indented a bit and we have something like this: myObject.ProbablyTooLong.PropertyName = somethingElse.That.IsLong;

We had previously broken the line up to avoid max-len violations:

myObject.ProbablyTooLong.PropertyName
       = somethingElse.That.IsLong;

A recent update now gives us operator-linebreak errors, There should be no line break before or after '='

Does anyone have suggestions on best practice here? Thank you

@ljharb
Copy link
Collaborator

ljharb commented Oct 1, 2018

I'd disable the max-len rule for this case; line length is a poor proxy anyways for managing complexity.

Our guide also discourages mutation - what object are you deeply modifying?

@ljharb ljharb added the question label Oct 1, 2018
@KayakinKoder
Copy link
Author

Thanks, we'll do that. Not exactly sure what you mean by "what object", but a custom object. I can't reveal our app code of course but an example might be:

const person = { email: 'john@doe.com', visits: {} };

// some business logic

person.visits.visitsToCheckoutPage= 1;

@ljharb
Copy link
Collaborator

ljharb commented Oct 1, 2018

In that case i'd probably do const { visits } = person; visits.visitsToCheckoutPage = 1, but i'd still recommend avoiding mutations entirely.

@KayakinKoder
Copy link
Author

As always, thanks, I'll have to do some reading on how to avoid mutations.

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

No branches or pull requests

2 participants