Skip to content

Instantly share code, notes, and snippets.

@armand1m
Last active March 26, 2022 10:41
Show Gist options
  • Save armand1m/75972070ce98e3169b3d2917f60f0a5b to your computer and use it in GitHub Desktop.
Save armand1m/75972070ce98e3169b3d2917f60f0a5b to your computer and use it in GitHub Desktop.
Add prettier to a node project in one script
yarn add -D prettier
cat > ./.prettierrc <<EOL
{
"printWidth": 70,
"singleQuote": true,
"trailingComma": "es5"
}
EOL
npx add-project-script -n "lint" -v "prettier --check './src/**/*.{tsx,ts,js,json}'"
npx add-project-script -n "lint:fix" -v "prettier --write './src/**/*.{tsx,ts,js,json}'"
@armand1m
Copy link
Author

make sure you're running this on the project working directory

@armand1m
Copy link
Author

this gist raw endpoint is also added in my URL shortener, so it enables you to use it like this:

curl -SLsf https://go.d1m.dev/installprettier | sh

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