@reacture-io/prettier-config
v0.0.1
Published
A configuration for prettier formatter
Readme
@reactute-io/prettier-config
A shared Prettier configuration package for Reacture.
Features
- Consistent formatting: Ensures all code follows the same formatting standards
- Tailwind CSS support: Includes
prettier-plugin-tailwindcssfor optimal Tailwind class sorting - Modern defaults: Configured with sensible defaults for modern JavaScript/TypeScript development
- Easy integration: Simple setup process for any project
Installation
Install the package as a dev dependency:
npm install --save-dev @reacture-io/prettier-config
# or
yarn add --dev @reacture-io/prettier-config
# or
pnpm add --save-dev @reacture-io/prettier-configUsage
Basic Setup
Create a .prettierrc.js file in your project root:
module.exports = require("@reacture-io/prettier-config/base");Or if you're using ES modules, create a .prettierrc.mjs:
import baseConfig from "@reacture-io/prettier-config/base";
export default baseConfig;Package.json Configuration
Alternatively, you can add the configuration directly to your package.json:
{
"prettier": "@reacture-io/prettier-config/base"
}Configuration
The base configuration includes the following settings:
- Trailing comma: ES5 style
- Tab width: 2 spaces
- Semicolons: Always
- Quotes: Single quotes
- JSX quotes: Single quotes
- Tabs: Spaces only
- Print width: 80 characters
- Bracket spacing: Enabled
- Bracket same line: Enabled
- Arrow function parentheses: Always
- Single attribute per line: Enabled
- End of line: LF (Unix style)
- Plugins: Tailwind CSS plugin included
IDE Integration
VS Code
- Install the Prettier extension
- Set Prettier as the default formatter
- Enable format on save (optional)
Add to your VS Code settings:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}Other Editors
Most modern editors support Prettier configuration files automatically. The configuration will be picked up when you have a .prettierrc.js or package.json configuration in your project.
Scripts
Add these scripts to your package.json for convenient formatting:
{
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check ."
}
}Ignoring Files
Create a .prettierignore file to exclude files from formatting:
node_modules
dist
build