Skip to content

Enforce the React component typing convention with lint #1207

Open

Description

@EhabY

Review on #1205 suggested typing components with React.FC and returning React.ReactNode. The repo already follows a different convention, but only by habit, so it is easy to drift from it either way.

Current convention

  • Components are plain functions. React.FC is used nowhere.
  • 52 component files return React.JSX.Element. ReactNode appears only where a component can return null or non-element nodes (for example Tooltip).
  • @repo/ui annotates the return type of every exported component. The panel packages mostly do not: 25 files with exported components have no return type (17 in packages/tasks, 8 in packages/workspaces).

Proposal

oxlint 1.92 can enforce most of this:

  • typescript/no-restricted-types: ban React.FC, FC, and React.FunctionComponent, with a message pointing at plain function components.
  • typescript/explicit-module-boundary-types: require explicit return types on exported functions, starting with packages/ui (already compliant) and then the panel packages once their 25 files are annotated.
  • Document the React.JSX.Element vs ReactNode rule in packages/AGENTS.md: return React.JSX.Element unless the component can return null or other non-element nodes. Lint cannot tell those apart, so this part stays a written rule.

Check the React Compiler output after annotating, since return types do not change what it compiles.

Activity

  1. linear-code commented on Nov 19, 2026

    @linear-code
  2. self-assigned this
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions