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

[New]sort-comp: add static-variables option #2408

Conversation

vedadeepta
Copy link
Contributor

Overview of change:

Added option static-variables for checking ordering of static variables.
Default order config

 order: [
    'static-variables',
    'static-methods',
    'lifecycle',
    'everything-else',
    'render'
  ]

@ljharb ljharb changed the title [fix]sort-comp: add static-variables option [New]sort-comp: add static-variables option Sep 11, 2019
lib/rules/sort-comp.js Outdated Show resolved Hide resolved
@ljharb ljharb force-pushed the 2405-add-static-variables-option-to-sort-comp branch from 5ab62a6 to 781bfff Compare September 11, 2019 17:58
@ljharb ljharb merged commit 781bfff into jsx-eslint:master Sep 11, 2019
koggdal added a commit to koggdal/web-scripts that referenced this pull request Oct 24, 2019
`eslint-plugin-react` was updated (jsx-eslint/eslint-plugin-react#2408)
to support a new `static-variables` option to `react/sort-comp`. With this
change, our linting started breaking. After some investigation, it turns out
that `statics` seems to refer to some old `React.createClass` option, so
static variables actually fell into the check for `static-methods`. Now that is
fixed and `static-methods` only check for methods and `static-variables` only
check for variables. So it doesn't seem like a breaking change, but we seem to
have misused the options a bit.

By only adding `static-variables` to our list we should still support older
apps using `React.createClass` (if any), and everything will work again like
before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

react/sort-comp static-variables
2 participants