Skip to content

Conversation

re-taro
Copy link
Contributor

@re-taro re-taro commented Sep 25, 2025

@re-taro re-taro requested a review from camc314 as a code owner September 25, 2025 15:41
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 15:41
Copy link
Contributor

graphite-app bot commented Sep 25, 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 Sep 25, 2025
Copy link
Contributor

@Copilot 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 the only-export-components rule for React linter rules, ensuring modules only export React components and HMR-safe items to support Fast Refresh functionality.

  • Adds comprehensive validation for React component exports and Fast Refresh compatibility
  • Implements configurable options for allowed export names, constant exports, custom HOCs, and JS file checking
  • Provides detailed diagnostics for various violation scenarios including anonymous components, mixed exports, and React contexts

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
crates/oxc_linter/src/rules/react/only_export_components.rs Complete implementation of the only-export-components rule with export analysis, component detection, and diagnostic reporting
crates/oxc_linter/src/snapshots/react_only_export_components.snap Test snapshots showing expected diagnostic outputs for various rule violations
crates/oxc_linter/src/rules.rs Module registration adding the new rule to the linter's rule set

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

codspeed-hq bot commented Sep 25, 2025

CodSpeed Instrumentation Performance Report

Merging #14122 will not alter performance

Comparing re-taro:feat/eslint-plugin-react-refresh (3a41415) with main (3656908)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

  1. 33 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.

@re-taro re-taro force-pushed the feat/eslint-plugin-react-refresh branch 2 times, most recently from d8d2835 to dbdbe75 Compare September 25, 2025 15:55
@camc314 camc314 requested a review from Copilot September 26, 2025 10:08
Copy link
Contributor

@Copilot 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

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@re-taro re-taro force-pushed the feat/eslint-plugin-react-refresh branch 2 times, most recently from b230010 to d059a20 Compare September 27, 2025 06:58
@re-taro re-taro requested a review from camc314 September 27, 2025 06:58
@re-taro
Copy link
Contributor Author

re-taro commented Sep 27, 2025

@camc314

We've addressed the feedback you provided!

Comment on lines 296 to 302
fn should_scan(f: &str, check_js: bool) -> bool {
use std::path::Path;
Path::new(f).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("tsx"))
|| Path::new(f).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("jsx"))
|| (check_js
&& Path::new(f).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("js")))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn should_scan(f: &str, check_js: bool) -> bool {
use std::path::Path;
Path::new(f).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("tsx"))
|| Path::new(f).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("jsx"))
|| (check_js
&& Path::new(f).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("js")))
}
fn should_scan(f: &str, check_js: bool) -> bool {
use std::path::Path;
let ext = Path::new(f).extension().and_then(|e| e.to_str());
matches!(ext, Some(e) if e.eq_ignore_ascii_case("tsx") || e.eq_ignore_ascii_case("jsx"))
|| (check_js && matches!(ext, Some(e) if e.eq_ignore_ascii_case("js")))
}

we can reduce the number of Path:;new calls by restructuring this slightly

@re-taro re-taro force-pushed the feat/eslint-plugin-react-refresh branch from d059a20 to 3a41415 Compare October 4, 2025 08:38
@re-taro re-taro requested a review from camc314 October 4, 2025 08:38
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.

eslint-plugin-react-refresh
2 participants