bryanrsmith / eslint-plugin-sort-class-members

An ESLint rule for enforcing consistent ES6 class member order
119 stars 21 forks source link

@typescript-eslint/parser v5 compatibility #71

Closed EvgenyOrekhov closed 2 years ago

EvgenyOrekhov commented 2 years ago

Upgrading @typescript-eslint/parser to v5 causes eslint-plugin-sort-class-members to treat all properties as methods.

Code example:

export default class Example {
  static staticProperty;
  static staticArrowFunctionProperty = () => {};
  @decorator decoratedProperty = "bar";
  property = "bar";
  arrowFunctionProperty = () => {};
  constructor() {}
}

For the above code it starts to give errors like

Expected constructor to come before method decoratedProperty
Expected constructor to come before method property
Expected constructor to come before method arrowFunctionProperty
svanherk commented 2 years ago

We're seeing these errors as well in JS classes - looks like the linter starts complaining about this after upgrading to the new eslint 8.