Prettier configuration for Daniel's TypeScript-based development workflow.
Install Prettier as a dev dependency:
npm install --save-dev prettierCreate a .prettierrc.json file in your project root:
{
"jsxSingleQuote": true,
"trailingComma": "es5"
}Create a .prettierignore file to exclude certain directories and files:
node_modules/
Additional entries based on project type:
- Next.js projects: Add
.next/ - Drizzle ORM projects: Add
drizzle/meta/ - Snaplet projects: Add
src/db/.snaplet/
Example for a Next.js project with Drizzle:
node_modules/
.next/
drizzle/meta/
Add the format script to your package.json:
{
"scripts": {
"format": "prettier --write ."
}
}Create an .editorconfig file to ensure consistent formatting across different editors:
root = true
[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# These .json files are automatically generated
[{package.json}]
indent_style = space
indent_size = 2
# YAML does not allow tabs
[*.{yml,yaml}]
indent_style = space
indent_size = 2Note: If your project has a package-lock.json file, update the JSON section to:
[{package.json,package-lock.json}]
indent_style = space
indent_size = 2Run formatting manually:
npm run formatOr enable format-on-save in VS Code (see VS Code configuration guide).