Skip to content

sortInterfaces: function properties are not treated as methods #97

Open
@EvgenyOrekhov

Description

@EvgenyOrekhov

There are 2 notations for methods:

  1. shorthand method: baz(): string
  2. function property: baz: () => string

sortInterfaces: true works with shorthand method signature, but not with function property signature.

Minimal reproducible case:

    "sort-class-members/sort-class-members": [
      "error",
      {
        "order": [
          "[properties]",
          "[methods]"
        ],
        "sortInterfaces": true
      }
    ]
interface Foo {
  baz: () => string;
  bar: string;
}

Expected: warning "Expected property bar to come before method baz"

Actual: no warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions