Closed krainboltgreene closed 2 years ago
If you use React.PureComponent
instead of the named import, does the same thing happen?
Yes.
If I remove the currying, it no longer warns me. It seems like it gets confused by the connect()
currying.
Same thing happening here even with a simple component:
// package.json
"eslint": "^4.6.1",
"eslint-plugin-react": "^7.3.0",
// .eslintrc
{
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
"no-console": 0,
"max-len": [
1,
120,
2
],
"no-param-reassign": [
2,
{
"props": false
}
],
"no-continue": 0,
"no-underscore-dangle": 0,
"generator-star-spacing": 0,
"class-methods-use-this": 0,
"import/no-extraneous-dependencies": 0,
"no-use-before-define": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/prefer-stateless-function": [2, { "ignorePureComponents": true }]
},
"env": {
"jest": true
}
}
Strange. This case is supported and has tests for it: https://github.com/yannickcr/eslint-plugin-react/blob/master/tests/lib/rules/prefer-stateless-function.js#L42
@lucasbento are you setting your React version correctly in eslintrc? PureComponent doesn't exist before v15.2 or so
Seeing the same issue having just created a new project with create-react-native-app
Given that we have passing tests, I'm going to close this. If you're still seeing issues in the latest version, please file a new issue.
criteria:
When true the rule will ignore Components extending from React.PureComponent that use this.props or this.context.
PureComponent
this.props
eslint-plugin-react version:
eslint file:
Code:
Error: