Skip to content

Instantly share code, notes, and snippets.

@Profesor08
Created November 10, 2024 16:37
Show Gist options
  • Save Profesor08/d085641fd06fc6cdd6576a518e1db52f to your computer and use it in GitHub Desktop.
Save Profesor08/d085641fd06fc6cdd6576a518e1db52f to your computer and use it in GitHub Desktop.
Prettier config
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
/**
* Specify the line length that the printer will wrap on.
* @default 80
*/
printWidth: 120,
/**
* Specify the number of spaces per indentation-level.
* @default 2
*/
tabWidth: 2,
/**
* Indent lines with tabs instead of spaces
* @default false
*/
useTabs: false,
/**
* Print semicolons at the ends of statements.
* @default true
*/
semi: true,
/**
* Use single quotes instead of double quotes.
* @default false
*/
singleQuote: false,
/**
* Use single quotes in JSX.
* @default false
*/
jsxSingleQuote: false,
/**
* Print trailing commas wherever possible.
* @default "all"
*/
trailingComma: "all",
/**
* Print spaces between brackets in object literals.
* @default true
*/
bracketSpacing: true,
/**
* Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
* alone on the next line (does not apply to self closing elements).
* @default false
*/
bracketSameLine: false,
/**
* Format only a segment of a file.
* @default 0
*/
rangeStart: 0,
/**
* Format only a segment of a file.
* @default Number.POSITIVE_INFINITY
*/
rangeEnd: Number.POSITIVE_INFINITY,
/**
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
* @default "preserve"
*/
proseWrap: "always",
/**
* Include parentheses around a sole arrow function parameter.
* @default "always"
*/
arrowParens: "always",
/**
* Provide ability to support new languages to prettier.
*/
plugins: ["prettier-plugin-tailwindcss"],
/**
* How to handle whitespaces in HTML.
* @default "css"
*/
htmlWhitespaceSensitivity: "css",
/**
* Which end of line characters to apply.
* @default "lf"
*/
endOfLine: "lf",
/**
* Change when properties in objects are quoted.
* @default "as-needed"
*/
quoteProps: "as-needed",
/**
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
* @default false
*/
vueIndentScriptAndStyle: false,
/**
* Control whether Prettier formats quoted code embedded in the file.
* @default "auto"
*/
embeddedLanguageFormatting: "auto",
/**
* Enforce single attribute per line in HTML, Vue and JSX.
* @default false
*/
singleAttributePerLine: false,
/**
* Use curious ternaries, with the question mark after the condition, instead
* of on the same line as the consequent.
* @default false
*/
experimentalTernaries: true,
/**
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
* @default false
* @deprecated use bracketSameLine instead
*/
jsxBracketSameLine: false,
tailwindFunctions: ["clsx"],
};
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment