@teo-garcia/prettier-config-shared 0.1.0 → 0.2.1
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 +64 -0
- package/index.js +38 -3
- package/package.json +23 -2
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @teo-garcia/prettier-config-shared
|
|
2
|
+
|
|
3
|
+
Shared Prettier configuration used across the fullstack web templates.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
# with pnpm
|
|
9
|
+
pnpm add -D @teo-garcia/prettier-config-shared prettier
|
|
10
|
+
|
|
11
|
+
# or with npm
|
|
12
|
+
npm add -D @teo-garcia/prettier-config-shared prettier
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Option 1: Package.json (Recommended)
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"prettier": "@teo-garcia/prettier-config-shared"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Option 2: Configuration file
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
// prettier.config.js
|
|
29
|
+
import sharedConfig from "@teo-garcia/prettier-config-shared";
|
|
30
|
+
|
|
31
|
+
export default sharedConfig;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Option 3: Extend and override
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// prettier.config.js
|
|
38
|
+
import sharedConfig from "@teo-garcia/prettier-config-shared";
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
...sharedConfig,
|
|
42
|
+
// Your project-specific overrides
|
|
43
|
+
printWidth: 100,
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
This config includes:
|
|
50
|
+
|
|
51
|
+
- **Core rules**: Semi-colons disabled, single quotes, 2-space tabs, ES5 trailing commas
|
|
52
|
+
- **JSX rules**: Single quotes for JSX attributes
|
|
53
|
+
- **Markdown**: Always wrap prose, 80 character width
|
|
54
|
+
- **Prisma**: Proper formatting for `.prisma` files
|
|
55
|
+
- **YAML**: No single quotes, 2-space indentation
|
|
56
|
+
- **JSON**: No trailing commas, 2-space indentation
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Notes
|
|
61
|
+
|
|
62
|
+
- Compatible with Prettier 3.x
|
|
63
|
+
- Designed to work seamlessly with `@teo-garcia/eslint-config-shared`
|
|
64
|
+
- All file type overrides are included for consistent formatting across the monorepo
|
package/index.js
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
tabWidth: 2,
|
|
1
|
+
const config = {
|
|
2
|
+
// Core formatting rules
|
|
4
3
|
semi: false,
|
|
5
4
|
singleQuote: true,
|
|
5
|
+
tabWidth: 2,
|
|
6
|
+
trailingComma: "es5",
|
|
7
|
+
printWidth: 80,
|
|
8
|
+
useTabs: false,
|
|
9
|
+
|
|
10
|
+
// JSX specific
|
|
11
|
+
jsxSingleQuote: true,
|
|
12
|
+
bracketSpacing: true,
|
|
13
|
+
bracketSameLine: false,
|
|
14
|
+
|
|
15
|
+
// Other languages
|
|
16
|
+
overrides: [
|
|
17
|
+
{
|
|
18
|
+
files: "*.md",
|
|
19
|
+
options: {
|
|
20
|
+
proseWrap: "always",
|
|
21
|
+
printWidth: 80,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
files: "*.{yml,yaml}",
|
|
26
|
+
options: {
|
|
27
|
+
tabWidth: 2,
|
|
28
|
+
singleQuote: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
files: "*.json",
|
|
33
|
+
options: {
|
|
34
|
+
tabWidth: 2,
|
|
35
|
+
trailingComma: "none",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
6
39
|
};
|
|
40
|
+
|
|
41
|
+
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teo-garcia/prettier-config-shared",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Shared Prettier configuration for fullstack web templates",
|
|
5
|
+
"type": "module",
|
|
4
6
|
"main": "index.js",
|
|
5
|
-
"
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"prettier",
|
|
12
|
+
"prettierconfig",
|
|
13
|
+
"formatting",
|
|
14
|
+
"shared",
|
|
15
|
+
"typescript",
|
|
16
|
+
"react",
|
|
17
|
+
"node"
|
|
18
|
+
],
|
|
19
|
+
"author": "teo-garcia",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20.11"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"prettier": "^3.0.0"
|
|
26
|
+
}
|
|
6
27
|
}
|