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

[eslint-config-airbnb] Update react/sort-comp rule to allow static variables #2107

Closed
alexplumb opened this issue Oct 3, 2019 · 2 comments · Fixed by #2109
Closed

[eslint-config-airbnb] Update react/sort-comp rule to allow static variables #2107

alexplumb opened this issue Oct 3, 2019 · 2 comments · Fixed by #2109

Comments

@alexplumb
Copy link

As of eslint-plugin-react@7.15.0, the static-methods rule for react/sort-comp has seen a breaking change: it's been split into static-methods and static-variables. See the relevant pull request

Please change the rule for react/sort-comp to allow for static variables like so:

order: [
        'static-variables',
        'static-methods',
        'instance-variables',
        'lifecycle',
        '/^on.+$/',
        'getters',
        'setters',
        '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
        'instance-methods',
        'everything-else',
        'rendering',
      ],
@ljharb
Copy link
Collaborator

ljharb commented Oct 3, 2019

It's not a breaking change; static-methods never checked what static-variables checks. Adding that seems reasonable, though, and it'd be semver-patch since the airbnb guide currently doesn't allow using class fields at all.

@alexplumb
Copy link
Author

Ah, makes sense. I upgraded to the newest version and suddenly it was complaining that my static variables had to be at the bottom of the class definition.

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

Successfully merging a pull request may close this issue.

2 participants