Skip to content

Commit a9e1261

Browse files
re-tarocamc314
andauthored
feat(linter): implement react-refresh/only-export-components (#14122)
## Summary close: #12386 I re-implemented only-export-components rule for react. originals: - docs: https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/README.md - code: https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/src/only-export-components.ts - test: https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/src/only-export-components.test.ts --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
1 parent b13c4bd commit a9e1261

File tree

4 files changed

+1046
-0
lines changed

4 files changed

+1046
-0
lines changed

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,11 @@ impl RuleRunner for crate::rules::react::no_unknown_property::NoUnknownProperty
21742174
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
21752175
}
21762176

2177+
impl RuleRunner for crate::rules::react::only_export_components::OnlyExportComponents {
2178+
const NODE_TYPES: Option<&AstTypesBitset> = None;
2179+
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::RunOnce;
2180+
}
2181+
21772182
impl RuleRunner for crate::rules::react::prefer_es6_class::PreferEs6Class {
21782183
const NODE_TYPES: Option<&AstTypesBitset> = None;
21792184
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;

crates/oxc_linter/src/rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ pub(crate) mod react {
369369
pub mod no_string_refs;
370370
pub mod no_unescaped_entities;
371371
pub mod no_unknown_property;
372+
pub mod only_export_components;
372373
pub mod prefer_es6_class;
373374
pub mod react_in_jsx_scope;
374375
pub mod require_render_return;
@@ -1036,6 +1037,7 @@ oxc_macros::declare_all_lint_rules! {
10361037
react::no_string_refs,
10371038
react::no_unescaped_entities,
10381039
react::no_unknown_property,
1040+
react::only_export_components,
10391041
react::prefer_es6_class,
10401042
react::react_in_jsx_scope,
10411043
react::require_render_return,

0 commit comments

Comments
 (0)