Skip to content

Instantly share code, notes, and snippets.

@jpmarra
Created October 10, 2019 19:28
Show Gist options
  • Save jpmarra/4530f881a0b73a1fa969fee6b49c702c to your computer and use it in GitHub Desktop.
Save jpmarra/4530f881a0b73a1fa969fee6b49c702c to your computer and use it in GitHub Desktop.
Prettier Config
module.exports = {
// Specify the line length that the printer will wrap on.
printWidth: 120,
// Specify the number of spaces per indentation-level.
tabWidth: 4,
// Indent lines with tabs instead of spaces.
useTabs: false,
// Print semicolons at the ends of statements.
semi: true,
// Use single quotes instead of double quotes.
singleQuote: true,
// Use single quotes instead of double quotes in JSX.
jsxSingleQuote: false,
// Print trailing commas wherever possible when multi-line.
// (A single-line array, for example, never gets trailing commas.)
trailingComma: 'none',
// Print spaces between brackets in object literals.
bracketSpacing: true,
// Put the > of a multi-line JSX element at the end of the last line
// instead of being alone on the next line (does not apply to self
// closing elements).
jsxBracketSameLine: false,
// Include parentheses around a sole arrow function parameter.
arrowParens: 'always',
// Format only a segment of a file.
rangeStart: 0,
rangeEnd: Infinity,
// // Specify which parser to use.
// parser: undefined,
// Specify the file name to use to infer which parser to use.
filepath: undefined,
// Prettier can restrict itself to only format files that contain a special
// comment, called a pragma, at the top of the file. This is very useful
// when gradually transitioning large, unformatted codebases to prettier.
requirePragma: false,
// Prettier can insert a special @format marker at the top of files
// specifying that the file has been formatted with prettier
insertPragma: false,
// By default, Prettier will wrap markdown text as-is since some services
// use a linebreak-sensitive renderer, e.g. GitHub comment and BitBucket.
proseWrap: 'preserve',
// Specify the global whitespace sensitivity for HTML files.
htmlWhitespaceSensitivity: 'css',
// By default, Prettier preserves a flavor of line endings a given file
// has already used.
endOfLine: 'auto',
overrides: [
{
files: '**/*.json',
options: {
tabWidth: 2
}
}
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment