Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39d7c73

Browse files
committed
[eslint config] [patch] class-methods-use-this: exempt React lifecycle methods
1 parent 976845e commit 39d7c73

File tree

1 file changed

+17
-2
lines changed
  • packages/eslint-config-airbnb/rules

1 file changed

+17
-2
lines changed

packages/eslint-config-airbnb/rules/react.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module.exports = {
22
plugins: [
3-
'react'
3+
'react',
44
],
55
parserOptions: {
66
ecmaFeatures: {
77
jsx: true,
88
},
99
},
1010
ecmaFeatures: {
11-
jsx: true
11+
jsx: true,
1212
},
1313

1414
// View link below for react rules documentation
@@ -18,6 +18,21 @@ module.exports = {
1818
// http://eslint.org/docs/rules/jsx-quotes
1919
'jsx-quotes': ['error', 'prefer-double'],
2020

21+
'class-methods-use-this': ['error', {
22+
exceptMethods: [
23+
'render',
24+
'getInitialState',
25+
'getDefaultProps',
26+
'componentWillMount',
27+
'componentDidMount',
28+
'componentWillReceiveProps',
29+
'shouldComponentUpdate',
30+
'componentWillUpdate',
31+
'componentDidUpdate',
32+
'componentWillUnmount',
33+
],
34+
}],
35+
2136
// Prevent missing displayName in a React component definition
2237
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
2338
'react/display-name': ['off', { ignoreTranspilerName: false }],

0 commit comments

Comments
 (0)