Eslint-plugin-react: react/sort-comp `static-variables`

Created on 9 Sep 2019  路  2Comments  路  Source: yannickcr/eslint-plugin-react

The order:

"instance-variables",
"constructor",
"static-methods",
"lifecycle",
"everything-else"
"render",                   

Is mistaking with static members.

For example:

private static const wrong_var = 1;
private b;

constructor(props: any) {
        super(props);

        this.state = {
            ....
        };
}

Throws:

error wrong_var should be placed after constructor react/sort-comp

Which is wrong....

Can you please add "static-variables" as option in the rule?
Expect to be something like:

"static-variables",
"instance-variables",
"constructor",
"static-methods",
"lifecycle",
"everything-else"
"render",                   
enhancement help wanted

Most helpful comment

Thanks for the rapid response.
When this feature will be released?

All 2 comments

That seems reasonable.

Thanks for the rapid response.
When this feature will be released?

Was this page helpful?
0 / 5 - 0 ratings