Skip to content

Commit

Permalink
Add react/function-component-definition rule
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 13, 2020
1 parent ecbeb45 commit cee904f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ module.exports = {
'react/button-has-type': 'error',
'react/jsx-child-element-spacing': 'error',
'react/default-props-match-prop-types': 'error',
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function'
}
],
'react/no-access-state-in-setstate': 'error',
'react/no-array-index-key': 'error',
'react/no-children-prop': 'error',
Expand Down Expand Up @@ -55,7 +62,8 @@ module.exports = {
'react/require-default-props': [
'error',
{
forbidDefaultForRequired: true
forbidDefaultForRequired: true,
ignoreFunctionalComponents: true
}
],
'react/self-closing-comp': 'error',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
"devDependencies": {
"ava": "^2.1.0",
"eslint": "^6.0.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^2.3.0",
"is-plain-obj": "^2.0.0",
"react": "^16.8.6",
"temp-write": "^4.0.0"
},
"peerDependencies": {
"eslint": ">=6",
"eslint-plugin-react": ">=7.17.0",
"eslint-plugin-react": ">=7.18.3",
"eslint-plugin-react-hooks": ">=2.3.0"
}
}

0 comments on commit cee904f

Please sign in to comment.