Skip to content

feat(linter): added rule for react/jsx-max-depth#17279

Merged
camc314 merged 13 commits intooxc-project:mainfrom
Kenzo-Wada:feat/react-jsx-max-depth
Dec 23, 2025
Merged

feat(linter): added rule for react/jsx-max-depth#17279
camc314 merged 13 commits intooxc-project:mainfrom
Kenzo-Wada:feat/react-jsx-max-depth

Conversation

@Kenzo-Wada
Copy link
Contributor

related: #1022

added react/jsx-max-depth rule to oxlinter!

Copilot AI review requested due to automatic review settings December 22, 2025 15:06
@Kenzo-Wada Kenzo-Wada requested a review from camc314 as a code owner December 22, 2025 15:06
@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-codegen Area - Code Generation C-enhancement Category - New feature or request labels Dec 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new linter rule react/jsx-max-depth that enforces a maximum nesting depth for JSX elements and fragments to improve code readability and maintainability.

Key changes:

  • Implemented the jsx-max-depth rule with configurable maximum depth (default: 2)
  • Added comprehensive test coverage with both passing and failing test cases
  • Registered the rule in the linter's rule registry

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_linter/src/rules/react/jsx_max_depth.rs New rule implementation with configuration, depth calculation logic, and test cases
crates/oxc_linter/src/rules.rs Module declaration and rule registration
crates/oxc_linter/src/generated/rule_runner_impls.rs Generated RuleRunner implementation for the new rule
crates/oxc_linter/src/snapshots/react_jsx_max_depth.snap Test snapshot showing expected diagnostic output
crates/oxc_codegen/tests/integration/snapshots/stacktrace_is_correct.snap Unrelated: Node.js version update (v24.10.0 → v24.12.0)
apps/oxlint/src/snapshots/fixtures__tsgolint_rule_options_--type-aware@oxlint.snap Unrelated: Test infrastructure changes
apps/oxlint/src/snapshots/fixtures__tsgolint_--type-aware@oxlint.snap Unrelated: Test infrastructure changes
apps/oxlint/fixtures/tsgolint_fix/fix.ts Unrelated: Test fixture update

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 22, 2025

CodSpeed Performance Report

Merging #17279 will not alter performance

Comparing Kenzo-Wada:feat/react-jsx-max-depth (5aef67a) with main (1005c0a)1

Summary

✅ 4 untouched
⏩ 41 skipped2

Footnotes

  1. No successful run was found on main (91626a6) during the generation of this report, so 1005c0a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Kenzo-Wada Kenzo-Wada force-pushed the feat/react-jsx-max-depth branch from 51e3ec9 to d108541 Compare December 22, 2025 15:39
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-ported the tests, and not all are passing.

Please try to avoin deleting test cases when porting these rules.

Please mark this as ready for review once the tests are passing, and I will take another look

@camc314 camc314 marked this pull request as draft December 22, 2025 15:56
@Kenzo-Wada Kenzo-Wada force-pushed the feat/react-jsx-max-depth branch from 340d13b to 73fe070 Compare December 22, 2025 16:09
@Kenzo-Wada Kenzo-Wada marked this pull request as ready for review December 22, 2025 16:52
@Kenzo-Wada
Copy link
Contributor Author

@camc314 thanks always! i think i've done all tests, now ready to review.

Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance regression here is massive - we'll need to get it down to a much more reasonable level before it can be merged

@Kenzo-Wada Kenzo-Wada requested a review from camc314 December 23, 2025 02:50
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@camc314 camc314 self-assigned this Dec 23, 2025
@camc314 camc314 merged commit c813582 into oxc-project:main Dec 23, 2025
19 checks passed
@Kenzo-Wada Kenzo-Wada deleted the feat/react-jsx-max-depth branch December 23, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-codegen Area - Code Generation A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants