React Function Component Definition Rule

How to enforce consistent function type for function components.

2 views

Example to force using arrow function when defining named components

js
// .eslintrc.js
{
  ...,
  "rules": {
    ...,
    "react/function-component-definition": [2, {
      "namedComponents": ["arrow-function"],
    }]
  }
}

References: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md