From 71932e1eed314dee508bdd7b3044c8e1e2d3609c Mon Sep 17 00:00:00 2001 From: Thomas Rix Date: Thu, 20 Apr 2017 16:51:02 -0400 Subject: [PATCH] [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. --- packages/eslint-config-airbnb/rules/react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-airbnb/rules/react.js index 407bf8fc..caf62dd8 100644 --- a/packages/eslint-config-airbnb/rules/react.js +++ b/packages/eslint-config-airbnb/rules/react.js @@ -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