prettier-plugin-embed
Version:
A configurable Prettier plugin to format embedded languages in JS/TS files.
87 lines (86 loc) • 3.89 kB
TypeScript
import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";
declare const DEFAULT_COMMENTS: readonly ["sql"];
type Comments = AutocompleteStringList<(typeof DEFAULT_COMMENTS)[number]>;
type DefaultCommentsHolder = StringListToInterfaceKey<typeof DEFAULT_COMMENTS>;
declare const DEFAULT_TAGS: readonly ["sql"];
type Tags = AutocompleteStringList<(typeof DEFAULT_TAGS)[number]>;
type DefaultTagsHolder = StringListToInterfaceKey<typeof DEFAULT_TAGS>;
declare const SQL_PLUGINS: readonly ["prettier-plugin-sql", "prettier-plugin-sql-cst"];
type SqlPlugin = (typeof SQL_PLUGINS)[number];
declare const SQL_CST_PARSERS: readonly ["sqlite", "bigquery", "mysql", "mariadb", "postgresql"];
type SqlCstParser = (typeof SQL_CST_PARSERS)[number];
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedSqlIdentifiers";
declare const EMBEDDED_LANGUAGE_COMMENTS: "embeddedSqlComments";
declare const EMBEDDED_LANGUAGE_TAGS: "embeddedSqlTags";
declare const EMBEDDED_LANGUAGE_PLUGIN: "embeddedSqlPlugin";
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedSqlParser";
export declare const options: {
readonly embeddedSqlIdentifiers: {
readonly category: "Embed";
readonly type: "string";
readonly array: true;
readonly default: [{
readonly value: ["sql"];
}];
readonly description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.";
readonly deprecated: "Please use `embeddedSqlComments` or `embeddedSqlTags`.";
};
readonly embeddedSqlComments: {
readonly category: "Embed";
readonly type: "string";
readonly array: true;
readonly default: [{
readonly value: ["9ff2b366e8ca4c97b9aed1a29b5b94ed"];
}];
readonly description: "Block comments that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.";
};
readonly embeddedSqlTags: {
readonly category: "Embed";
readonly type: "string";
readonly array: true;
readonly default: [{
readonly value: ["9ff2b366e8ca4c97b9aed1a29b5b94ed"];
}];
readonly description: "Tags that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.";
};
readonly embeddedSqlPlugin: {
category: string;
type: "choice";
default: "prettier-plugin-sql";
description: string;
choices: {
value: "prettier-plugin-sql" | "prettier-plugin-sql-cst";
description: string;
}[];
};
readonly embeddedSqlParser: {
category: string;
type: "choice";
default: "sqlite";
description: string;
choices: {
value: "bigquery" | "mariadb" | "mysql" | "postgresql" | "sqlite";
description: string;
}[];
};
};
type Options = typeof options;
declare module "../types.js" {
interface EmbeddedOptions extends Options {
}
interface EmbeddedDefaultCommentsHolder extends DefaultCommentsHolder {
}
interface EmbeddedDefaultTagsHolder extends DefaultTagsHolder {
}
interface PluginEmbedOptions {
/**
* @deprecated Please use `embeddedSqlComments` or `embeddedSqlTags`.
*/
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: (Comments[number] | Tags[number])[];
[EMBEDDED_LANGUAGE_COMMENTS]?: Comments;
[EMBEDDED_LANGUAGE_TAGS]?: Tags;
[EMBEDDED_LANGUAGE_PLUGIN]?: SqlPlugin;
[EMBEDDED_LANGUAGE_PARSER]?: SqlCstParser;
}
}
export {};