@teo-garcia/prettier-config-shared 0.1.0 → 0.2.8
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/.github/workflows/publish.yml +41 -0
- package/.prettierignore +17 -0
- package/.prettierrc.json +5 -0
- package/README.md +94 -0
- package/index.js +38 -3
- package/package.json +31 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
id-token: write
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup pnpm
|
|
19
|
+
uses: pnpm/action-setup@v4
|
|
20
|
+
with:
|
|
21
|
+
version: 9
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: '22'
|
|
27
|
+
registry-url: 'https://registry.npmjs.org'
|
|
28
|
+
|
|
29
|
+
- name: Setup npm for Trusted Publishing
|
|
30
|
+
run: npm install -g npm@latest && npm --version
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: pnpm install --no-frozen-lockfile
|
|
34
|
+
|
|
35
|
+
- name: Publish to npm via OIDC
|
|
36
|
+
run: npm publish --provenance --access public
|
|
37
|
+
|
|
38
|
+
- name: Create GitHub Release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
generate_release_notes: true
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @teo-garcia/prettier-config-shared
|
|
4
|
+
|
|
5
|
+
**Shared Prettier configuration for consistent code formatting**
|
|
6
|
+
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://www.npmjs.com/package/@teo-garcia/prettier-config-shared)
|
|
9
|
+
[](https://prettier.io)
|
|
10
|
+
|
|
11
|
+
Part of the [@teo-garcia/templates](https://github.com/teo-garcia/templates) ecosystem
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
| Setting | Value |
|
|
20
|
+
|---------|-------|
|
|
21
|
+
| **Semicolons** | No |
|
|
22
|
+
| **Quotes** | Single |
|
|
23
|
+
| **Tab Width** | 2 spaces |
|
|
24
|
+
| **Trailing Commas** | ES5 |
|
|
25
|
+
| **JSX Quotes** | Single |
|
|
26
|
+
| **Print Width** | 80 |
|
|
27
|
+
|
|
28
|
+
**File-specific rules:**
|
|
29
|
+
- Markdown: Always wrap prose
|
|
30
|
+
- Prisma: Proper `.prisma` file formatting
|
|
31
|
+
- YAML: No single quotes, 2-space indent
|
|
32
|
+
- JSON: No trailing commas
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Node.js 20+
|
|
37
|
+
- Prettier 3+
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Install the package
|
|
43
|
+
pnpm add -D @teo-garcia/prettier-config-shared prettier
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Package.json (Recommended)
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"prettier": "@teo-garcia/prettier-config-shared"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Configuration File
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
// prettier.config.js
|
|
58
|
+
import sharedConfig from '@teo-garcia/prettier-config-shared'
|
|
59
|
+
|
|
60
|
+
export default sharedConfig
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Extending
|
|
64
|
+
|
|
65
|
+
Override settings as needed:
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
// prettier.config.js
|
|
69
|
+
import sharedConfig from '@teo-garcia/prettier-config-shared'
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
...sharedConfig,
|
|
73
|
+
printWidth: 100,
|
|
74
|
+
semi: true,
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Related Packages
|
|
79
|
+
|
|
80
|
+
| Package | Description |
|
|
81
|
+
|---------|-------------|
|
|
82
|
+
| [@teo-garcia/eslint-config-shared](https://github.com/teo-garcia/eslint-config-shared) | ESLint rules |
|
|
83
|
+
| [@teo-garcia/tsconfig-shared](https://github.com/teo-garcia/tsconfig-shared) | TypeScript settings |
|
|
84
|
+
| [@teo-garcia/vitest-config-shared](https://github.com/teo-garcia/vitest-config-shared) | Test configuration |
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
<div align="center">
|
|
93
|
+
<sub>Built by <a href="https://github.com/teo-garcia">teo-garcia</a></sub>
|
|
94
|
+
</div>
|
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,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teo-garcia/prettier-config-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.8",
|
|
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
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/teo-garcia/prettier-config-shared.git"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20.11"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"prettier": "^3.0.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"format": "prettier --write .",
|
|
33
|
+
"format:check": "prettier --check ."
|
|
34
|
+
}
|
|
6
35
|
}
|