@jmlweb/prettier-config-base 1.0.2 → 1.0.3
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 +6 -0
- package/README.md +118 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
npm install --save-dev @jmlweb/prettier-config-base prettier
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
23
|
+
|
|
22
24
|
## 🚀 Quick Start
|
|
23
25
|
|
|
24
26
|
### Option 1: Using `package.json` (Recommended)
|
|
@@ -153,9 +155,125 @@ See real-world usage examples:
|
|
|
153
155
|
|
|
154
156
|
## 🔗 Related Packages
|
|
155
157
|
|
|
158
|
+
### Internal Packages
|
|
159
|
+
|
|
156
160
|
- [`@jmlweb/prettier-config-tailwind`](../prettier-config-tailwind) - Adds Tailwind CSS class sorting
|
|
157
161
|
- [`@jmlweb/eslint-config-base`](../eslint-config-base) - ESLint config that works seamlessly with this Prettier config
|
|
158
162
|
|
|
163
|
+
### External Tools
|
|
164
|
+
|
|
165
|
+
- [Prettier](https://prettier.io/) - Opinionated code formatter
|
|
166
|
+
- [ESLint](https://eslint.org/) - Pluggable linting utility (use with eslint-config-prettier to avoid conflicts)
|
|
167
|
+
- [Editor Plugins](https://prettier.io/docs/en/editors.html) - Format on save in VS Code, IntelliJ, and more
|
|
168
|
+
|
|
169
|
+
## ⚠️ Common Issues
|
|
170
|
+
|
|
171
|
+
> **Note:** This section documents known issues and their solutions. If you encounter a problem not listed here, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
172
|
+
|
|
173
|
+
### Conflicts with ESLint
|
|
174
|
+
|
|
175
|
+
**Symptoms:**
|
|
176
|
+
|
|
177
|
+
- Code gets formatted by Prettier then changed back by ESLint auto-fix
|
|
178
|
+
- Linting errors about formatting (quotes, semicolons, etc.)
|
|
179
|
+
|
|
180
|
+
**Cause:**
|
|
181
|
+
|
|
182
|
+
- ESLint has formatting rules that conflict with Prettier
|
|
183
|
+
- Both tools trying to format the same code
|
|
184
|
+
|
|
185
|
+
**Solution:**
|
|
186
|
+
|
|
187
|
+
Install `eslint-config-prettier` to disable conflicting ESLint rules:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm install --save-dev eslint-config-prettier
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Then add it to your ESLint config (must be last):
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
// eslint.config.js (flat config)
|
|
197
|
+
import prettier from 'eslint-config-prettier';
|
|
198
|
+
|
|
199
|
+
export default [
|
|
200
|
+
// ... other configs
|
|
201
|
+
prettier, // Must be last!
|
|
202
|
+
];
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Or use [`@jmlweb/eslint-config-base`](../eslint-config-base) which already includes this integration.
|
|
206
|
+
|
|
207
|
+
### IDE Not Formatting on Save
|
|
208
|
+
|
|
209
|
+
**Symptoms:**
|
|
210
|
+
|
|
211
|
+
- Files don't format automatically when saving
|
|
212
|
+
- Manual format command works but auto-format doesn't
|
|
213
|
+
|
|
214
|
+
**Cause:**
|
|
215
|
+
|
|
216
|
+
- IDE Prettier extension not installed or configured
|
|
217
|
+
- Wrong formatter selected as default
|
|
218
|
+
|
|
219
|
+
**Solution:**
|
|
220
|
+
|
|
221
|
+
For VS Code, install the Prettier extension and add to `.vscode/settings.json`:
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
226
|
+
"editor.formatOnSave": true,
|
|
227
|
+
"[javascript]": {
|
|
228
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
229
|
+
},
|
|
230
|
+
"[typescript]": {
|
|
231
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Configuration Not Being Picked Up
|
|
237
|
+
|
|
238
|
+
**Symptoms:**
|
|
239
|
+
|
|
240
|
+
- Prettier uses default settings instead of your config
|
|
241
|
+
- Custom options not applied
|
|
242
|
+
|
|
243
|
+
**Cause:**
|
|
244
|
+
|
|
245
|
+
- Configuration file not in the correct location
|
|
246
|
+
- Multiple config files conflicting
|
|
247
|
+
|
|
248
|
+
**Solution:**
|
|
249
|
+
|
|
250
|
+
1. Ensure config is in project root (not nested directories)
|
|
251
|
+
2. Use only one configuration method (package.json OR .prettierrc)
|
|
252
|
+
3. Check for conflicting configs in parent directories
|
|
253
|
+
4. Restart your IDE/editor
|
|
254
|
+
|
|
255
|
+
To verify Prettier finds your config:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
npx prettier --find-config-path src/index.ts
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 🔄 Migration Guide
|
|
262
|
+
|
|
263
|
+
### Upgrading to a New Version
|
|
264
|
+
|
|
265
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
266
|
+
|
|
267
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
268
|
+
|
|
269
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
270
|
+
|
|
271
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
272
|
+
|
|
273
|
+
## 📜 Changelog
|
|
274
|
+
|
|
275
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
276
|
+
|
|
159
277
|
## 📄 License
|
|
160
278
|
|
|
161
279
|
MIT
|