-
Notifications
You must be signed in to change notification settings - Fork 22
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
ESLint: jsx-max-depth #7819
ESLint: jsx-max-depth #7819
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7819 +/- ##
==========================================
- Coverage 72.56% 72.54% -0.03%
==========================================
Files 1274 1274
Lines 39834 39834
Branches 7399 7399
==========================================
- Hits 28905 28897 -8
- Misses 10929 10937 +8 ☔ View full report in Codecov by Sentry. |
I would be open to this, but I think there are exceptions where nesting deeply makes the code more readable, such as top level App components that need to nest a lot of Providers/Wrappers/etc. I wouldn't want to force ourselves to arbitrarily split those up into multiple stacks of nested 1-line component calls, so we'd just need to suppress this lint rule at those places. |
This is fair. But I would suggest that those situations would be so rare we could readily eslint-ignore those. |
I agree with Ben. This rule only makes sense if we view it as an opportunity to break up larger components into smaller ones, however I'm not entirely convinced:
I do like some sort of hard limit on excessive code though, but only when it's very obviously "bad" and hard to follow: "10K LOC files", "1K LOC functions", "20 nested levels". The |
Here's an example of one of the violations. Breaking this up into smaller components would dramatically increase clarity. pixiebrix-extension/src/components/brickModalNoTags/BrickModal.tsx Lines 230 to 315 in 5df7760
Number of levels is something I'm definitely willing to have a discussion on. I honestly picked 5 more or less at random. Just a "feels kinda right" amount. If we were to merge the rule, I would argue to keep it on "error" and actually fix everything. We should also look at actually enforcing our |
Closing in favor of: #7865 |
What does this PR do?
Discussion
Future Work
Checklist