[eslint config] [breaking] enable react/require-render-return

This commit is contained in:
Jordan Harband
2016-04-06 22:57:44 -07:00
parent 7b5731157f
commit 7c0bb0a6de
2 changed files with 17 additions and 0 deletions

View File

@@ -137,6 +137,9 @@ module.exports = {
// Restrict file extensions that may be required
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md
'react/require-extension': [0, { 'extensions': ['.jsx'] }],
// Require render() methods to return something
// https://github.com/yannickcr/eslint-plugin-react/pull/502
'react/require-render-return': 2,
// Prevent extra closing tags for components without children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
'react/self-closing-comp': 2,

View File

@@ -399,6 +399,20 @@
}
```
- Be sure to return a value in your `render` methods. eslint: [`require-render-return`](https://github.com/yannickcr/eslint-plugin-react/pull/502)
```jsx
// bad
render() {
(<div />);
}
// good
render() {
return (<div />);
}
```
## Ordering
- Ordering for `class extends React.Component`: