Permalink
da6b3ce Apr 28, 2016
@yannickcr @ljharb
38 lines (29 sloc) 710 Bytes

Enforce ES5 or ES6 class for returning value in render function (require-render-return)

When writing the render method in a component it is easy to forget to return the JSX content. This rule will warn if the return statement is missing.

Rule Details

The following patterns are considered warnings:

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

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

The following patterns are not considered warnings:

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

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