Skip to content

Instantly share code, notes, and snippets.

@karpolan
Last active May 2, 2024 19:53
Show Gist options
  • Save karpolan/2c573b5767bc9b65db9936c7fad4daac to your computer and use it in GitHub Desktop.
Save karpolan/2c573b5767bc9b65db9936c7fad4daac to your computer and use it in GitHub Desktop.
Prettier config for React App
module.exports = {
printWidth: 120, // max 120 chars in line, code is easy to read
useTabs: false, // use spaces instead of tabs
tabWidth: 2, // "visual width" of of the "tab"
trailingComma: 'es5', // add trailing commas in objects, arrays, etc.
semi: true, // add ; when needed
singleQuote: true, // '' for stings instead of ""
bracketSpacing: true, // import { some } ... instead of import {some} ...
arrowParens: 'always', // braces even for single param in arrow functions (a) => { }
jsxSingleQuote: false, // "" for react props, like in html
bracketSameLine: false, // pretty JSX
endOfLine: 'lf', // 'lf' for linux, 'crlf' for windows, we need to use 'lf' for git
};
@rgarlik
Copy link

rgarlik commented Jan 7, 2023

good config

@Ryan-Biondo
Copy link

I was wondering what was making my code so spaced out even within the brackets and it was the printWidth setting. The default setting at 80 characters tends to cut short if your variable names have any length. 120 characters is much more manageable, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment