steven-tey / precedent

An opinionated collection of components, hooks, and utilities for your Next.js project.
https://precedent.dev
MIT License
4.65k stars 406 forks source link

Improve `format:write` script #78

Open andriilive opened 6 months ago

andriilive commented 6 months ago

Current format:write script command code violates DRY principles 😿

An example of duplicated prettier command code from package.json:

"format": "prettier \"**/*.{css,js,json,jsx,ts,tsx}\"",
"format:write": "prettier --write \"**/*.{css,js,json,jsx,ts,tsx}\""

Improved script 👉🏻 https://github.com/steven-tey/precedent/pull/76

Common example

"format": "prettier \"**/*.{css,js,json,jsx,ts,tsx}\"",
"format:write": "npm run format -- --write"

Prettier with --cache

"format": "prettier --cache \"**/*.{css,js,json,jsx,ts,tsx}\"",
"format:write": "npm run format -- --write"