Skip to content

feat: add unionAndIntersectionType.operatorPosition option#785

Open
lo1tuma wants to merge 1 commit into
dprint:mainfrom
lo1tuma:feat/union-intersection-operator-position
Open

feat: add unionAndIntersectionType.operatorPosition option#785
lo1tuma wants to merge 1 commit into
dprint:mainfrom
lo1tuma:feat/union-intersection-operator-position

Conversation

@lo1tuma
Copy link
Copy Markdown

@lo1tuma lo1tuma commented May 22, 2026

Closes #759.

Adds a per-node unionAndIntersectionType.operatorPosition accepting maintain | sameLine | nextLine. Resolves with the same precedence as the other per-node operator-position overrides (node > global operatorPosition > nextLine), so the default is unchanged.

  • sameLine places | / & at the end of the wrapped line — useful when paired with ESLint's @stylistic/operator-linebreak: ['after'].
  • maintain preserves the author's per-pair position, falling back to dprint's default when the source is single-line (same heuristic as conditionalExpression.operatorPosition).

Resolves with the same precedence as the other per-node operator-position
overrides: node value > global `operatorPosition` > `nextLine`. Default
behavior is unchanged. `sameLine` places `|` / `&` at the end of the
wrapped line; `maintain` preserves the author's position (and falls back
to dprint's default when the source is single-line, matching how
`conditionalExpression.operatorPosition` handles `maintain`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-line export type MyType = ("a" | "b" | "c") does not respect "operatorPosition": "sameLine" setting

1 participant