Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 1.11 KB

typescript-react-component-type.md

File metadata and controls

26 lines (17 loc) · 1.11 KB

@typehut/typescript-react-component-type

enforce FC and FunctionComponent types to one or the other

  • ⭐️ This rule is included in plugin:@typehut/recommended preset.
  • ✒️ The --fix option on the command line can automatically fix some of the problems reported by this rule.

By enforcing or not suppressing the React component type, a sense of unity is created. You can also enforce React.FunctionComponent if "Do not omit" is recommended as a style guide for naming.

Rule Details

This rule enforces the React component type to either React.FC or React.FunctionComponent. (Similarly, enforce rules on VFC and VoidFunctionComponent.)

Options

This rule has either a string option:

  • "omit" (default) enforces consistent use of React.FC and React.VFC
  • "raw" enforces consistent use of React.FunctionComponent and React.VoidFunctionComponent

Implementation