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

Proposal: No deep nested hell - max-depth and max-nested-callbacks #794

Closed
tunnckoCore opened this issue Feb 21, 2017 · 2 comments

Comments

@tunnckoCore
Copy link

commented Feb 21, 2017

Digging more and more in ESLint rules, i found some good ones which enforces good style and more readable code. This issue is for max-depth and max-nested-callbacks rules - both not fixable.

Suggested configuration.

{
  "max-nested-callbacks": ["error", { "max": 3 }],
  "max-depth": ["error", { "max": 3 }]
}

The max option, may be more sensible like 5 for example. But i believe it should not be more. I kinda feel it is too restrictive if it is 3 or 4, because with combination of arrow functions you can easily get 3-4 depths nesting. But separation is good thing.

@feross

This comment has been minimized.

Copy link
Member

commented Feb 21, 2017

I think this rule is too restrictive. In test code, I often deeply nest callbacks because it's easier and tests are easier to write when they're verbose and repetitive.

@feross feross closed this Feb 21, 2017

@tunnckoCore

This comment has been minimized.

Copy link
Author

commented Feb 21, 2017

In test code, I often deeply nest callbacks because it's easier and tests are easier to write when they're verbose and repetitive.

I'm agree with that and also has such cases, but that's why i suggested 5, because it is completely enough in that cases.

@tunnckoCore tunnckoCore referenced this issue Feb 21, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.