Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sort-comp rule: fix bug affecting instance-methods group
Regarding this issue: jsx-eslint#599 sort-comp: Consider separating static fields & instance fields into separate groups and this PR, released in v7.6.0: jsx-eslint#1470 Add instance-methods and instance-variables to sort-comp. there's a bug in the implementation of the `instance-methods` group. Class instance methods can be declared in two different ways: class Main extends React.Component { // MethodDefinition -> FunctionExpression foo() {} // ClassProperty -> ArrowFunctionExpression bar = () => {} } Using the `babel-eslint` parser, if a class instance method is declared as a `FunctionExpression`, then the parent AST node is a `MethodDefinition`, but the `sort-comp` rule is expecting the parent node to be a `ClassProperty`, which is wrong.
- Loading branch information