Skip to content

Rule for spacing around punctuation in types #51

@ddurschlag6river

Description

@ddurschlag6river

Possibly as part of type-annotation-spacing, possible as a new rule. Right now, the punctuation that I can think of are | (union), & (intersection), [] (array or tuple), and {} (anonymous object definition).

The obvious preferences I can see for | and & are no-spaces (string|number) and spaces (string | number). Tuples and anonymous types are a bit different -- the two relevant spaces are after [ and before ], but not before [ or after ]. A more real-world-y example might be:

type keyedEntity = baseEntity & { primaryKey: string|number; records: [ number, string ][]; };

This could be formatted a number of different ways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: new plugin ruleNew rule request for eslint-pluginformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy