@jmlweb/prettier-config-tailwind 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +29 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
## 📦 Installation
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
|
|
19
|
+
pnpm add -D @jmlweb/prettier-config-tailwind prettier prettier-plugin-tailwindcss
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
**Note**: The `prettier-plugin-tailwindcss` plugin must be installed as a dev dependency.
|
|
@@ -84,6 +84,32 @@ This package extends `@jmlweb/prettier-config-base` and adds:
|
|
|
84
84
|
- And all other base settings
|
|
85
85
|
- ✅ `prettier-plugin-tailwindcss` - Automatically sorts Tailwind CSS classes
|
|
86
86
|
|
|
87
|
+
## 🤔 Why Use This?
|
|
88
|
+
|
|
89
|
+
> **Philosophy**: Tailwind class order should be consistent and automatic. Don't waste time manually organizing utility classes.
|
|
90
|
+
|
|
91
|
+
This package extends the base Prettier config with Tailwind-specific class sorting. Following Tailwind's recommended class order improves readability and makes it easier to scan markup quickly.
|
|
92
|
+
|
|
93
|
+
### Design Decisions
|
|
94
|
+
|
|
95
|
+
**Automatic Class Sorting**: Uses the official `prettier-plugin-tailwindcss`
|
|
96
|
+
|
|
97
|
+
- **Why**: Tailwind's recommended order groups related utilities together (layout → spacing → typography → visual effects), making classes easier to read and understand at a glance
|
|
98
|
+
- **Trade-off**: Initial formatting may reorder classes you've manually organized, but consistency across the codebase outweighs individual preferences
|
|
99
|
+
- **When to override**: If you have a strong reason to deviate from Tailwind's official recommendations (rare)
|
|
100
|
+
|
|
101
|
+
**Plugin Load Order**: The Tailwind plugin is loaded last in Prettier's plugin chain
|
|
102
|
+
|
|
103
|
+
- **Why**: Ensures Tailwind class sorting doesn't conflict with other Prettier plugins and runs after all other formatting
|
|
104
|
+
- **Trade-off**: None - this is the recommended approach by Tailwind Labs
|
|
105
|
+
- **When to override**: Never - this is a technical requirement, not a stylistic choice
|
|
106
|
+
|
|
107
|
+
**Extends Base Config**: Inherits all settings from `@jmlweb/prettier-config-base`
|
|
108
|
+
|
|
109
|
+
- **Why**: Maintains consistency with non-Tailwind projects while adding Tailwind-specific features
|
|
110
|
+
- **Trade-off**: If you need to change base formatting rules, you must override the base config settings
|
|
111
|
+
- **When to override**: When you need different base Prettier settings than the standard config
|
|
112
|
+
|
|
87
113
|
## 🎯 When to Use
|
|
88
114
|
|
|
89
115
|
Use this package when:
|
|
@@ -126,8 +152,8 @@ Add formatting scripts to your `package.json`:
|
|
|
126
152
|
Then run:
|
|
127
153
|
|
|
128
154
|
```bash
|
|
129
|
-
|
|
130
|
-
|
|
155
|
+
pnpm format # Format all files
|
|
156
|
+
pnpm format:check # Check formatting without modifying files
|
|
131
157
|
```
|
|
132
158
|
|
|
133
159
|
## 📋 Requirements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/prettier-config-tailwind",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Prettier configuration for jmlweb projects with Tailwind CSS support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
52
|
-
"@jmlweb/prettier-config-base": "1.0.
|
|
52
|
+
"@jmlweb/prettier-config-base": "1.0.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"prettier": "^3.3.3",
|