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

prefer-stateless-function with decorators #1034

Closed
captify-abogatyrov opened this issue Jan 20, 2017 · 2 comments
Closed

prefer-stateless-function with decorators #1034

captify-abogatyrov opened this issue Jan 20, 2017 · 2 comments

Comments

@captify-abogatyrov
Copy link

captify-abogatyrov commented Jan 20, 2017

i am using decorators, decorators work just with class so i must not use stateless function

@dragDropContext(HTML5Backend)
class ToDoList extends Component {
  render() {
    const { data } = this.props;
    return (
      <div>
        {data.map(((todo, i) => <SingleToDo
          data={todo}
        />))}
      </div>
    );
  }
}

and in this case i have error prefer-stateless-function

@ljharb
Copy link
Member

ljharb commented Jan 20, 2017

It makes sense that a decorated class should not be reported here.

benstepp added a commit to benstepp/eslint-plugin-react that referenced this issue Feb 23, 2017
Currently prefer-stateless-function warns when using a decorated class
over a stateless function. The decorator syntax only works with classes,
so it makes sense not to warn in this case.

Fixes jsx-eslint#1034
@OscarBarrett
Copy link

OscarBarrett commented Apr 19, 2017

Could a new release be published that includes this please?

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

No branches or pull requests

3 participants