[eslint config] Turn ignorePureComponent option on for react/prefer-stateless-function

Otherwise, there is no way to write pure components that don't use state, refs, or lifecycle methods.

Stateless functions are not treated internally as pure components, and are rerendered every time.
This commit is contained in:
Thomas Rix
2017-04-20 16:51:02 -04:00
committed by Jordan Harband
parent 07d37db67a
commit 71932e1eed

View File

@@ -176,7 +176,7 @@ module.exports = {
// Require stateless functions when not using lifecycle methods, setState or ref
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
'react/prefer-stateless-function': 'error',
'react/prefer-stateless-function': ['error', { ignorePureComponent: true }],
// Prevent missing props validation in a React component definition
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md