Skip to content

destructuring-assignment in class properties #1875

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

Closed
alexandernanberg opened this issue Jul 4, 2018 · 3 comments
Closed

destructuring-assignment in class properties #1875

alexandernanberg opened this issue Jul 4, 2018 · 3 comments

Comments

@alexandernanberg
Copy link
Contributor

First I'd like to just say that I like the new destructuring-assignment rule because I think it enforces a lot more clarity and explicitness. However I'm having problems with it throwing errors inside of class properties.

class MyComponent extends React.Component {
  state = {
    value: this.props.defaultValue,
  };

  ...
}

IMO this should be an exception and be totally valid or at least have the option to exclude it just from this use-case. I know that I could move it inside a constructor and destructure it there but I'd rather not do that.

@ljharb
Copy link
Member

ljharb commented Jul 4, 2018

Duplicate of #1800.

An option would be great.

@ljharb ljharb closed this as completed Jul 4, 2018
@archived-m
Copy link

Doesn't seem like a duplicate, #1800 is about it erroring in files that have nothing to do with react. I have the same issue, complains about destructuring in class properties

archived-m added a commit to oSoc18/healthdata that referenced this issue Jul 18, 2018
@ljharb
Copy link
Member

ljharb commented Jul 18, 2018

Fair point; I'll reopen.

@ljharb ljharb reopened this Jul 18, 2018
archived-m pushed a commit to oSoc18/healthdata that referenced this issue Jul 20, 2018
* Update geojson data to include Brussels

* Don't enforce lines between class members

* Get demographic data

* Extend province model

* Add provinces to store

* Disable bugged rule

See issue jsx-eslint/eslint-plugin-react#1875

* Make provinces individually selectable
archived-m pushed a commit to oSoc18/healthdata that referenced this issue Jul 20, 2018
* Update geojson data to include Brussels

* Don't enforce lines between class members

* Get demographic data

* Extend province model

* Add provinces to store

* Disable bugged rule

See issue jsx-eslint/eslint-plugin-react#1875

* Make provinces individually selectable
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