61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import type { Config, Options } from "prettier";
|
|
|
|
type Overrides = Readonly<{
|
|
excludeFiles?: Array<string> | string;
|
|
files: Array<string> | string;
|
|
options?: Options;
|
|
}>;
|
|
|
|
const configIni: Overrides = {
|
|
files: [".npmrc", ".env", ".env.*"],
|
|
options: {
|
|
parser: "ini",
|
|
},
|
|
};
|
|
|
|
const configJson: ReadonlyArray<Overrides> = [
|
|
// Pour le tri des clés des fichiers JSON.
|
|
{
|
|
excludeFiles: ["package.json"],
|
|
files: ["*.json"],
|
|
options: {
|
|
jsonRecursiveSort: true,
|
|
plugins: ["prettier-plugin-sort-json"],
|
|
},
|
|
},
|
|
// Pour package.json.
|
|
{
|
|
files: ["package.json"],
|
|
options: {
|
|
plugins: ["prettier-plugin-pkg"],
|
|
},
|
|
},
|
|
];
|
|
|
|
const configClassique: Readonly<Config> = {
|
|
arrowParens: "avoid",
|
|
bracketSameLine: false,
|
|
bracketSpacing: true,
|
|
embeddedLanguageFormatting: "auto",
|
|
endOfLine: "lf",
|
|
experimentalOperatorPosition: "start",
|
|
experimentalTernaries: true,
|
|
htmlWhitespaceSensitivity: "ignore",
|
|
iniSpaceAroundEquals: false,
|
|
jsdocPreferCodeFences: true,
|
|
jsdocVerticalAlignment: true,
|
|
overrides: [configIni, ...configJson],
|
|
plugins: ["prettier-plugin-curly", "prettier-plugin-ini", "prettier-plugin-jsdoc", "prettier-plugin-sh"],
|
|
printWidth: 120,
|
|
proseWrap: "never",
|
|
quoteProps: "as-needed",
|
|
semi: true,
|
|
singleAttributePerLine: true,
|
|
singleQuote: false,
|
|
tabWidth: 2,
|
|
trailingComma: "all",
|
|
tsdoc: true,
|
|
useTabs: false,
|
|
};
|
|
|
|
export { configClassique, configIni, configJson };
|