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

Arrow functions breaks require-optimization #2374

Closed
sarjanen opened this issue Aug 6, 2019 · 1 comment · Fixed by #2385
Closed

Arrow functions breaks require-optimization #2374

sarjanen opened this issue Aug 6, 2019 · 1 comment · Fixed by #2385

Comments

@sarjanen
Copy link

sarjanen commented Aug 6, 2019

Like title says, it seems like arrow functions breaks require-optimization. I'm getting error on this:

import React from 'react';

export default class Foo extends React.Component {
  bar() { }
  render() { return null; }
}

But not on:

import React from 'react';

export default class Foo extends React.Component {
  bar = () =>  { }
  render() { return null; }
}
@ljharb
Copy link
Member

ljharb commented Aug 6, 2019

Class fields should never have functions in them; but it seems reasonable for the rule to handle this case.

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

Successfully merging a pull request may close this issue.

2 participants