pr-checkmate 1.21.0 → 1.21.2

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.
@@ -0,0 +1,10 @@
1
+ {
2
+ "MD013": {
3
+ "line_length": 500
4
+ },
5
+ "MD024": {
6
+ "siblings_only": true
7
+ },
8
+ "MD033": false,
9
+ "MD060": false
10
+ }
package/README.md CHANGED
@@ -2,64 +2,72 @@
2
2
  ![ESLint](https://img.shields.io/npm/v/eslint?color=yellow&label=ESLint)
3
3
  ![Prettier](https://img.shields.io/npm/v/prettier?color=orange&label=Prettier)
4
4
 
5
-
6
5
  # ♟️ PR CheckMate
6
+ >
7
7
  > **PR CheckMate** is an npm package for automating Pull Request checks.
8
- > It helps teams maintain code quality by automatically validating linting, formatting, dependencies, and spelling before merging to `main`.
8
+ > It helps teams maintain code quality by automatically validating linting, formatting, dependencies, security, and spelling before merging to `main`.
9
9
 
10
10
  ## 🔍 Why PR CheckMate?
11
+
11
12
  * ✅ Automatic checks on every PR without extra setup.
12
13
  * ✅ No need to install ESLint, Prettier, or cspell in your project — all included.
13
14
  * ✅ Enforces a unified code style across repositories.
14
- * ✅ Checks `package.json` / `package-lock.json` for dependency changes.
15
- * ✅ Spellcheck for code, documentation, and JSON files with multilingual support (EN, RU, UK, HE, FR).
16
- * ✅ Package Vulnerabilities Check
17
- * ✅ Scans for secrets using gitleaks
15
+ * ✅ Detects unused and missing dependencies via `depcheck`.
16
+ * ✅ Finds circular dependencies before they reach production.
17
+ * ✅ Blocks GPL/AGPL/LGPL licensed packages from slipping in.
18
+ * ✅ Validates PR title against Conventional Commits.
19
+ * ✅ Warns about oversized PRs and major-behind packages.
20
+ * ✅ Spellcheck for code, docs, and JSON with multilingual support (EN, RU, UK, HE, FR).
21
+ * ✅ Package vulnerability check via `npm audit`.
22
+ * ✅ Secret scanning via `gitleaks`.
23
+ * ✅ **Delta mode** — in GitHub PR context only changed files are checked, not the entire project.
24
+ * ✅ **Parallel execution** — all independent checks run concurrently, cutting CI time ~4×.
25
+ * ✅ TypeScript type check — runs `tsc --noEmit`, catches type errors before merge. Skips if no `tsconfig.json` is found.
26
+ * ✅ Diff code smells — scans PR diff for `console.*()` calls, `debugger` statements, and `TODO/FIXME/HACK/XXX` comments left in added lines.
27
+ * ✅ PR description check — validates the PR body has at least 20 characters and includes a ticket reference (`Closes #123` or `PROJ-456` style).
28
+ * ✅ Duplicate code detection — uses `jscpd` in delta mode (changed files in PR, or `src/` otherwise) with a 5-line / 50-token minimum threshold.
29
+ * ✅ PR summary comment — after `npx pr-checkmate all`, posts a summary table to the CI log and upserts a comment on the PR. No spam on repeated pushes.
18
30
 
19
31
  <br>
20
32
  > ⚠️ **Note:** Currently, PR CheckMate only supports **Node.js projects**.
21
33
 
22
-
23
- - [PR CheckMate](https://www.npmjs.com/package/pr-checkmate) – Zero-config CLI that automates ESLint, Prettier, spellcheck, dependency checks, and npm audit for pull requests.
34
+ * [PR CheckMate](https://www.npmjs.com/package/pr-checkmate) – Zero-config CLI that automates ESLint, Prettier, spellcheck, dependency checks, and npm audit for pull requests.
24
35
 
25
36
  ## 🚀 Zero-Config by Default
37
+
26
38
  You don't need to install or configure:
27
- - ESLint
28
- - Prettier
29
- - cspell (with multilingual dictionaries)
30
- - Security scanning tools
39
+
40
+ * ESLint
41
+ * Prettier
42
+ * cspell (with multilingual dictionaries)
43
+ * Security scanning tools
31
44
 
32
45
  > Everything works out of the box.
33
46
  <br>
34
47
 
35
48
  ### 🧩 Fully Customizable
49
+
36
50
  Users can override:
37
- - ESLint rules and ignore patterns
38
- - Prettier rules
39
- - CSpell dictionary and ignore lists
40
- - Which checks run
41
- - Source code path
51
+
52
+ * ESLint rules and ignore patterns
53
+ * Prettier rules
54
+ * CSpell dictionary and ignore lists
55
+ * Which checks run (skip flags)
56
+ * Source code path
42
57
 
43
58
  User configuration is stored in:
44
- ```
59
+
60
+ ```text
45
61
  <project-root>/pr-checkmate.json
46
62
  ```
63
+
47
64
  <br>
48
65
 
49
66
  ### ⚙️ Example: pr-checkmate.json
67
+
50
68
  ```json
51
69
  {
52
70
  "sourcePath": "src",
53
- "commands": {
54
- "npx pr-checkmate init": "Update pr-checkmate.json",
55
- "npx pr-checkmate all": "Run all checks",
56
- "npx pr-checkmate lint": "Lint code using ESLint",
57
- "npx pr-checkmate prettier": "Format code using Prettier",
58
- "npx pr-checkmate deps": "Check project dependencies",
59
- "npx pr-checkmate npm-audit": "Run package vulnerabilities check",
60
- "npx pr-checkmate security": "Security scan",
61
- "npx pr-checkmate spellcheck": "Run spellcheck via cspell"
62
- },
63
71
  "eslint": {
64
72
  "rules": {},
65
73
  "ignorePatterns": []
@@ -79,11 +87,12 @@ User configuration is stored in:
79
87
  "cspell": "https://cspell.org/configuration/"
80
88
  }
81
89
  }
82
-
83
90
  ```
91
+
84
92
  <br>
85
93
 
86
94
  ## 🛠 How It Works
95
+
87
96
  ### 1. Install
88
97
 
89
98
  ```bash
@@ -91,28 +100,51 @@ npm install --save-dev pr-checkmate
91
100
  ```
92
101
 
93
102
  ### 2. Initialize
103
+
94
104
  ```bash
95
105
  npx pr-checkmate init
96
106
  ```
107
+
97
108
  > This creates:
98
- > - `pr-checkmate.json` - Configuration file where you can specify the source code path and customize rules
99
- > - `.github/workflows/pr-checkmate.yml` - GitHub Actions workflow for automated PR checks with auto-commit support
109
+ >
110
+ > * `pr-checkmate.json` — configuration file for source path and custom rules
111
+ > * `.github/workflows/pr-checkmate.yml` — GitHub Actions workflow with per-job checks and auto-commit support
100
112
 
101
113
  ### 3. Run Checks
114
+
102
115
  ```bash
103
116
  npx pr-checkmate <job>
104
117
  ```
105
118
 
106
119
  #### ⚡ Jobs
107
- | Job | Description |
108
- |------------|-------------|
109
- | `all` | Run all checks: ESLint, dependency check, Prettier, spellcheck, security scan |
110
- | `lint` | Lint code using ESLint |
111
- | `prettier` | Format code using Prettier |
112
- | `deps` | Check project dependencies |
113
- | `security` | Run security scan for secrets |
114
- | `spellcheck` | Run spellcheck via cspell (supports EN, RU, UK, HE, FR) |
115
- | `audit` | Run `npm audit --audit-level=moderate` to check for vulnerable packages |
120
+
121
+ | Job | Description |
122
+ |----------------|-------------|
123
+ | `all` | Run all checks in parallel (lint, deps, audit, security, circular, license, then spellcheck, pr-size, pr-title, outdated, markdown, typecheck, diff-smell, pr-body, duplicate, then prettier). Posts a PR summary comment when run in a GitHub Actions PR context. |
124
+ | `lint` | Lint code using ESLint |
125
+ | `prettier` | Format code using Prettier |
126
+ | `deps` | Check unused / missing dependencies via depcheck |
127
+ | `security` | Scan for secrets using gitleaks |
128
+ | `spellcheck` | Spellcheck via cspell (EN, RU, UK, HE, FR) |
129
+ | `audit` | Run `npm audit --audit-level=moderate` |
130
+ | `circular` | Detect circular dependencies via dpdm |
131
+ | `license` | Block GPL / AGPL / LGPL licensed packages |
132
+ | `pr-size` | Warn if PR exceeds 50 files or 1 000 changed lines |
133
+ | `pr-title` | Validate PR title against Conventional Commits format |
134
+ | `outdated` | Report packages that are major versions behind |
135
+ | `markdown` | Lint `.md`/`.mdx` files via markdownlint (warning-only, delta mode) |
136
+ | `typecheck` | Run `tsc --noEmit` to catch type errors (blocking). Skips automatically if no `tsconfig.json` is found. |
137
+ | `diff-smell` | Scan PR diff for `console.*()`, `debugger`, and `TODO/FIXME/HACK/XXX` in added lines (warning-only, delta mode) |
138
+ | `pr-body` | Check PR description for minimum length (20 chars) and a ticket reference (warning-only) |
139
+ | `duplicate` | Detect duplicate code with `jscpd` — min 5 lines / 50 tokens (warning-only, delta mode in PR context) |
140
+
141
+ <br>
142
+
143
+ ### ⚡ Delta Mode
144
+
145
+ In a GitHub Actions PR context, `lint`, `prettier`, `spellcheck`, `markdown`, `diff-smell`, and `duplicate` automatically switch to **delta mode** — only the files changed in the PR are checked instead of the entire project. This is transparent and requires no configuration.
146
+
147
+ Outside of a PR context (local runs, push workflows) the checks fall back to the full project scan.
116
148
 
117
149
  <br>
118
150
 
@@ -133,28 +165,149 @@ permissions:
133
165
  pull-requests: write
134
166
 
135
167
  jobs:
136
- pr-checkmate-all:
137
- name: PR Checkmate All Checks
168
+ lint:
169
+ name: ESLint
170
+ runs-on: ubuntu-latest
171
+ steps:
172
+ - uses: actions/checkout@v4
173
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
174
+ - uses: actions/setup-node@v4
175
+ with: { node-version: 20 }
176
+ - run: npm ci
177
+ - run: npx pr-checkmate lint
178
+ continue-on-error: true
179
+
180
+ deps:
181
+ name: Dependency Check
182
+ runs-on: ubuntu-latest
183
+ steps:
184
+ - uses: actions/checkout@v4
185
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
186
+ - uses: actions/setup-node@v4
187
+ with: { node-version: 20 }
188
+ - run: npm ci
189
+ - run: npx pr-checkmate deps
190
+ continue-on-error: true
191
+
192
+ circular-deps:
193
+ name: Circular Dependencies
194
+ runs-on: ubuntu-latest
195
+ steps:
196
+ - uses: actions/checkout@v4
197
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
198
+ - uses: actions/setup-node@v4
199
+ with: { node-version: 20 }
200
+ - run: npm ci
201
+ - run: npx pr-checkmate circular
202
+ continue-on-error: true
203
+
204
+ license-check:
205
+ name: License Check
206
+ runs-on: ubuntu-latest
207
+ steps:
208
+ - uses: actions/checkout@v4
209
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
210
+ - uses: actions/setup-node@v4
211
+ with: { node-version: 20 }
212
+ - run: npm ci
213
+ - run: npx pr-checkmate license
214
+ continue-on-error: true
215
+
216
+ pr-size:
217
+ name: PR Size
138
218
  runs-on: ubuntu-latest
139
219
  steps:
140
- - name: Checkout code
141
- uses: actions/checkout@v4
142
- with:
143
- ref: ${{ github.head_ref }}
144
- fetch-depth: 0
145
-
146
- - name: Setup Node.js
147
- uses: actions/setup-node@v4
148
- with:
149
- node-version: 20
150
-
151
- - name: Install dependencies
152
- run: npm ci
153
-
154
- - name: Run PR Checkmate All Checks
155
- run: npx pr-checkmate all
220
+ - uses: actions/checkout@v4
221
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
222
+ - uses: actions/setup-node@v4
223
+ with: { node-version: 20 }
224
+ - run: npm ci
225
+ - run: npx pr-checkmate pr-size
156
226
  continue-on-error: true
157
227
 
228
+ pr-title:
229
+ name: PR Title Lint
230
+ runs-on: ubuntu-latest
231
+ steps:
232
+ - uses: actions/checkout@v4
233
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
234
+ - uses: actions/setup-node@v4
235
+ with: { node-version: 20 }
236
+ - run: npm ci
237
+ - run: npx pr-checkmate pr-title
238
+ continue-on-error: true
239
+
240
+ outdated-deps:
241
+ name: Outdated Dependencies
242
+ runs-on: ubuntu-latest
243
+ steps:
244
+ - uses: actions/checkout@v4
245
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
246
+ - uses: actions/setup-node@v4
247
+ with: { node-version: 20 }
248
+ - run: npm ci
249
+ - run: npx pr-checkmate outdated
250
+ continue-on-error: true
251
+
252
+ markdown-lint:
253
+ name: Markdown Lint
254
+ runs-on: ubuntu-latest
255
+ steps:
256
+ - uses: actions/checkout@v4
257
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
258
+ - uses: actions/setup-node@v4
259
+ with: { node-version: 20 }
260
+ - run: npm ci
261
+ - run: npx pr-checkmate markdown
262
+ continue-on-error: true
263
+
264
+ spellcheck:
265
+ name: Spellcheck
266
+ runs-on: ubuntu-latest
267
+ steps:
268
+ - uses: actions/checkout@v4
269
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
270
+ - uses: actions/setup-node@v4
271
+ with: { node-version: 20 }
272
+ - run: npm ci
273
+ - run: npx pr-checkmate spellcheck
274
+ continue-on-error: true
275
+
276
+ security:
277
+ name: Security Scan
278
+ runs-on: ubuntu-latest
279
+ steps:
280
+ - uses: actions/checkout@v4
281
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
282
+ - uses: actions/setup-node@v4
283
+ with: { node-version: 20 }
284
+ - run: npm ci
285
+ - run: npx pr-checkmate security
286
+ continue-on-error: true
287
+
288
+ npm-audit:
289
+ name: NPM Audit
290
+ runs-on: ubuntu-latest
291
+ steps:
292
+ - uses: actions/checkout@v4
293
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
294
+ - uses: actions/setup-node@v4
295
+ with: { node-version: 20 }
296
+ - run: npm ci
297
+ - run: npx pr-checkmate audit
298
+ continue-on-error: true
299
+
300
+ prettier:
301
+ name: Prettier
302
+ runs-on: ubuntu-latest
303
+ steps:
304
+ - uses: actions/checkout@v4
305
+ with: { ref: "${{ github.head_ref }}", fetch-depth: 0 }
306
+ - uses: actions/setup-node@v4
307
+ with: { node-version: 20 }
308
+ - run: npm ci
309
+ - run: npx pr-checkmate prettier
310
+ continue-on-error: true
158
311
  - name: Auto-commit formatting changes
159
312
  run: |
160
313
  git config user.name "github-actions[bot]"
@@ -163,9 +316,6 @@ jobs:
163
316
  if ! git diff --cached --quiet; then
164
317
  git commit -m "style: auto-format code with Prettier"
165
318
  git push origin HEAD:${{ github.head_ref }}
166
- echo "Formatting changes committed and pushed"
167
- else
168
- echo "No formatting changes needed"
169
319
  fi
170
320
  env:
171
321
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -183,17 +333,42 @@ For the auto-commit feature to work, ensure your repository has the correct perm
183
333
 
184
334
  <br>
185
335
 
336
+ ### PR summary comment
337
+
338
+ After `npx pr-checkmate all` finishes, it prints a summary table to the CI log and posts a comment on the PR. On repeated pushes the comment is updated in place — no duplicate comments accumulate.
339
+
340
+ The comment looks like this:
341
+
342
+ ```text
343
+ ## PR CheckMate Summary
344
+
345
+ **11 passed** · **3 warnings** · **0 failed** · **0 skipped**
346
+
347
+ | Check | Result |
348
+ |---|---|
349
+ | ESLint | pass |
350
+ | TypeScript | pass |
351
+ | Diff Smells | warn — 2x console.*(), 1x TODO comment |
352
+ | PR Body | warn — no ticket reference |
353
+ ...
354
+ ```
355
+
356
+ This requires `GITHUB_TOKEN` with `pull-requests: write` permission. The auto-generated workflow already includes both — no extra setup is needed.
357
+
358
+ <br>
359
+
186
360
  ## 🌍 Multilingual Spellcheck Support
187
361
 
188
362
  PR CheckMate includes built-in dictionaries for:
189
- - 🇬🇧 English (en)
190
- - 🇪🇸 Spanish (es)
191
- - 🇫🇷 French (fr)
192
- - 🇷🇺 Russian (ru)
193
- - 🇺🇦 Ukrainian (uk)
194
- - 🇮🇱 Hebrew (he)
195
363
 
196
- No additional configuration needed - just use `npx pr-checkmate spellcheck` and it will check spelling in all supported languages!
364
+ * 🇬🇧 English (en)
365
+ * 🇪🇸 Spanish (es)
366
+ * 🇫🇷 French (fr)
367
+ * 🇷🇺 Russian (ru)
368
+ * 🇺🇦 Ukrainian (uk)
369
+ * 🇮🇱 Hebrew (he)
370
+
371
+ No additional configuration needed — just use `npx pr-checkmate spellcheck` and it will check spelling in all supported languages.
197
372
 
198
373
  <br>
199
374
 
@@ -205,9 +380,11 @@ No additional configuration needed - just use `npx pr-checkmate spellcheck` and
205
380
  * ✅ Automatic formatting and commits when needed
206
381
  * ✅ Multilingual spellcheck support out of the box
207
382
  * ✅ Minimal setup — just `init` and `npx pr-checkmate all`
208
-
383
+ * ✅ Delta mode keeps CI fast — only changed files are scanned
384
+ * ✅ License guard prevents copyleft packages from entering your project
209
385
 
210
386
  ## 🧰 Tech Stack
387
+
211
388
  * **Node.js 20** — executes CLI scripts
212
389
  * **TypeScript** — fully typed code
213
390
  * **ESLint + @typescript-eslint** — code linting
@@ -215,7 +392,10 @@ No additional configuration needed - just use `npx pr-checkmate spellcheck` and
215
392
  * **cspell** — spellchecking with multilingual dictionaries
216
393
  * **execa** — running CLI commands from Node.js
217
394
  * **gitleaks** — secret scanning
395
+ * **depcheck** — unused and missing dependency analysis
396
+ * **dpdm** — circular dependency detection
397
+ * **license-checker** — license compliance validation
218
398
 
399
+ ## 📜 License
219
400
 
220
- ## 📜 License
221
- LicenseRef Proprietary © 2025
401
+ LicenseRef Proprietary © 2025
@@ -84,6 +84,10 @@ exports.DEFAULT_COMMANDS = {
84
84
  'npx pr-checkmate npm-audit': 'Run package vulnerabilities check',
85
85
  'npx pr-checkmate security': 'Security scan',
86
86
  'npx pr-checkmate spellcheck': 'Run spellcheck via cspell',
87
+ 'npx pr-checkmate typecheck': 'TypeScript type check (tsc --noEmit)',
88
+ 'npx pr-checkmate diff-smell': 'Scan git diff for code smells',
89
+ 'npx pr-checkmate pr-body': 'Validate PR description',
90
+ 'npx pr-checkmate duplicate': 'Detect duplicate code blocks (jscpd)',
87
91
  };
88
92
  exports.documentation = {
89
93
  eslint: 'https://eslint.org/docs/latest/rules/',
@@ -54,6 +54,10 @@ function mergeWithDefaults(userConfig) {
54
54
  ],
55
55
  },
56
56
  security: userConfig.security || defaults.security,
57
+ typecheck: { ...defaults.typecheck, ...userConfig.typecheck },
58
+ diffSmell: { ...defaults.diffSmell, ...userConfig.diffSmell },
59
+ prBody: { ...defaults.prBody, ...userConfig.prBody },
60
+ duplicate: { ...defaults.duplicate, ...userConfig.duplicate },
57
61
  };
58
62
  }
59
63
  /**
@@ -110,6 +114,10 @@ function getDefaultConfig() {
110
114
  gitleaks: { enabled: true },
111
115
  'npm-audit': { enabled: true, auditLevel: 'moderate' },
112
116
  },
117
+ typecheck: { enabled: true },
118
+ diffSmell: { enabled: true },
119
+ prBody: { enabled: true, minLength: 20, requireTicket: true },
120
+ duplicate: { enabled: true, minLines: 5, minTokens: 50 },
113
121
  };
114
122
  }
115
123
  /**
@@ -242,3 +242,112 @@ jobs:
242
242
  - name: Check Outdated Dependencies
243
243
  run: npx pr-checkmate outdated
244
244
  continue-on-error: true
245
+
246
+ markdown-lint:
247
+ name: Markdown Lint
248
+ runs-on: ubuntu-latest
249
+ steps:
250
+ - name: Checkout code
251
+ uses: actions/checkout@v4
252
+ with:
253
+ fetch-depth: 0
254
+
255
+ - name: Setup Node.js
256
+ uses: actions/setup-node@v4
257
+ with:
258
+ node-version: 20
259
+
260
+ - name: Install dependencies
261
+ run: npm ci
262
+
263
+ - name: Run Markdown Lint
264
+ run: npx pr-checkmate markdown
265
+ continue-on-error: true
266
+
267
+ typecheck:
268
+ name: TypeScript Type Check
269
+ runs-on: ubuntu-latest
270
+ steps:
271
+ - name: Checkout code
272
+ uses: actions/checkout@v4
273
+ with:
274
+ ref: ${{ github.head_ref }}
275
+ fetch-depth: 0
276
+
277
+ - name: Setup Node.js
278
+ uses: actions/setup-node@v4
279
+ with:
280
+ node-version: 20
281
+
282
+ - name: Install dependencies
283
+ run: npm ci
284
+
285
+ - name: Run TypeScript Type Check
286
+ run: npx pr-checkmate typecheck
287
+ continue-on-error: true
288
+
289
+ diff-smell:
290
+ name: Diff Code Smell
291
+ runs-on: ubuntu-latest
292
+ steps:
293
+ - name: Checkout code
294
+ uses: actions/checkout@v4
295
+ with:
296
+ ref: ${{ github.head_ref }}
297
+ fetch-depth: 0
298
+
299
+ - name: Setup Node.js
300
+ uses: actions/setup-node@v4
301
+ with:
302
+ node-version: 20
303
+
304
+ - name: Install dependencies
305
+ run: npm ci
306
+
307
+ - name: Scan Diff for Code Smells
308
+ run: npx pr-checkmate diff-smell
309
+ continue-on-error: true
310
+
311
+ pr-body:
312
+ name: PR Description
313
+ runs-on: ubuntu-latest
314
+ steps:
315
+ - name: Checkout code
316
+ uses: actions/checkout@v4
317
+ with:
318
+ ref: ${{ github.head_ref }}
319
+ fetch-depth: 0
320
+
321
+ - name: Setup Node.js
322
+ uses: actions/setup-node@v4
323
+ with:
324
+ node-version: 20
325
+
326
+ - name: Install dependencies
327
+ run: npm ci
328
+
329
+ - name: Check PR Description
330
+ run: npx pr-checkmate pr-body
331
+ continue-on-error: true
332
+
333
+ duplicate-check:
334
+ name: Duplicate Code
335
+ runs-on: ubuntu-latest
336
+ steps:
337
+ - name: Checkout code
338
+ uses: actions/checkout@v4
339
+ with:
340
+ ref: ${{ github.head_ref }}
341
+ fetch-depth: 0
342
+
343
+ - name: Setup Node.js
344
+ uses: actions/setup-node@v4
345
+ with:
346
+ node-version: 20
347
+
348
+ - name: Install dependencies
349
+ run: npm ci
350
+
351
+ - name: Check for Duplicate Code
352
+ run: npx pr-checkmate duplicate
353
+ continue-on-error: true
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runOutdatedDeps = exports.runPrTitleLint = exports.runPrSizeCheck = exports.runLicenseCheck = exports.runCircularDeps = exports.runNpmAudit = exports.runSecurityScan = exports.runSpellcheck = exports.runPrettier = exports.runDependencyCheck = exports.runLint = exports.hasLocalConfig = exports.getPackageConfigPath = exports.getSourcePath = void 0;
3
+ exports.runMarkdownLint = exports.runOutdatedDeps = exports.runPrTitleLint = exports.runPrSizeCheck = exports.runLicenseCheck = exports.runCircularDeps = exports.runNpmAudit = exports.runSecurityScan = exports.runSpellcheck = exports.runPrettier = exports.runDependencyCheck = exports.runLint = exports.hasLocalConfig = exports.getPackageConfigPath = exports.getSourcePath = void 0;
4
4
  exports.runAllChecks = runAllChecks;
5
5
  exports.runChecks = runChecks;
6
6
  /**
@@ -19,6 +19,7 @@ const license_check_1 = require("./scripts/license-check");
19
19
  const pr_size_check_1 = require("./scripts/pr-size-check");
20
20
  const pr_title_lint_1 = require("./scripts/pr-title-lint");
21
21
  const outdated_deps_1 = require("./scripts/outdated-deps");
22
+ const markdown_lint_1 = require("./scripts/markdown-lint");
22
23
  const utils_1 = require("./utils");
23
24
  var config_1 = require("./config");
24
25
  Object.defineProperty(exports, "getSourcePath", { enumerable: true, get: function () { return config_1.getSourcePath; } });
@@ -46,6 +47,8 @@ var pr_title_lint_2 = require("./scripts/pr-title-lint");
46
47
  Object.defineProperty(exports, "runPrTitleLint", { enumerable: true, get: function () { return pr_title_lint_2.runPrTitleLint; } });
47
48
  var outdated_deps_2 = require("./scripts/outdated-deps");
48
49
  Object.defineProperty(exports, "runOutdatedDeps", { enumerable: true, get: function () { return outdated_deps_2.runOutdatedDeps; } });
50
+ var markdown_lint_2 = require("./scripts/markdown-lint");
51
+ Object.defineProperty(exports, "runMarkdownLint", { enumerable: true, get: function () { return markdown_lint_2.runMarkdownLint; } });
49
52
  /**
50
53
  * Run all checks with parallel execution where possible.
51
54
  * Blocking: lint, deps, npm-audit, security, circular-deps, license.
@@ -67,6 +70,7 @@ async function runAllChecks() {
67
70
  (0, pr_size_check_1.runPrSizeCheck)(),
68
71
  (0, pr_title_lint_1.runPrTitleLint)(),
69
72
  (0, outdated_deps_1.runOutdatedDeps)(),
73
+ (0, markdown_lint_1.runMarkdownLint)(),
70
74
  (0, spellcheck_1.runSpellcheck)().catch(() => utils_1.logger.warn('⚠️ Spellcheck found issues, continuing...')),
71
75
  ]);
72
76
  // Phase 3: prettier last — writes files
@@ -94,6 +98,8 @@ async function runChecks(config = {}) {
94
98
  await (0, pr_title_lint_1.runPrTitleLint)();
95
99
  if (!config.skipOutdated)
96
100
  await (0, outdated_deps_1.runOutdatedDeps)();
101
+ if (!config.skipMarkdown)
102
+ await (0, markdown_lint_1.runMarkdownLint)();
97
103
  if (!config.skipSpell)
98
104
  await (0, spellcheck_1.runSpellcheck)();
99
105
  if (!config.skipFormat)
package/dist/init.js CHANGED
@@ -32,6 +32,31 @@ const DEFAULT_CONFIG = {
32
32
  ignorePaths: [],
33
33
  ignoreRegExpList: [],
34
34
  },
35
+ // Markdownlint customization
36
+ markdownlint: {
37
+ rules: {},
38
+ ignores: [],
39
+ },
40
+ // TypeScript type check
41
+ typecheck: {
42
+ enabled: true,
43
+ },
44
+ // Diff code smell detection
45
+ diffSmell: {
46
+ enabled: true,
47
+ },
48
+ // PR description validation
49
+ prBody: {
50
+ enabled: true,
51
+ minLength: 20,
52
+ requireTicket: true,
53
+ },
54
+ // Duplicate code detection (jscpd)
55
+ duplicate: {
56
+ enabled: true,
57
+ minLines: 5,
58
+ minTokens: 50,
59
+ },
35
60
  documentation: config_1.documentation,
36
61
  };
37
62
  async function init() {
@@ -112,6 +137,10 @@ async function init() {
112
137
  eslint: { ...DEFAULT_CONFIG.eslint, ...(json.eslint || {}) },
113
138
  prettier: { ...DEFAULT_CONFIG.prettier, ...(json.prettier || {}) },
114
139
  cspell: { ...DEFAULT_CONFIG.cspell, ...(json.cspell || {}) },
140
+ typecheck: { ...DEFAULT_CONFIG.typecheck, ...(json.typecheck || {}) },
141
+ diffSmell: { ...DEFAULT_CONFIG.diffSmell, ...(json.diffSmell || {}) },
142
+ prBody: { ...DEFAULT_CONFIG.prBody, ...(json.prBody || {}) },
143
+ duplicate: { ...DEFAULT_CONFIG.duplicate, ...(json.duplicate || {}) },
115
144
  };
116
145
  fs_1.default.writeFileSync(exports.CONFIG_FILE, JSON.stringify(updated, null, 2));
117
146
  utils_1.logger.info('[init]: 🔧 Updated pr-checkmate.json with customization options.');