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

sort-comp: 'instance-variables' doesn't work properly #1587

Closed
ktaras opened this issue Dec 6, 2017 · 5 comments
Closed

sort-comp: 'instance-variables' doesn't work properly #1587

ktaras opened this issue Dec 6, 2017 · 5 comments

Comments

@ktaras
Copy link

ktaras commented Dec 6, 2017

Extracted as a separate issue from #599 (comment)

It seems like instance-variables works only for state.
I specified following order:

      - static-methods
      - instance-variables
      - lifecycle
      - everything-else
      - render

When I declare

class CoolComponent extends Component {
  state = {};
  ...
}

it's OK, but when I add some custom property, e.g.:

class CoolComponent extends Component {
  state = {};
  someList = [];
  ...
}

it throws an error:

someList should be placed after componentWillUnmount
@ktaras ktaras changed the title sort-comp: instance-variables doesn't work properly sort-comp: 'instance-variables' doesn't work properly Dec 6, 2017
@silvenon
Copy link
Contributor

silvenon commented Dec 9, 2017

This is indeed an issue using the latest version, [email protected], but after I linked to latest master it seems to work fine. The only error I'm getting using your code is that state should be below someList, i.e. it needs to be the last instance variable. That's probably intentional because state is special.

@ljharb
Copy link
Member

ljharb commented Dec 9, 2017

Looks like this is fixed, just awaiting a release of the plugin (ping @yannickcr).

@ljharb ljharb closed this as completed Dec 9, 2017
@denkristoffer
Copy link
Contributor

@yannickcr Any word on when a new release could be ready? I'd love to get the fix in master into the upcoming Create React App 2.0 release.

@m10
Copy link

m10 commented Jan 26, 2018

still getting this on 7.6.0

@ljharb
Copy link
Member

ljharb commented Jan 27, 2018

@m10 can you file a new issue for that?

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

No branches or pull requests

5 participants