Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display-name: return class expression #419

Closed
Cellule opened this issue Jan 30, 2016 · 1 comment
Closed

display-name: return class expression #419

Cellule opened this issue Jan 30, 2016 · 1 comment

Comments

@Cellule
Copy link
Contributor

Cellule commented Jan 30, 2016

Currently if you have the following

import React, {Component} from "react";
function someDecorator(ComposedComponent) {
  return class MyDecorator extends Component {
    render() {return <ComposedComponent {...this.props} />;}
  };
}
module.exports = someDecorator;

I get the following warning

3:10  warning  Component definition is missing display name  react/display-name

In this case I would expect the rule to see the class name and not warn

@Cellule
Copy link
Contributor Author

Cellule commented Jan 30, 2016

For now you can circumvent this with the following change

import React, {Component} from "react";
function someDecorator(ComposedComponent) {
  class MyDecorator extends Component {
    render() {return <ComposedComponent {...this.props} />;}
  }
  return MyDecorator;
}
module.exports = someDecorator;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants