Skip to content

feat(linter/react): implement function-component-definition rule#24471

Merged
camc314 merged 18 commits into
oxc-project:mainfrom
cellison-figma:feat/react-function-component-definition
Jul 14, 2026
Merged

feat(linter/react): implement function-component-definition rule#24471
camc314 merged 18 commits into
oxc-project:mainfrom
cellison-figma:feat/react-function-component-definition

Conversation

@cellison-figma

Copy link
Copy Markdown
Contributor

Summary

Adds a native Oxlint implementation of the eslint-plugin-react function-component-definition rule. This implementation is a port of the rule source, test suite, and autofix logic.

Related #1022

AI Disclosure

GPT 5.6 Sol was used to assist with implementation of this rule.

@cellison-figma
cellison-figma requested a review from camc314 as a code owner July 13, 2026 19:25
@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 66 skipped benchmarks1


Comparing cellison-figma:feat/react-function-component-definition (ac713c5) with main (7f1f585)

Open in CodSpeed

Footnotes

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

@camc314 camc314 added the A-linter Area - Linter label Jul 13, 2026
@camc314 camc314 changed the title feat(linter): add react function component definition rule feat(linter/react): implement function-component-definition rule Jul 14, 2026
@camc314 camc314 self-assigned this Jul 14, 2026

@camc314 camc314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

@camc314
camc314 merged commit 16a65f2 into oxc-project:main Jul 14, 2026
28 checks passed
graphite-app Bot pushed a commit that referenced this pull request Jul 15, 2026
## Summary

- detect React function components from reachable JSX/null returns using a shared CFG utility
- avoid function-component-definition false positives for callbacks, lowercase helpers, class methods, and functions that only contain JSX
- avoid display-name false positives for higher-order functions that contain but do not return JSX

fixes  [https://github.com/oxc-project/oxc/issues/22685](https://github.com/oxc-project/oxc/issues/22685)

closes [#22755](#22755)

follow up to #24471
graphite-app Bot pushed a commit that referenced this pull request Jul 15, 2026
## Summary

- detect React function components from reachable JSX/null returns using a shared CFG utility
- avoid function-component-definition false positives for callbacks, lowercase helpers, class methods, and functions that only contain JSX
- avoid display-name false positives for higher-order functions that contain but do not return JSX

fixes  [https://github.com/oxc-project/oxc/issues/22685](https://github.com/oxc-project/oxc/issues/22685)

closes [#22755](#22755)

follow up to #24471
camc314 added a commit that referenced this pull request Jul 21, 2026
# Oxlint
### 💥 BREAKING CHANGES

- 54cc121 ast: [**BREAKING**] Split `MetaProperty` into `ImportMeta` and
`NewTarget` (#24557) (camc314)

### 🚀 Features

- 7b045cd minfier: Drop last break from last switch case (#24673)
(Armano)
- dd18383 linter/node: Implement no-top-level-await rule (#24634)
(Connor Shea)
- 16a65f2 linter/react: Implement function-component-definition rule
(#24471) (Cole Ellison)
- 7f1f585 linter: Reuse `jest/padding-around-test-blocks` for
`vitest/padding-around-test-blocks` (#24519) (Mikhail Baev)
- 99978a8 linter/import/consistent-type-specifier-style: Support
`prefer-top-level-if-only-type-imports` option (#24502) (camc314)

### 🐛 Bug Fixes

- 0184ad6 linter/unicorn/no-useless-undefined: Preserve valid parameter
defaults (#24686) (camc314)
- 8694167 linter/eslint/prefer-destructuring: Handle typed declarations
(#24616) (camc314)
- 477cf0f linter/eslint/no-throw-literal: Handle assigned errors
(#24561) (Cole Ellison)
- ac9200a linter: Detect React components from returned JSX (#24521)
(camc314)
- c0a6522 linter/eslint/no-useless-computed-key: Allow TS syntax in
computed keys (#24524) (Cole Ellison)

### ⚡ Performance

- 346eed1 linter/unicorn/prefer-event-target: Only run on `Class` and
`NewExpression` nodes (#24685) (Mikhail Baev)
- 7be5cf0 oxlint/lsp: Only invoke lint on code actions when document is
not opened (#24676) (Sysix)
- d3f07a0 diagnostics: Box OxcDiagnosticInner to reduce binary size
(#24665) (Boshen)
- 90ae040 linter/reporter/stylish: Compute diagnostic Info once per
diagnostic (#24525) (connorshea)

### 📚 Documentation

- e6f7174 linter/valid-expect: Fix correct example being identical to
incorrect one (#24468) (mkan0141)
# Oxfmt
### 💥 BREAKING CHANGES

- 54cc121 ast: [**BREAKING**] Split `MetaProperty` into `ImportMeta` and
`NewTarget` (#24557) (camc314)

### 🚀 Features

- 3d22307 parser: Add `ParseOptions::enable_ident_hashes` (#24491)
(Boshen)

### 🐛 Bug Fixes

- 6fe866a oxfmt: Keep tailwind classes glued to template expr with
`preserveWhitespace` (#24609) (leaysgur)
- 33e32d8 formatter_css: Use `line_suffix` for EOL line comment (#24580)
(leaysgur)
- 5f76998 formatter_graphql: Keep same line comments pending across
intervening tokens (#24579) (leaysgur)

Co-authored-by: Boshen <[email protected]>
Co-authored-by: Cameron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants