Skip to content
This repository was archived by the owner on Mar 7, 2019. It is now read-only.

Commit 0dfdcb0

Browse files
Upgrade eslint-plugin-react
1 parent 584b7a5 commit 0dfdcb0

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

coding-styles/react.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ module.exports = {
1717
'react/jsx-closing-bracket-location': ['warn', 'line-aligned'],
1818

1919
// Disallow spaces inside of curly braces in JSX attributes
20-
'react/jsx-curly-spacing': ['warn', 'never', {
20+
'react/jsx-curly-spacing': ['warn', {
21+
when: 'never',
2122
allowMultiline: true,
2223
}],
2324

environments/react/recommended.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ module.exports = {
2222
// value. This rule will enforce one or the other to keep consistency in your code.
2323
'react/jsx-boolean-value': ['warn', 'never'],
2424

25+
// Enforce the closing tag location for multiline JSX elements
26+
'react/jsx-closing-tag-location': ['warn'],
27+
2528
// Restrict file extensions that may contain JSX
2629
'react/jsx-filename-extension': ['warn', {
2730
extensions: ['.js', '.jsx'],
@@ -44,6 +47,12 @@ module.exports = {
4447
// injected as a text node in JSX statements.
4548
'react/jsx-no-comment-textnodes': 'warn',
4649

50+
// Enforce all defaultProps have a corresponding non-required PropType
51+
// Having defaultProps for non-existent propTypes is likely the result of errors in refactoring
52+
// or a sign of a missing propType. Having a defaultProp for a required property similarly
53+
// indicates a possible refactoring problem
54+
'react/default-props-match-prop-types': 'warn',
55+
4756
// Prevent usage of dangerous JSX properties
4857
'react/no-danger': 'warn',
4958

@@ -124,6 +133,12 @@ module.exports = {
124133
ignoreStateless: true,
125134
}],
126135

136+
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
137+
// Warns if you have shouldComponentUpdate defined when defining a component that extends
138+
// React.PureComponent. While having shouldComponentUpdate will still work, it becomes pointless
139+
// to extend PureComponent.
140+
'react/no-redundant-should-component-update': 'warn',
141+
127142
// Prevent usage of the return value of React.render
128143
// ReactDOM.render() currently returns a reference to the root ReactComponent instance. However,
129144
// using this return value is legacy and should be avoided because future versions of React may

package-lock.json

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"contributors": [],
1010
"dependencies": {
1111
"eslint-plugin-import": "^2.7.0",
12-
"eslint-plugin-react": "^7.0.1"
12+
"eslint-plugin-react": "^7.1.0"
1313
},
1414
"devDependencies": {
1515
"eslint": "^4.2.0"

0 commit comments

Comments
 (0)