Skip to content

Commit

Permalink
Add documentation for require-render-return
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcr committed Apr 11, 2016
1 parent 63ef07e commit 1a3d3d1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ The plugin has a [recommended configuration](#user-content-recommended-configura
* [prop-types](docs/rules/prop-types.md): Prevent missing props validation in a React component definition
* [react-in-jsx-scope](docs/rules/react-in-jsx-scope.md): Prevent missing `React` when using JSX
* [require-extension](docs/rules/require-extension.md): Restrict file extensions that may be required
* [require-render-return](docs/rules/require-render-return.md): Enforce ES5 or ES6 class for returning value in render function
* [self-closing-comp](docs/rules/self-closing-comp.md): Prevent extra closing tags for components without children
* [sort-comp](docs/rules/sort-comp.md): Enforce component methods order
* [sort-prop-types](docs/rules/sort-prop-types.md): Enforce propTypes declarations alphabetical sorting
Expand Down
37 changes: 37 additions & 0 deletions docs/rules/require-render-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Enforce ES5 or ES6 class for returning value in render function (require-render-return)

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.

## Rule Details

The following patterns are considered warnings:

```js
var Hello = React.createClass({
render() {
<div>Hello</div>;
}
});

class Hello extends React.Component {
render() {
<div>Hello</div>;
}
}
```

The following patterns are not considered warnings:

```js
var Hello = React.createClass({
render() {
return <div>Hello</div>;
}
});

class Hello extends React.Component {
render() {
return <div>Hello</div>;
}
}
```

0 comments on commit 1a3d3d1

Please sign in to comment.