Integrate eslint react-fc-component-definition, react-render-function-definition#5902
Merged
Integrate eslint react-fc-component-definition, react-render-function-definition#5902
react-fc-component-definition, react-render-function-definition#5902Conversation
swansontec
approved these changes
Jan 16, 2026
Contributor
swansontec
left a comment
There was a problem hiding this comment.
This will work, but I found two optional cleanups we could do.
805218f to
2988c9b
Compare
Collaborator
Author
|
Updated description, added one more rule |
react-fc-component-definitionreact-fc-component-definition, react-render-function-definition
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
dd0fd28 to
0024e76
Compare
swansontec
approved these changes
Jan 19, 2026
| }, | ||
|
|
||
| // Also check regular function declarations | ||
| FunctionDeclaration(node) { |
Contributor
There was a problem hiding this comment.
Optional: I wonder if the other rule should check functions too. Seems like it would miss function Foo(): React.ReactElement, which should become const Foo: React.FC<Props> = props =>
0024e76 to
3005665
Compare
Enforces that render helper functions (camelCase functions starting with "render") use React.ReactElement return type instead of ReactNode or JSX.Element. - Flags ReactNode (too broad - use ReactElement or explicit union) - Flags JSX.Element (use ReactElement for consistency) - Allows ReactElement, ReactElement | null, and other explicit unions
3005665 to
3249d16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
edge/react-fc-component-definition & edge/react-render-function-definition
Two complementary ESLint rules enforcing consistent React component and render function typing conventions.
Rule Details
edge/react-fc-component-definitionTargets PascalCase-named arrow functions that return JSX types. Components should use
React.FC<Props>instead of explicit return types.edge/react-render-function-definitionTargets camelCase functions starting with
render(e.g.,renderItem,renderHeader). Render helpers should useReact.ReactElementinstead ofReactNodeorJSX.Element.Why These Rules?
For Components (
React.FC<Props>):React.FChandles thechildrenprop type automaticallyReact.FC, reducing verbosityFor Render Helpers (
React.ReactElement):ReactNodeis too broad (includes strings, numbers, arrays)JSX.Elementshould beReactElementfor uniformityReactElement | nullExamples
Components (PascalCase)
Incorrect
Correct
Render Helpers (camelCase)
Incorrect
Correct
Configuration
Both rules are enabled as warnings by default in the Edge ESLint configuration:
Related
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have:
Note
Adds two custom ESLint rules and enables them as warnings to standardize React typing.
edge/react-fc-component-definition(enforceReact.FC<Props>for PascalCase components) andedge/react-render-function-definition(enforceReact.ReactElementforrender*helpers)scripts/eslint-plugin-edge/index.mjsand bumped plugin version to0.1.3eslint.config.mjsaswarnWritten by Cursor Bugbot for commit 3249d16. This will update automatically on new commits. Configure here.