Skip to content

upthen/prettier-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prettier-config

npm downloads downloads

upthen's personal prettier-config

Description

When I create a new project, If I want to reuse my prettier config, I used to copy the .prettierrc from an old project to the new one, that seems to be foolish, so why not make it a package and just install it on wherever I want.

It is why I have this project. Yeah, just very simple but useful for me.

Usages

  1. Install
npm i prettier @upthen/prettier-config@latest
  1. Set prettier

Add prettier config in package.json like the following codes:

{

  ...
  "prettier": "@upthen/prettier-config",
}
  1. Use in terminal

npx prettier --check --write path

npx prettier --check --write .

# or

npx prettier -c -w .

# . is the path of files you want to format.
  1. Use With VsCode Extension: Prettier
  • Install Prettier Extension
  • Add the following config in VsCode settings.json
{
	"editor.formatOnSave": true,
	"editor.defaultFormatter": "esbenp.prettier-vscode",
	"[javascript]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"[typescript]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	}
}
  • If you have some custom setting config in your workspace settings.json, Confirm the prettier config won't be override. You may need to add the following config into it.
// workspace setttings.json
{
	"editor.formatOnSave": true,
	"editor.defaultFormatter": "esbenp.prettier-vscode"
}

Important

Confirm to add the above config into settings.json, or it may not effects when you enter Ctrl + S or Command + S with VsCode Extension.

About

upthen's personal prettier-config

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published