@jmlweb/prettier-config-base 1.0.0

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/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # @jmlweb/prettier-config-base
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@jmlweb/prettier-config-base)](https://www.npmjs.com/package/@jmlweb/prettier-config-base)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-339933.svg)](https://nodejs.org/)
6
+
7
+ > Base Prettier configuration package that provides shared formatting rules for consistent code style across projects.
8
+
9
+ ## ✨ Features
10
+
11
+ - 🎯 **Consistent Formatting**: Standardized code style across all projects
12
+ - 🔧 **Zero Configuration**: Works out of the box with sensible defaults
13
+ - 📦 **Extensible**: Foundation for framework-specific Prettier configs
14
+ - 🚀 **Modern Defaults**: Optimized for modern JavaScript/TypeScript projects
15
+
16
+ ## 📦 Installation
17
+
18
+ ```bash
19
+ npm install --save-dev @jmlweb/prettier-config-base prettier
20
+ ```
21
+
22
+ ## 🚀 Quick Start
23
+
24
+ ### Option 1: Using `package.json` (Recommended)
25
+
26
+ Add to your `package.json`:
27
+
28
+ ```json
29
+ {
30
+ "prettier": "@jmlweb/prettier-config-base"
31
+ }
32
+ ```
33
+
34
+ ### Option 2: Using `.prettierrc.js`
35
+
36
+ Create a `.prettierrc.js` file in your project root:
37
+
38
+ ```javascript
39
+ module.exports = require('@jmlweb/prettier-config-base');
40
+ ```
41
+
42
+ ### Option 3: Using `.prettierrc.json`
43
+
44
+ Create a `.prettierrc.json` file:
45
+
46
+ ```json
47
+ "@jmlweb/prettier-config-base"
48
+ ```
49
+
50
+ ## 📋 Configuration
51
+
52
+ This package provides the following Prettier settings:
53
+
54
+ | Option | Value | Description |
55
+ | --------------- | ------------ | ------------------------------------------ |
56
+ | `semi` | `true` | Use semicolons at the end of statements |
57
+ | `singleQuote` | `true` | Use single quotes instead of double quotes |
58
+ | `tabWidth` | `2` | Use 2 spaces for indentation |
59
+ | `trailingComma` | `'all'` | Add trailing commas wherever possible |
60
+ | `useTabs` | `false` | Use spaces instead of tabs |
61
+ | `endOfLine` | `'lf'` | Use LF line endings (Unix-style) |
62
+ | `proseWrap` | `'preserve'` | Preserve prose wrapping in markdown files |
63
+
64
+ ## 💡 Examples
65
+
66
+ ### Before Formatting
67
+
68
+ ```javascript
69
+ const user = { name: 'John', age: 30, email: 'john@example.com' };
70
+ function greet(user) {
71
+ return 'Hello, ' + user.name + '!';
72
+ }
73
+ ```
74
+
75
+ ### After Formatting
76
+
77
+ ```javascript
78
+ const user = {
79
+ name: 'John',
80
+ age: 30,
81
+ email: 'john@example.com',
82
+ };
83
+
84
+ function greet(user) {
85
+ return 'Hello, ' + user.name + '!';
86
+ }
87
+ ```
88
+
89
+ ## 🔧 Usage with Scripts
90
+
91
+ Add formatting scripts to your `package.json`:
92
+
93
+ ```json
94
+ {
95
+ "scripts": {
96
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
97
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\""
98
+ }
99
+ }
100
+ ```
101
+
102
+ Then run:
103
+
104
+ ```bash
105
+ npm run format # Format all files
106
+ npm run format:check # Check formatting without modifying files
107
+ ```
108
+
109
+ ## 🎨 Extending the Configuration
110
+
111
+ You can extend this config for project-specific needs:
112
+
113
+ ```javascript
114
+ // .prettierrc.js
115
+ const baseConfig = require('@jmlweb/prettier-config-base');
116
+
117
+ module.exports = {
118
+ ...baseConfig,
119
+ // Override or add specific options
120
+ printWidth: 100,
121
+ arrowParens: 'always',
122
+ };
123
+ ```
124
+
125
+ ## 🔗 Related Packages
126
+
127
+ - [`@jmlweb/prettier-config-tailwind`](../prettier-config-tailwind) - Adds Tailwind CSS class sorting
128
+ - [`@jmlweb/eslint-config-base`](../eslint-config-base) - ESLint config that works seamlessly with this Prettier config
129
+
130
+ ## 📝 Requirements
131
+
132
+ - **Node.js** >= 18.0.0
133
+ - **Prettier** >= 3.0.0
134
+
135
+ ## 📄 License
136
+
137
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ default: () => index_default
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var config = {
27
+ semi: true,
28
+ singleQuote: true,
29
+ tabWidth: 2,
30
+ trailingComma: "all",
31
+ useTabs: false,
32
+ endOfLine: "lf",
33
+ proseWrap: "preserve"
34
+ };
35
+ var index_default = config;
@@ -0,0 +1,5 @@
1
+ import { Config } from 'prettier';
2
+
3
+ declare const config: Config;
4
+
5
+ export { config as default };
@@ -0,0 +1,5 @@
1
+ import { Config } from 'prettier';
2
+
3
+ declare const config: Config;
4
+
5
+ export { config as default };
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ // src/index.ts
2
+ var config = {
3
+ semi: true,
4
+ singleQuote: true,
5
+ tabWidth: 2,
6
+ trailingComma: "all",
7
+ useTabs: false,
8
+ endOfLine: "lf",
9
+ proseWrap: "preserve"
10
+ };
11
+ var index_default = config;
12
+ export {
13
+ index_default as default
14
+ };
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@jmlweb/prettier-config-base",
3
+ "version": "1.0.0",
4
+ "description": "Base Prettier configuration for jmlweb projects",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "require": {
12
+ "types": "./dist/index.d.cts",
13
+ "default": "./dist/index.cjs"
14
+ },
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "clean": "rm -rf dist",
28
+ "prepublishOnly": "pnpm build"
29
+ },
30
+ "keywords": [
31
+ "prettier",
32
+ "prettier-config",
33
+ "code-formatter"
34
+ ],
35
+ "author": "jmlweb",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/jmlweb/tooling.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/jmlweb/tooling/issues"
43
+ },
44
+ "homepage": "https://github.com/jmlweb/tooling/tree/main/packages/prettier-config-base#readme",
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "peerDependencies": {
52
+ "prettier": "^3.0.0"
53
+ },
54
+ "devDependencies": {
55
+ "@jmlweb/tsconfig-internal": "workspace:*",
56
+ "prettier": "^3.3.3",
57
+ "tsup": "^8.5.1",
58
+ "typescript": "^5.9.3"
59
+ }
60
+ }