bryanrsmith / eslint-plugin-sort-class-members

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

Sorting properties alphabetical creates unintended whiteline #75

Closed FloodGames closed 2 years ago

FloodGames commented 2 years ago

Sorting Typescript properties alphabetical I got it to work with the following Rules in eslint:

    "sort-class-members/sort-class-members": [
            2,
            {
                "order": [
                    "[static-properties]",
                    "[static-methods]",
                    "[properties]",
                    "[conventional-private-properties]",
                    "constructor",
                    "[methods]",
                    "[conventional-private-methods]"
                ],
      "groups": {
        "properties": [{"sort": "alphabetical", "type": "property" }]
      },
                "accessorPairPositioning": "getThenSet"
            }
        ],

This finally works to sort Typescript properties in alphabetical order, only it creates a white line between constructor and the properties. How do I get rid of this whitespace?

export class TentSpine extends Spine {
  aThing: string
  fs: number
  randomPropertyA: number
  randomPropertyB: string

  constructor(spineData: ISkeletonData) {
    super(spineData)
   ...
  }
}

Instead of

export class TentSpine extends Spine {
  aThing: string
  fs: number
  randomPropertyA: number
  randomPropertyB: string
  constructor(spineData: ISkeletonData) {
    super(spineData)
   ...
  }
}
FloodGames commented 2 years ago

Changing this line "properties": [{"sort": "alphabetical", "type": "property" }] to "static-properties": [{"sort": "alphabetical", "type": "property" }]

didnt do it

FloodGames commented 2 years ago

"lines-between-class-members":["error", "never"],

fixed it