Skip to content

[sort-type-union-intersection-members] Can null and undefined be sorted separately from other keywords? #2918

Closed
@jgeurts

Description

@jgeurts

Sometimes null gets lost with other types when it's sorted with the rest of the keyword types. Moving null and undefined to their own group would allow them to be sorted independently to other types.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/sort-type-union-intersection-members": "error"
  }
}

Current Behavior

function foo(input: number | null | string | undefined) { ... }

Proposed Behavior

function foo(input: number | string | null | undefined) { ... }

Versions

package version
@typescript-eslint/eslint-plugin 4.12.0
@typescript-eslint/parser 4.12.0
TypeScript 4.1.3
ESLint 7.17.0
node 12.20.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions