jsxBracketSameLine – Prettier how to configure

jsxBracketSameLine – Prettier how to configure
Reading Time: < 1 minute

How to install Prettier

      
npm install prettier --save-dev
      
    

How to configure Prettier

      
touch .prettierrc.json
      
    

Add some default configuration:

      
{
	"trailingComma": "es5",
	"tabWidth": 4,
	"printWidth": 120,
	"semi": true,
	"singleQuote": false,
	"useTabs": false,
	"quoteProps": "as-needed",
	"jsxSingleQuote": false,
	"bracketSpacing": false,
	"bracketSameLine": true,
	"arrowParens": "avoid",
	"requirePragma": false,
	"insertPragma": false,
	"proseWrap": "preserve",
	"endOfLine": "lf"
}
      
    

How to ignore folders in Prettier

      
touch .prettierignore
      
    

Add some folders to be ignored. Tipically it will be pretty similar to your .gitignore file

      
# Ignore artifacts:
node_modules
dist
build
coverage
.nyc_output

      
    

How to start detecting issues with Prettier

      
 prettier . -c
      
    
Photo by Greg Rosenke on Unsplash
,

About the author

Andrés Canavesi
Andrés Canavesi

Software Engineer with 15+ experience in software development, specialized in Salesforce, Java and Node.js.


Join 22 other subscribers

Leave a Reply