Skip to content

Commit 1a3d3d1

Browse files
committed
Add documentation for require-render-return
1 parent 63ef07e commit 1a3d3d1

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ The plugin has a [recommended configuration](#user-content-recommended-configura
9191
* [prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition
9292
* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX
9393
* [require-extension](docs/rules/require-extension.md): Restrict file extensions that may be required
94+
* [require-render-return](docs/rules/require-render-return.md): Enforce ES5 or ES6 class for returning value in render function
9495
* [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children
9596
* [sort-comp](docs/rules/sort-comp.md): Enforce component methods order
9697
* [sort-prop-types](docs/rules/sort-prop-types.md): Enforce propTypes declarations alphabetical sorting

docs/rules/require-render-return.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Enforce ES5 or ES6 class for returning value in render function (require-render-return)
2+
3+
When writing the `render` method in a component it could be easy to forgot to return the JSX content. This rule will warn you if the `return` statement is missing.
4+
5+
## Rule Details
6+
7+
The following patterns are considered warnings:
8+
9+
```js
10+
var Hello = React.createClass({
11+
render() {
12+
<div>Hello</div>;
13+
}
14+
});
15+
16+
class Hello extends React.Component {
17+
render() {
18+
<div>Hello</div>;
19+
}
20+
}
21+
```
22+
23+
The following patterns are not considered warnings:
24+
25+
```js
26+
var Hello = React.createClass({
27+
render() {
28+
return <div>Hello</div>;
29+
}
30+
});
31+
32+
class Hello extends React.Component {
33+
render() {
34+
return <div>Hello</div>;
35+
}
36+
}
37+
```

0 commit comments

Comments
 (0)