@teo-garcia/prettier-config-shared 0.2.8 → 0.2.10

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/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report broken behavior, incorrect setup, or a regression
4
+ title: '[Bug]: '
5
+ labels: bug
6
+ ---
7
+
8
+ ## Summary
9
+
10
+ <!-- Clear and concise description of the problem -->
11
+
12
+ ## Steps To Reproduce
13
+
14
+ 1.
15
+ 2.
16
+ 3.
17
+
18
+ ## Expected Behavior
19
+
20
+ <!-- What should happen -->
21
+
22
+ ## Actual Behavior
23
+
24
+ <!-- What actually happens -->
25
+
26
+ ## Environment
27
+
28
+ - Repo:
29
+ - Commit / version:
30
+ - Runtime:
31
+ - OS:
32
+
33
+ ## Additional Context
34
+
35
+ <!-- Logs, screenshots, or notes -->
@@ -0,0 +1 @@
1
+ blank_issues_enabled: true
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Improvement
3
+ about: Suggest an improvement to the template, docs, tooling, or workflow
4
+ title: '[Proposal]: '
5
+ labels: enhancement
6
+ ---
7
+
8
+ ## Summary
9
+
10
+ <!-- Clear and concise description of the improvement -->
11
+
12
+ ## Problem
13
+
14
+ <!-- What is missing, awkward, or inconsistent today -->
15
+
16
+ ## Proposed Change
17
+
18
+ <!-- Describe the proposed solution -->
19
+
20
+ ## Alternatives Considered
21
+
22
+ <!-- Optional: other options you considered -->
23
+
24
+ ## Additional Context
25
+
26
+ <!-- Anything else reviewers should know -->
@@ -0,0 +1,20 @@
1
+ ## Summary
2
+
3
+ <!-- Describe the change and its intent -->
4
+
5
+ ## Testing
6
+
7
+ <!-- List the checks you ran locally -->
8
+
9
+ - [ ] Relevant checks pass locally
10
+ - [ ] Docs/config updated if needed
11
+
12
+ ## Checklist
13
+
14
+ - [ ] Scope is focused and intentional
15
+ - [ ] Breaking changes are documented
16
+ - [ ] Screenshots or logs attached when useful
17
+
18
+ ## Related Issues
19
+
20
+ Closes #
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ check:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v6
19
+
20
+ - name: Setup pnpm
21
+ uses: pnpm/action-setup@v6
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v6
25
+ with:
26
+ node-version: "24"
27
+ cache: "pnpm"
28
+
29
+ - name: Install dependencies
30
+ run: pnpm install --frozen-lockfile
31
+
32
+ - name: Security audit
33
+ run: pnpm audit --audit-level=high
34
+ continue-on-error: true
35
+
36
+ - name: Check
37
+ run: pnpm check
@@ -3,7 +3,11 @@ name: Publish to npm
3
3
  on:
4
4
  push:
5
5
  tags:
6
- - 'v*'
6
+ - "v*"
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: true
7
11
 
8
12
  jobs:
9
13
  publish:
@@ -13,29 +17,27 @@ jobs:
13
17
  id-token: write
14
18
  steps:
15
19
  - name: Checkout code
16
- uses: actions/checkout@v4
20
+ uses: actions/checkout@v6
17
21
 
18
22
  - name: Setup pnpm
19
- uses: pnpm/action-setup@v4
20
- with:
21
- version: 9
23
+ uses: pnpm/action-setup@v6
22
24
 
23
25
  - name: Setup Node.js
24
- uses: actions/setup-node@v4
26
+ uses: actions/setup-node@v6
25
27
  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
28
+ node-version: "24"
29
+ registry-url: "https://registry.npmjs.org"
31
30
 
32
31
  - name: Install dependencies
33
- run: pnpm install --no-frozen-lockfile
32
+ run: pnpm install --frozen-lockfile
33
+
34
+ - name: Check package
35
+ run: pnpm check
34
36
 
35
37
  - name: Publish to npm via OIDC
36
38
  run: npm publish --provenance --access public
37
39
 
38
40
  - name: Create GitHub Release
39
- uses: softprops/action-gh-release@v2
41
+ uses: softprops/action-gh-release@v3
40
42
  with:
41
43
  generate_release_notes: true
