Skip to content

Conversation

@RoelGo
Copy link
Contributor

@RoelGo RoelGo commented Aug 11, 2025

This is my first rust code, so an expert review might be appreciated. Especially the report_missing_curly_for_text_node method could use a good look. I am not sure I made the right choices when it comes to performance as I miss a lot of the nuance rust offers.

@RoelGo RoelGo requested a review from camc314 as a code owner August 11, 2025 19:23
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 11, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Aug 11, 2025
@RoelGo RoelGo changed the title feat(linter): implement fixer for jsx_curly_brace_presence.rs feat(linter): implement fixer for jsx_curly_brace_presence Aug 11, 2025
@RoelGo RoelGo force-pushed the feat/add-jsx_curly_brace_presence-fixer branch 2 times, most recently from 47cb5e5 to 6f152d0 Compare August 11, 2025 19:33
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 13, 2025

CodSpeed Instrumentation Performance Report

Merging #13005 will not alter performance

Comparing RoelGo:feat/add-jsx_curly_brace_presence-fixer (e537b3d) with main (1385c71)1

Summary

✅ 34 untouched benchmarks

Footnotes

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

@camc314
Copy link
Contributor

camc314 commented Aug 13, 2025

thanks for this, the direction looks good, but CI is failing.

@RoelGo
Copy link
Contributor Author

RoelGo commented Aug 13, 2025

thanks for this, the direction looks good, but CI is failing.

Didn't setup clippy on my dev env yet. Will rebase and fix failing CI tonight.

@RoelGo RoelGo force-pushed the feat/add-jsx_curly_brace_presence-fixer branch from 6f152d0 to 2be0314 Compare August 13, 2025 10:19
@RoelGo RoelGo force-pushed the feat/add-jsx_curly_brace_presence-fixer branch from 2be0314 to 2d6b909 Compare August 13, 2025 17:01
@camc314 camc314 requested a review from Copilot August 14, 2025 15:52
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.

Thanks for this, it's great!

@camc314 camc314 merged commit 920e06f into oxc-project:main Aug 14, 2025
26 checks passed
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 implements a fixer for the jsx_curly_brace_presence ESLint rule, enabling automatic correction of curly brace issues in JSX. The implementation adds comprehensive fix suggestions for both unnecessary and missing curly braces scenarios.

Key changes:

  • Added fixer functionality to automatically correct curly brace presence issues
  • Implemented complex text node handling for multiline content with HTML entities
  • Enhanced diagnostic messages with helpful fix suggestions

Reviewed Changes

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

File Description
crates/oxc_linter/src/rules/react/jsx_curly_brace_presence.rs Main implementation adding fixer logic, helper functions for text processing, and comprehensive test cases
crates/oxc_linter/src/snapshots/react_jsx_curly_brace_presence.snap Updated snapshot with new help messages from the fixer implementation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

build_missing_curly_fix_context_for_part(span, string_value, 0)
.iter()
.copied()
.collect::<std::vec::Vec<_>>()
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

Using std::vec::Vec instead of oxc_allocator::Vec may not be optimal in this codebase. Consider using the project's allocator-based Vec for consistency and potential performance benefits.

Suggested change
.collect::<std::vec::Vec<_>>()
string_value.match_indices('\n').map(|(i, _)| i).collect::<Vec<_>>();
let fix_contexts = if line_matches.is_empty() {
build_missing_curly_fix_context_for_part(span, string_value, 0)
.iter()
.copied()
.collect::<Vec<_>>()

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants