@u3u/prettier-config
Version:
🎨 The most perfect Prettier config
110 lines (104 loc) • 3.57 kB
TypeScript
import * as prettier from 'prettier';
import { Config, Plugin } from 'prettier';
import deepmerge from 'deepmerge';
import _default from './index.js';
declare const defineConfig: <T extends Config>(config: T) => T;
declare const definePlugin: <T extends Plugin>(plugin: T) => T;
declare const extendConfig: <T extends Config | typeof _default>(userConfig: T, options?: deepmerge.Options) => {
importOrderTypeScriptVersion: string;
iniSpaceAroundEquals: boolean;
jsonRecursiveSort: boolean;
multilineArraysWrapThreshold: number;
overrides: ({
files: string[];
options: {
parser: "nginx";
};
} | {
files: string[];
options: {
parser: "ini";
};
} | {
files: string[];
options: {
parser: "blade";
};
})[];
plugins: string[];
sortHtmlAttributes: string;
sortTailwindcssClasses: boolean;
wrapAttributes: string;
xmlSortAttributesByKey: boolean;
xmlWhitespaceSensitivity: string;
arrowParens: "always";
bracketSameLine: false;
bracketSpacing: true;
embeddedLanguageFormatting: "auto";
endOfLine: "lf";
htmlWhitespaceSensitivity: "ignore";
jsxSingleQuote: false;
printWidth: 120;
proseWrap: "preserve";
quoteProps: "as-needed";
semi: true;
singleAttributePerLine: false;
singleQuote: true;
tabWidth: 2;
trailingComma: "all";
useTabs: false;
vueIndentScriptAndStyle: false;
} & {
[x: string]: /*elided*/ any;
overrides: Array<{
files: string | string[];
excludeFiles?: string | string[];
options?: prettier.Options;
}>;
semi: boolean;
singleQuote: boolean;
jsxSingleQuote: boolean;
trailingComma: "none" | "es5" | "all";
bracketSpacing: boolean;
objectWrap: "preserve" | "collapse";
bracketSameLine: boolean;
rangeStart: number;
rangeEnd: number;
parser: "css" | "typescript" | "acorn" | "angular" | "babel-flow" | "babel-ts" | "babel" | "espree" | "flow" | "glimmer" | "graphql" | "html" | "json-stringify" | "json" | "json5" | "jsonc" | "less" | "lwc" | "markdown" | "mdx" | "meriyah" | "scss" | "vue" | "yaml" | (Pick<string, never> & {
_?: never | undefined;
});
filepath: string;
requirePragma: boolean;
insertPragma: boolean;
proseWrap: "always" | "never" | "preserve";
arrowParens: "avoid" | "always";
plugins: Array<string | prettier.Plugin>;
htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
endOfLine: "auto" | "lf" | "crlf" | "cr";
quoteProps: "as-needed" | "consistent" | "preserve";
vueIndentScriptAndStyle: boolean;
embeddedLanguageFormatting: "auto" | "off";
singleAttributePerLine: boolean;
experimentalOperatorPosition: "start" | "end";
experimentalTernaries: boolean;
jsxBracketSameLine: boolean;
printWidth: number;
tabWidth: number;
useTabs: boolean;
parentParser: string;
__embeddedInHtml: boolean;
};
declare const withSortPlugin: (plugin: Required<Pick<Plugin, "parsers">>) => {
readonly options: any;
readonly parsers: {
readonly [x: string]: {
preprocess: any;
parse: (text: string, options: prettier.ParserOptions<any>) => any;
astFormat: string;
hasPragma?: ((text: string) => boolean) | undefined;
locStart: (node: any) => number;
locEnd: (node: any) => number;
};
};
};
export { defineConfig, definePlugin, extendConfig, withSortPlugin };