@@ -0,0 +1,2 @@
1
+ PNPM_VERSION=$(node -p 'require("./package.json").packageManager?.split("@")[1] ?? "latest"')
2
+ exec npx -y "pnpm@${PNPM_VERSION}" lint-staged
@@ -0,0 +1,2 @@
1
+ PNPM_VERSION=$(node -p 'require("./package.json").packageManager?.split("@")[1] ?? "latest"')
2
+ exec npx -y "pnpm@${PNPM_VERSION}" format:check
@@ -0,0 +1,3 @@
1
+ export default {
2
+ '**/*.{js,mjs,cjs,ts,tsx,json,md,yml,yaml}': ['prettier --write'],
3
+ }
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 teo-garcia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
24
+
package/README.md CHANGED
@@ -8,80 +8,45 @@
8
8
  [![npm](https://img.shields.io/npm/v/@teo-garcia/prettier-config-shared?color=blue)](https://www.npmjs.com/package/@teo-garcia/prettier-config-shared)
9
9
  [![Prettier](https://img.shields.io/badge/Prettier-3-F7B93E?logo=prettier&logoColor=black)](https://prettier.io)
10
10
 
11
- Part of the [@teo-garcia/templates](https://github.com/teo-garcia/templates) ecosystem
11
+ Part of the [@teo-garcia/templates](https://github.com/teo-garcia/templates)
12
+ ecosystem
12
13
 
13
14
  </div>
14
15
 
15
16
  ---
16
17
 
17
- ## Features
18
+ ## Settings
18
19
 
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 |
20
+ | Setting | Value |
21
+ | ------------------- | -------- |
22
+ | **Semicolons** | No |
23
+ | **Quotes** | Single |
24
+ | **Tab Width** | 2 spaces |
25
+ | **Trailing Commas** | ES5 |
26
+ | **JSX Quotes** | Single |
27
+ | **Print Width** | 80 |
27
28
 
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
29
+ File-specific overrides: Markdown always wraps prose, YAML uses no single quotes
30
+ with 2-space indent, and JSON has no trailing commas.
31
+
32
+ ---
33
33
 
34
34
  ## Requirements
35
35
 
36
- - Node.js 20+
36
+ - Node.js 24+
37
37
  - Prettier 3+
38
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
- ```
39
+ ---
77
40
 
78
41
  ## Related Packages
79
42
 
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 |
43
+ | Package | Description |
44
+ | ---------------------------------- | ------------------- |
45
+ | `@teo-garcia/eslint-config-shared` | ESLint rules |
46
+ | `@teo-garcia/tsconfig-shared` | TypeScript settings |
47
+ | `@teo-garcia/vitest-config-shared` | Test configuration |
48
+
49
+ ---
85
50
 
86
51
  ## License
87
52
 
package/index.js CHANGED
@@ -3,7 +3,7 @@ const config = {
3
3
  semi: false,
4
4
  singleQuote: true,
5
5
  tabWidth: 2,
6
- trailingComma: "es5",
6
+ trailingComma: 'es5',
7
7
  printWidth: 80,
8
8
  useTabs: false,
9
9
 
@@ -15,27 +15,27 @@ const config = {
15
15
  // Other languages
16
16
  overrides: [
17
17
  {
18
- files: "*.md",
18
+ files: '*.md',
19
19
  options: {
20
- proseWrap: "always",
20
+ proseWrap: 'always',
21
21
  printWidth: 80,
22
22
  },
23
23
  },
24
24
  {
25
- files: "*.{yml,yaml}",
25
+ files: '*.{yml,yaml}',
26
26
  options: {
27
27
  tabWidth: 2,
28
28
  singleQuote: false,
29
29
  },
30
30
  },
31
31
  {
32
- files: "*.json",
32
+ files: '*.json',
33
33
  options: {
34
34
  tabWidth: 2,
35
- trailingComma: "none",
35
+ trailingComma: 'none',
36
36
  },
37
37
  },
38
38
  ],
39
- };
39
+ }
40
40
 
41
- export default config;
41
+ export default config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teo-garcia/prettier-config-shared",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Shared Prettier configuration for fullstack web templates",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -22,14 +22,25 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/teo-garcia/prettier-config-shared.git"
24
24
  },
25
+ "prettier": "@teo-garcia/prettier-config-shared",
26
+ "packageManager": "pnpm@10.33.2",
25
27
  "engines": {
26
- "node": ">=20.11"
28
+ "node": ">=24"
27
29
  },
28
30
  "peerDependencies": {
29
31
  "prettier": "^3.0.0"
30
32
  },
31
33
  "scripts": {
34
+ "check": "pnpm format:check && pnpm smoke:consumer",
32
35
  "format": "prettier --write .",
33
- "format:check": "prettier --check ."
36
+ "format:check": "prettier --check .",
37
+ "prepare": "husky",
38
+ "smoke:consumer": "node scripts/consumer-smoke.mjs"
39
+ },
40
+ "devDependencies": {
41
+ "@teo-garcia/prettier-config-shared": "^0.2.9",
42
+ "husky": "^9.1.7",
43
+ "lint-staged": "^16.2.3",
44
+ "prettier": "^3.8.1"
34
45
  }
35
46
  }
package/renovate.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": ["config:recommended"],
4
+ "dependencyDashboard": true,
5
+ "labels": ["dependencies"],
6
+ "platformAutomerge": true,
7
+ "packageRules": [
8
+ {
9
+ "groupName": "teo-garcia shared configs",
10
+ "schedule": ["on the first day of the month"],
11
+ "automerge": false,
12
+ "reviewers": ["teo-garcia"],
13
+ "matchPackageNames": ["/^@teo-garcia//"]
14
+ },
15
+ {
16
+ "groupName": "all dependencies",
17
+ "matchUpdateTypes": ["minor", "patch"],
18
+ "excludePackagePatterns": ["^@teo-garcia/"],
19
+ "schedule": ["on the first day of the month"],
20
+ "minimumReleaseAge": "3 days",
21
+ "automerge": true,
22
+ "automergeType": "pr"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,78 @@
1
+ import { execFileSync } from 'node:child_process'
2
+ import {
3
+ mkdtempSync,
4
+ mkdirSync,
5
+ readFileSync,
6
+ readdirSync,
7
+ writeFileSync,
8
+ } from 'node:fs'
9
+ import { tmpdir } from 'node:os'
10
+ import path from 'node:path'
11
+ import { fileURLToPath } from 'node:url'
12
+
13
+ const packageRoot = path.resolve(
14
+ path.dirname(fileURLToPath(import.meta.url)),
15
+ '..'
16
+ )
17
+ const packageJson = JSON.parse(
18
+ readFileSync(path.join(packageRoot, 'package.json'), 'utf8')
19
+ )
20
+ const tempRoot = mkdtempSync(path.join(tmpdir(), 'teo-prettier-consumer-'))
21
+ const tarballDir = path.join(tempRoot, 'tarballs')
22
+ const consumerDir = path.join(tempRoot, 'consumer')
23
+
24
+ mkdirSync(tarballDir)
25
+ mkdirSync(consumerDir)
26
+
27
+ execFileSync('pnpm', ['pack', '--pack-destination', tarballDir], {
28
+ cwd: packageRoot,
29
+ stdio: 'inherit',
30
+ })
31
+
32
+ const tarballName = readdirSync(tarballDir).find((file) =>
33
+ file.endsWith('.tgz')
34
+ )
35
+
36
+ if (!tarballName) {
37
+ throw new Error('pnpm pack did not create a tarball')
38
+ }
39
+
40
+ writeFileSync(
41
+ path.join(consumerDir, 'package.json'),
42
+ `${JSON.stringify(
43
+ {
44
+ private: true,
45
+ type: 'module',
46
+ prettier: packageJson.name,
47
+ dependencies: {
48
+ [packageJson.name]: `file:${path.join(tarballDir, tarballName)}`,
49
+ ...packageJson.peerDependencies,
50
+ },
51
+ },
52
+ null,
53
+ 2
54
+ )}\n`
55
+ )
56
+
57
+ writeFileSync(
58
+ path.join(consumerDir, 'sample.js'),
59
+ 'const value = { ok: true }\nconsole.log(value)\n'
60
+ )
61
+
62
+ execFileSync('pnpm', ['install', '--ignore-scripts'], {
63
+ cwd: consumerDir,
64
+ stdio: 'inherit',
65
+ })
66
+
67
+ const config = (await import(packageJson.name)).default
68
+
69
+ if (config.semi !== false || config.singleQuote !== true) {
70
+ throw new Error('unexpected prettier config export')
71
+ }
72
+
73
+ execFileSync('pnpm', ['exec', 'prettier', '--check', 'sample.js'], {
74
+ cwd: consumerDir,
75
+ stdio: 'inherit',
76
+ })
77
+
78
+ console.log('prettier packed consumer smoke ok')