Skip to content

Add Prettier module augmentation for custom options #981

@gtbuchanan

Description

@gtbuchanan

Problem

The plugin's custom options (xmlWhitespaceSensitivity, xmlSelfClosingSpace, xmlSortAttributesByKey, xmlQuoteAttributes) are not typed on Prettier's Options interface. Consumers get no autocomplete or type narrowing for these options in TypeScript Prettier configs.

Other Prettier plugins (e.g. prettier-plugin-sort-json) include a declare module 'prettier' augmentation:

declare module 'prettier' {
  interface Options {
    xmlWhitespaceSensitivity?: 'strict' | 'preserve' | 'ignore' | undefined;
    xmlSelfClosingSpace?: boolean | undefined;
    // ...other options
  }
}

Expected behavior

Importing the plugin should augment Prettier's Options interface with the plugin's custom options, providing autocomplete and type safety in TypeScript configs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions