pr-checkmate 1.19.10 → 1.19.19
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 +89 -36
- package/cspell.json +31 -2
- package/dist/init.js +16 -1
- package/package.json +10 -2
- package/src/config/.eslintignore +72 -0
- package/src/config/.prettierrc +8 -0
- package/src/config/cspell.json +75 -0
- package/src/config/eslint.config.mjs +140 -0
- package/src/config/pr-checkmate-workflow.yml +147 -0
package/README.md
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
# ♟️ PR CheckMate
|
|
7
|
-
> **PR CheckMate** is an npm package for automating Pull Request checks.
|
|
7
|
+
> **PR CheckMate** is an npm package for automating Pull Request checks.
|
|
8
8
|
> It helps teams maintain code quality by automatically validating linting, formatting, dependencies, and spelling before merging to `main`.
|
|
9
9
|
|
|
10
10
|
## 🔍 Why PR CheckMate?
|
|
11
|
-
* ✅ Automatic checks on every PR without extra setup.
|
|
12
|
-
* ✅ No need to install ESLint, Prettier, or cspell in your project — all included.
|
|
13
|
-
* ✅ 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.
|
|
11
|
+
* ✅ Automatic checks on every PR without extra setup.
|
|
12
|
+
* ✅ No need to install ESLint, Prettier, or cspell in your project — all included.
|
|
13
|
+
* ✅ 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
16
|
* ✅ Package Vulnerabilities Check
|
|
17
|
-
* ✅ Scans for secrets using
|
|
17
|
+
* ✅ Scans for secrets using gitleaks
|
|
18
18
|
|
|
19
19
|
<br>
|
|
20
20
|
> ⚠️ **Note:** Currently, PR CheckMate only supports **Node.js projects**.
|
|
@@ -23,10 +23,10 @@
|
|
|
23
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.
|
|
24
24
|
|
|
25
25
|
## 🚀 Zero-Config by Default
|
|
26
|
-
You don
|
|
26
|
+
You don't need to install or configure:
|
|
27
27
|
- ESLint
|
|
28
28
|
- Prettier
|
|
29
|
-
- cspell
|
|
29
|
+
- cspell (with multilingual dictionaries)
|
|
30
30
|
- Security scanning tools
|
|
31
31
|
|
|
32
32
|
> Everything works out of the box.
|
|
@@ -47,7 +47,7 @@ User configuration is stored in:
|
|
|
47
47
|
<br>
|
|
48
48
|
|
|
49
49
|
### ⚙️ Example: pr-checkmate.json
|
|
50
|
-
```
|
|
50
|
+
```json
|
|
51
51
|
{
|
|
52
52
|
"sourcePath": "src",
|
|
53
53
|
"commands": {
|
|
@@ -91,77 +91,130 @@ npm install --save-dev pr-checkmate
|
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
### 2. Initialize
|
|
94
|
-
```
|
|
94
|
+
```bash
|
|
95
95
|
npx pr-checkmate init
|
|
96
96
|
```
|
|
97
|
-
> This creates
|
|
97
|
+
> 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
|
|
98
100
|
|
|
99
101
|
### 3. Run Checks
|
|
100
|
-
```
|
|
102
|
+
```bash
|
|
101
103
|
npx pr-checkmate <job>
|
|
102
104
|
```
|
|
103
105
|
|
|
104
106
|
#### ⚡ Jobs
|
|
105
107
|
| Job | Description |
|
|
106
108
|
|------------|-------------|
|
|
107
|
-
| `all` | Run all checks: ESLint, dependency check, Prettier, spellcheck |
|
|
109
|
+
| `all` | Run all checks: ESLint, dependency check, Prettier, spellcheck, security scan |
|
|
108
110
|
| `lint` | Lint code using ESLint |
|
|
109
111
|
| `prettier` | Format code using Prettier |
|
|
110
112
|
| `deps` | Check project dependencies |
|
|
111
113
|
| `security` | Run security scan for secrets |
|
|
112
|
-
| `spellcheck` | Run spellcheck via cspell |
|
|
114
|
+
| `spellcheck` | Run spellcheck via cspell (supports EN, RU, UK, HE, FR) |
|
|
113
115
|
| `audit` | Run `npm audit --audit-level=moderate` to check for vulnerable packages |
|
|
114
116
|
|
|
115
117
|
<br>
|
|
116
118
|
|
|
117
|
-
##
|
|
119
|
+
## 🤖 GitHub Actions Workflow (Auto-Generated)
|
|
120
|
+
|
|
121
|
+
When you run `npx pr-checkmate init`, it automatically creates `.github/workflows/pr-checkmate.yml`:
|
|
118
122
|
|
|
119
123
|
```yaml
|
|
120
|
-
name: PR
|
|
124
|
+
name: PR Checkmate Quality Checks
|
|
121
125
|
|
|
122
126
|
on:
|
|
123
127
|
pull_request:
|
|
128
|
+
branches: [main, master, develop]
|
|
129
|
+
types: [opened, synchronize, reopened]
|
|
130
|
+
|
|
131
|
+
permissions:
|
|
132
|
+
contents: write
|
|
133
|
+
pull-requests: write
|
|
124
134
|
|
|
125
135
|
jobs:
|
|
126
|
-
pr-
|
|
136
|
+
pr-checkmate-all:
|
|
137
|
+
name: PR Checkmate All Checks
|
|
127
138
|
runs-on: ubuntu-latest
|
|
128
139
|
steps:
|
|
129
|
-
- name:
|
|
140
|
+
- name: Checkout code
|
|
130
141
|
uses: actions/checkout@v4
|
|
131
142
|
with:
|
|
143
|
+
ref: ${{ github.head_ref }}
|
|
132
144
|
fetch-depth: 0
|
|
133
|
-
|
|
134
|
-
- name:
|
|
145
|
+
|
|
146
|
+
- name: Setup Node.js
|
|
135
147
|
uses: actions/setup-node@v4
|
|
136
148
|
with:
|
|
137
149
|
node-version: 20
|
|
138
|
-
|
|
139
|
-
- name:
|
|
150
|
+
|
|
151
|
+
- name: Install dependencies
|
|
140
152
|
run: npm ci
|
|
141
|
-
|
|
142
|
-
- name:
|
|
153
|
+
|
|
154
|
+
- name: Run PR Checkmate All Checks
|
|
143
155
|
run: npx pr-checkmate all
|
|
156
|
+
continue-on-error: true
|
|
157
|
+
|
|
158
|
+
- name: Auto-commit formatting changes
|
|
159
|
+
run: |
|
|
160
|
+
git config user.name "github-actions[bot]"
|
|
161
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
162
|
+
git add -A
|
|
163
|
+
if ! git diff --cached --quiet; then
|
|
164
|
+
git commit -m "style: auto-format code with Prettier"
|
|
165
|
+
git push origin HEAD:${{ github.head_ref }}
|
|
166
|
+
echo "Formatting changes committed and pushed"
|
|
167
|
+
else
|
|
168
|
+
echo "No formatting changes needed"
|
|
169
|
+
fi
|
|
170
|
+
env:
|
|
171
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
144
172
|
```
|
|
145
|
-
> Fully automated process: no need to install ESLint, Prettier, or cspell in your repository.
|
|
146
173
|
|
|
174
|
+
### ⚙️ GitHub Actions Permissions
|
|
175
|
+
|
|
176
|
+
For the auto-commit feature to work, ensure your repository has the correct permissions:
|
|
177
|
+
|
|
178
|
+
1. Go to **Settings** → **Actions** → **General** → **Workflow permissions**
|
|
179
|
+
2. Select **"Read and write permissions"**
|
|
180
|
+
3. Save changes
|
|
181
|
+
|
|
182
|
+
> The workflow will automatically commit Prettier formatting fixes directly to your PR branch.
|
|
183
|
+
|
|
184
|
+
<br>
|
|
185
|
+
|
|
186
|
+
## 🌍 Multilingual Spellcheck Support
|
|
187
|
+
|
|
188
|
+
PR CheckMate includes built-in dictionaries for:
|
|
189
|
+
- 🇬🇧 English (en)
|
|
190
|
+
- 🇷🇺 Russian (ru)
|
|
191
|
+
- 🇺🇦 Ukrainian (uk)
|
|
192
|
+
- 🇮🇱 Hebrew (he)
|
|
193
|
+
- 🇫🇷 French (fr)
|
|
194
|
+
|
|
195
|
+
No additional configuration needed - just use `npx pr-checkmate spellcheck` and it will check spelling in all supported languages!
|
|
196
|
+
|
|
197
|
+
<br>
|
|
147
198
|
|
|
148
199
|
## 📌 Benefits
|
|
149
200
|
|
|
150
|
-
* ✅ Self-contained — the package handles all checks internally
|
|
151
|
-
* ✅ Works locally and in CI/CD (GitHub Actions, GitLab CI, etc.)
|
|
152
|
-
* ✅ Enforces a unified code style across repositories
|
|
153
|
-
* ✅ Automatic formatting and commits when needed
|
|
201
|
+
* ✅ Self-contained — the package handles all checks internally
|
|
202
|
+
* ✅ Works locally and in CI/CD (GitHub Actions, GitLab CI, etc.)
|
|
203
|
+
* ✅ Enforces a unified code style across repositories
|
|
204
|
+
* ✅ Automatic formatting and commits when needed
|
|
205
|
+
* ✅ Multilingual spellcheck support out of the box
|
|
154
206
|
* ✅ Minimal setup — just `init` and `npx pr-checkmate all`
|
|
155
207
|
|
|
156
208
|
|
|
157
209
|
## 🧰 Tech Stack
|
|
158
210
|
|
|
159
|
-
* **Node.js 20** — executes CLI scripts
|
|
160
|
-
* **TypeScript** — fully typed code
|
|
161
|
-
* **ESLint + @typescript-eslint** — code linting
|
|
162
|
-
* **Prettier** — auto-formatting
|
|
163
|
-
* **cspell** — spellchecking
|
|
164
|
-
* **execa** — running CLI commands from Node.js
|
|
211
|
+
* **Node.js 20** — executes CLI scripts
|
|
212
|
+
* **TypeScript** — fully typed code
|
|
213
|
+
* **ESLint + @typescript-eslint** — code linting
|
|
214
|
+
* **Prettier** — auto-formatting
|
|
215
|
+
* **cspell** — spellchecking with multilingual dictionaries
|
|
216
|
+
* **execa** — running CLI commands from Node.js
|
|
217
|
+
* **gitleaks** — secret scanning
|
|
165
218
|
|
|
166
219
|
|
|
167
220
|
## 📜 License
|
package/cspell.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.2",
|
|
3
|
-
"language": "en",
|
|
3
|
+
"language": "en,ru,uk,he,fr",
|
|
4
|
+
"import": [
|
|
5
|
+
"./node_modules/@cspell/dict-ru_ru/cspell-ext.json",
|
|
6
|
+
"./node_modules/@cspell/dict-uk-ua/cspell-ext.json",
|
|
7
|
+
"./node_modules/@cspell/dict-he/cspell-ext.json",
|
|
8
|
+
"./node_modules/@cspell/dict-fr-fr/cspell-ext.json"
|
|
9
|
+
],
|
|
4
10
|
"words": [
|
|
5
11
|
"Artur",
|
|
6
12
|
"Polishchuk",
|
|
@@ -20,7 +26,30 @@
|
|
|
20
26
|
"pycache",
|
|
21
27
|
"wdio",
|
|
22
28
|
"htmlcov",
|
|
23
|
-
"mochawesome"
|
|
29
|
+
"mochawesome",
|
|
30
|
+
"dont",
|
|
31
|
+
"appinstalled",
|
|
32
|
+
"beforeinstallprompt",
|
|
33
|
+
"nav",
|
|
34
|
+
"navs",
|
|
35
|
+
"pr",
|
|
36
|
+
"recaptcha",
|
|
37
|
+
"tsconfig",
|
|
38
|
+
"vite",
|
|
39
|
+
"vitejs",
|
|
40
|
+
"Mavox",
|
|
41
|
+
"sultansadikov",
|
|
42
|
+
"Appi",
|
|
43
|
+
"Validatable",
|
|
44
|
+
"Osek",
|
|
45
|
+
"Patur",
|
|
46
|
+
"Mursheh",
|
|
47
|
+
"Hevra",
|
|
48
|
+
"Baam",
|
|
49
|
+
"Amuta",
|
|
50
|
+
"Sachir",
|
|
51
|
+
"gitleaks",
|
|
52
|
+
"mybono"
|
|
24
53
|
],
|
|
25
54
|
"ignorePaths": [
|
|
26
55
|
"**/node_modules/**",
|
package/dist/init.js
CHANGED
|
@@ -60,8 +60,23 @@ async function init() {
|
|
|
60
60
|
};
|
|
61
61
|
fs_1.default.writeFileSync(exports.CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
62
62
|
utils_1.logger.info(`[init]: ✅ Created pr-checkmate.json with sourcePath: ${sourcePath}`);
|
|
63
|
-
utils_1.logger.info(`[init]: 💡 You can now customize ESLint rules, Prettier settings,
|
|
63
|
+
utils_1.logger.info(`[init]: 💡 You can now customize ESLint rules, Prettier settings,
|
|
64
64
|
and cspell words in pr-checkmate.json`);
|
|
65
|
+
// Copy workflow file to .github/workflows/
|
|
66
|
+
const workflowSource = path_1.default.join(__dirname, 'config', 'pr-checkmate-workflow.yml');
|
|
67
|
+
const workflowDir = path_1.default.join(root, '.github', 'workflows');
|
|
68
|
+
const workflowDest = path_1.default.join(workflowDir, 'pr-checkmate.yml');
|
|
69
|
+
if (fs_1.default.existsSync(workflowSource)) {
|
|
70
|
+
if (!fs_1.default.existsSync(workflowDir)) {
|
|
71
|
+
fs_1.default.mkdirSync(workflowDir, { recursive: true });
|
|
72
|
+
}
|
|
73
|
+
fs_1.default.copyFileSync(workflowSource, workflowDest);
|
|
74
|
+
utils_1.logger.info('[init]: ✅ Created .github/workflows/pr-checkmate.yml');
|
|
75
|
+
utils_1.logger.info('[init]: 🚀 GitHub Actions workflow is ready for your PRs!');
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
utils_1.logger.warn('[init]: ⚠️ Workflow template not found, skipping workflow setup');
|
|
79
|
+
}
|
|
65
80
|
const tsconfigPath = path_1.default.join(root, 'tsconfig.json');
|
|
66
81
|
if (!fs_1.default.existsSync(tsconfigPath)) {
|
|
67
82
|
const newTsConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pr-checkmate",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.19",
|
|
4
4
|
"description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github-actions",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
".prettierrc",
|
|
25
25
|
".eslintignore",
|
|
26
26
|
"cspell.json",
|
|
27
|
+
"src/config/pr-checkmate-workflow.yml",
|
|
27
28
|
"LICENSE"
|
|
28
29
|
],
|
|
29
30
|
"scripts": {
|
|
@@ -56,6 +57,10 @@
|
|
|
56
57
|
"author": "Artur Polishchuk",
|
|
57
58
|
"license": "LicenseRef-Proprietary",
|
|
58
59
|
"dependencies": {
|
|
60
|
+
"@cspell/dict-fr-fr": "^2.2.2",
|
|
61
|
+
"@cspell/dict-he": "^4.0.2",
|
|
62
|
+
"@cspell/dict-ru_ru": "^2.2.1",
|
|
63
|
+
"@cspell/dict-uk-ua": "^4.0.0",
|
|
59
64
|
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
60
65
|
"@typescript-eslint/parser": "^8.47.0",
|
|
61
66
|
"cspell": "^9.3.2",
|
|
@@ -65,7 +70,7 @@
|
|
|
65
70
|
"eslint-plugin-import": "^2.29.0",
|
|
66
71
|
"eslint-plugin-prettier": "^5.5.4",
|
|
67
72
|
"execa": "^9.6.0",
|
|
68
|
-
"gitleaks-secret-scanner": "^1.
|
|
73
|
+
"gitleaks-secret-scanner": "^2.1.1",
|
|
69
74
|
"inquirer": "^13.0.1",
|
|
70
75
|
"prettier": ">=3.0.0",
|
|
71
76
|
"ts-node": "^10.9.1",
|
|
@@ -77,5 +82,8 @@
|
|
|
77
82
|
"peerDependencies": {
|
|
78
83
|
"eslint": ">=8.0.0",
|
|
79
84
|
"prettier": ">=3.0.0"
|
|
85
|
+
},
|
|
86
|
+
"overrides": {
|
|
87
|
+
"tar": "^7.5.7"
|
|
80
88
|
}
|
|
81
89
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build outputs
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
out/
|
|
8
|
+
.next/
|
|
9
|
+
.nuxt/
|
|
10
|
+
|
|
11
|
+
# Test reports & artifacts
|
|
12
|
+
allure-report/
|
|
13
|
+
allure-results/
|
|
14
|
+
reports/
|
|
15
|
+
report/
|
|
16
|
+
test-reports/
|
|
17
|
+
test-report/
|
|
18
|
+
test-output/
|
|
19
|
+
test-results/
|
|
20
|
+
results/
|
|
21
|
+
result/
|
|
22
|
+
coverage/
|
|
23
|
+
.coverage/
|
|
24
|
+
htmlcov/
|
|
25
|
+
|
|
26
|
+
# Jest
|
|
27
|
+
jest-html-reporters-*/
|
|
28
|
+
jest-stare/
|
|
29
|
+
jest.config.js
|
|
30
|
+
|
|
31
|
+
# Cypress
|
|
32
|
+
cypress/reports/
|
|
33
|
+
cypress/videos/
|
|
34
|
+
cypress/screenshots/
|
|
35
|
+
|
|
36
|
+
# Playwright
|
|
37
|
+
playwright-report/
|
|
38
|
+
test-results/
|
|
39
|
+
|
|
40
|
+
# WebdriverIO
|
|
41
|
+
.wdio/
|
|
42
|
+
wdio-logs/
|
|
43
|
+
|
|
44
|
+
# Mocha/Mochawesome
|
|
45
|
+
mochawesome-report/
|
|
46
|
+
mochawesome-reports/
|
|
47
|
+
|
|
48
|
+
# Maven/JUnit
|
|
49
|
+
target/
|
|
50
|
+
|
|
51
|
+
# Logs
|
|
52
|
+
logs/
|
|
53
|
+
*.log
|
|
54
|
+
npm-debug.log*
|
|
55
|
+
yarn-debug.log*
|
|
56
|
+
|
|
57
|
+
# Python
|
|
58
|
+
__pycache__/
|
|
59
|
+
.pytest_cache/
|
|
60
|
+
.venv/
|
|
61
|
+
venv/
|
|
62
|
+
|
|
63
|
+
# Git
|
|
64
|
+
.git/
|
|
65
|
+
|
|
66
|
+
# Config files
|
|
67
|
+
*.config.js
|
|
68
|
+
*.config.ts
|
|
69
|
+
jest.config.*
|
|
70
|
+
wdio.config.*
|
|
71
|
+
playwright.config.*
|
|
72
|
+
cypress.config.*
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2",
|
|
3
|
+
"language": "en,ru,uk,he,fr",
|
|
4
|
+
"import": [
|
|
5
|
+
"./node_modules/@cspell/dict-ru_ru/cspell-ext.json",
|
|
6
|
+
"./node_modules/@cspell/dict-uk-ua/cspell-ext.json",
|
|
7
|
+
"./node_modules/@cspell/dict-he/cspell-ext.json",
|
|
8
|
+
"./node_modules/@cspell/dict-fr-fr/cspell-ext.json"
|
|
9
|
+
],
|
|
10
|
+
"words": [
|
|
11
|
+
"Artur",
|
|
12
|
+
"Polishchuk",
|
|
13
|
+
"uiautomator",
|
|
14
|
+
"UiAutomator2",
|
|
15
|
+
"checkmate",
|
|
16
|
+
"eslint",
|
|
17
|
+
"prettier",
|
|
18
|
+
"cspell",
|
|
19
|
+
"typescript",
|
|
20
|
+
"execa",
|
|
21
|
+
"playwright",
|
|
22
|
+
"pytest",
|
|
23
|
+
"creds",
|
|
24
|
+
"UITM",
|
|
25
|
+
"venv",
|
|
26
|
+
"pycache",
|
|
27
|
+
"wdio",
|
|
28
|
+
"htmlcov",
|
|
29
|
+
"mochawesome",
|
|
30
|
+
"dont",
|
|
31
|
+
"appinstalled",
|
|
32
|
+
"beforeinstallprompt",
|
|
33
|
+
"nav",
|
|
34
|
+
"navs",
|
|
35
|
+
"pr",
|
|
36
|
+
"recaptcha",
|
|
37
|
+
"tsconfig",
|
|
38
|
+
"vite",
|
|
39
|
+
"vitejs",
|
|
40
|
+
"Mavox",
|
|
41
|
+
"sultansadikov",
|
|
42
|
+
"Appi",
|
|
43
|
+
"Validatable",
|
|
44
|
+
"Osek",
|
|
45
|
+
"Patur",
|
|
46
|
+
"Mursheh",
|
|
47
|
+
"Hevra",
|
|
48
|
+
"Baam",
|
|
49
|
+
"Amuta",
|
|
50
|
+
"Sachir",
|
|
51
|
+
"gitleaks",
|
|
52
|
+
"mybono"
|
|
53
|
+
],
|
|
54
|
+
"ignorePaths": [
|
|
55
|
+
"**/node_modules/**",
|
|
56
|
+
"**/dist/**",
|
|
57
|
+
"**/.git/**",
|
|
58
|
+
"**/build/**",
|
|
59
|
+
"**/coverage/**",
|
|
60
|
+
"**/.next/**",
|
|
61
|
+
"**/.nuxt/**",
|
|
62
|
+
"**/out/**",
|
|
63
|
+
"**/__pycache__/**",
|
|
64
|
+
"**/.pytest_cache/**",
|
|
65
|
+
"**/.venv/**",
|
|
66
|
+
"**/venv/**",
|
|
67
|
+
"**/package-lock.json",
|
|
68
|
+
"**/yarn.lock",
|
|
69
|
+
"**/pnpm-lock.yaml",
|
|
70
|
+
"**/*.min.js",
|
|
71
|
+
"**/*.min.css"
|
|
72
|
+
],
|
|
73
|
+
"enableFiletypes": ["typescript", "javascript", "markdown", "json"],
|
|
74
|
+
"ignoreRegExpList": ["/https?:\\/\\/[^\\s]+/g", "/\\b[0-9a-f]{7,40}\\b/gi"]
|
|
75
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import tsParser from '@typescript-eslint/parser';
|
|
5
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Default ESLint rules - can be exported for use in init.ts
|
|
9
|
+
*/
|
|
10
|
+
export const defaultRules = {
|
|
11
|
+
'no-console': 'warn',
|
|
12
|
+
'no-debugger': 'error',
|
|
13
|
+
'prefer-const': 'error',
|
|
14
|
+
'eqeqeq': ['error', 'always'],
|
|
15
|
+
'@typescript-eslint/no-unused-vars': [
|
|
16
|
+
'error',
|
|
17
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
18
|
+
],
|
|
19
|
+
'@typescript-eslint/explicit-function-return-type': ['warn'],
|
|
20
|
+
'@typescript-eslint/no-explicit-any': ['warn'],
|
|
21
|
+
'@typescript-eslint/no-floating-promises': ['error'],
|
|
22
|
+
'space-before-function-paren': 'off',
|
|
23
|
+
'operator-linebreak': 'off',
|
|
24
|
+
'max-len': ['warn', { code: 100 }],
|
|
25
|
+
'semi': ['error', 'always'],
|
|
26
|
+
'quotes': ['error', 'single', { avoidEscape: true }],
|
|
27
|
+
'object-curly-spacing': ['error', 'always'],
|
|
28
|
+
'space-infix-ops': 'error',
|
|
29
|
+
'keyword-spacing': ['error', { before: true, after: true }],
|
|
30
|
+
'padding-line-between-statements': [
|
|
31
|
+
'error',
|
|
32
|
+
{ blankLine: 'always', prev: 'block', next: '*' },
|
|
33
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
34
|
+
],
|
|
35
|
+
'prettier/prettier': [
|
|
36
|
+
'error',
|
|
37
|
+
{
|
|
38
|
+
semi: true,
|
|
39
|
+
singleQuote: true,
|
|
40
|
+
bracketSpacing: true,
|
|
41
|
+
arrowParens: 'avoid',
|
|
42
|
+
printWidth: 100,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Default ignore patterns
|
|
49
|
+
*/
|
|
50
|
+
const defaultIgnores = [
|
|
51
|
+
'**/node_modules/**',
|
|
52
|
+
'**/dist/**',
|
|
53
|
+
'**/.git/**',
|
|
54
|
+
'**/build/**',
|
|
55
|
+
'**/coverage/**',
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Load user's pr-checkmate.json from project root
|
|
60
|
+
* Works both when developing the package and when installed in node_modules
|
|
61
|
+
*/
|
|
62
|
+
function loadUserConfig() {
|
|
63
|
+
let currentDir = process.cwd();
|
|
64
|
+
let configPath = path.join(currentDir, 'pr-checkmate.json');
|
|
65
|
+
|
|
66
|
+
// If running from node_modules, find project root
|
|
67
|
+
if (currentDir.includes('node_modules')) {
|
|
68
|
+
const parts = currentDir.split(path.sep);
|
|
69
|
+
const nodeModulesIndex = parts.lastIndexOf('node_modules');
|
|
70
|
+
if (nodeModulesIndex > 0) {
|
|
71
|
+
currentDir = parts.slice(0, nodeModulesIndex).join(path.sep);
|
|
72
|
+
configPath = path.join(currentDir, 'pr-checkmate.json');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (fs.existsSync(configPath)) {
|
|
77
|
+
try {
|
|
78
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
79
|
+
console.log(`[loadUserConfig]: ✅ Loaded user config from: ${configPath}`);
|
|
80
|
+
return config;
|
|
81
|
+
} catch (err) {
|
|
82
|
+
console.warn(`[loadUserConfig]: ⚠️ Failed to parse ${configPath}:`, err.message);
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
console.log(`[loadUserConfig]: ℹ️ No pr-checkmate.json found, using defaults`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return { sourcePath: 'src', eslint: {} };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const userConfig = loadUserConfig();
|
|
92
|
+
const SRC = userConfig.sourcePath || 'src';
|
|
93
|
+
|
|
94
|
+
// Merge default rules with user-defined rules
|
|
95
|
+
const mergedRules = {
|
|
96
|
+
...defaultRules,
|
|
97
|
+
...(userConfig.eslint?.rules || {}),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Merge default ignores with user-defined ignores
|
|
101
|
+
const mergedIgnores = [
|
|
102
|
+
...defaultIgnores,
|
|
103
|
+
...(userConfig.eslint?.ignorePatterns || []),
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
// Log customization info
|
|
107
|
+
const customRulesCount = Object.keys(userConfig.eslint?.rules || {}).length;
|
|
108
|
+
const customIgnoresCount = (userConfig.eslint?.ignorePatterns || []).length;
|
|
109
|
+
|
|
110
|
+
if (customRulesCount > 0) {
|
|
111
|
+
console.log(`🔧 Applied ${customRulesCount} custom ESLint rules`);
|
|
112
|
+
}
|
|
113
|
+
if (customIgnoresCount > 0) {
|
|
114
|
+
console.log(`🚫 Applied ${customIgnoresCount} custom ignore patterns`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
console.log(`📋 ESLint checking: ${SRC}/**/*.{ts,tsx,js,jsx}`);
|
|
118
|
+
|
|
119
|
+
export default [
|
|
120
|
+
{
|
|
121
|
+
files: [`${SRC}/**/*.{ts,tsx,js,jsx}`],
|
|
122
|
+
ignores: mergedIgnores,
|
|
123
|
+
|
|
124
|
+
languageOptions: {
|
|
125
|
+
parser: tsParser,
|
|
126
|
+
parserOptions: {
|
|
127
|
+
ecmaVersion: 2020,
|
|
128
|
+
sourceType: 'module',
|
|
129
|
+
project: './tsconfig.json',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
plugins: {
|
|
134
|
+
'@typescript-eslint': tsPlugin,
|
|
135
|
+
prettier: prettierPlugin,
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
rules: mergedRules,
|
|
139
|
+
},
|
|
140
|
+
];
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
name: PR Checkmate Quality Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
types: [opened, synchronize, reopened]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
pr-checkmate-all:
|
|
14
|
+
name: PR Checkmate All Checks
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
ref: ${{ github.head_ref }}
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: 20
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
30
|
+
|
|
31
|
+
- name: Run PR Checkmate All Checks
|
|
32
|
+
run: npx pr-checkmate all
|
|
33
|
+
continue-on-error: true
|
|
34
|
+
|
|
35
|
+
- name: Auto-commit formatting changes
|
|
36
|
+
run: |
|
|
37
|
+
git config user.name "github-actions[bot]"
|
|
38
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
39
|
+
git add -A
|
|
40
|
+
if ! git diff --cached --quiet; then
|
|
41
|
+
git commit -m "style: auto-format code with Prettier"
|
|
42
|
+
git push origin HEAD:${{ github.head_ref }}
|
|
43
|
+
echo "Formatting changes committed and pushed"
|
|
44
|
+
else
|
|
45
|
+
echo "No formatting changes needed"
|
|
46
|
+
fi
|
|
47
|
+
env:
|
|
48
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
49
|
+
|
|
50
|
+
lint:
|
|
51
|
+
name: ESLint
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
steps:
|
|
54
|
+
- name: Checkout code
|
|
55
|
+
uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- name: Setup Node.js
|
|
58
|
+
uses: actions/setup-node@v4
|
|
59
|
+
with:
|
|
60
|
+
node-version: 20
|
|
61
|
+
|
|
62
|
+
- name: Install dependencies
|
|
63
|
+
run: npm ci
|
|
64
|
+
|
|
65
|
+
- name: Run ESLint
|
|
66
|
+
run: npx pr-checkmate lint
|
|
67
|
+
continue-on-error: true
|
|
68
|
+
|
|
69
|
+
prettier:
|
|
70
|
+
name: Prettier
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
steps:
|
|
73
|
+
- name: Checkout code
|
|
74
|
+
uses: actions/checkout@v4
|
|
75
|
+
|
|
76
|
+
- name: Setup Node.js
|
|
77
|
+
uses: actions/setup-node@v4
|
|
78
|
+
with:
|
|
79
|
+
node-version: 20
|
|
80
|
+
|
|
81
|
+
- name: Install dependencies
|
|
82
|
+
run: npm ci
|
|
83
|
+
|
|
84
|
+
- name: Run Prettier
|
|
85
|
+
run: npx pr-checkmate prettier
|
|
86
|
+
continue-on-error: true
|
|
87
|
+
|
|
88
|
+
spellcheck:
|
|
89
|
+
name: Spellcheck
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- name: Checkout code
|
|
93
|
+
uses: actions/checkout@v4
|
|
94
|
+
|
|
95
|
+
- name: Setup Node.js
|
|
96
|
+
uses: actions/setup-node@v4
|
|
97
|
+
with:
|
|
98
|
+
node-version: 20
|
|
99
|
+
|
|
100
|
+
- name: Install dependencies
|
|
101
|
+
run: npm ci
|
|
102
|
+
|
|
103
|
+
- name: Run Spellcheck
|
|
104
|
+
run: npx pr-checkmate spellcheck
|
|
105
|
+
continue-on-error: true
|
|
106
|
+
|
|
107
|
+
security:
|
|
108
|
+
name: Security Scan
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
steps:
|
|
111
|
+
- name: Checkout code
|
|
112
|
+
uses: actions/checkout@v4
|
|
113
|
+
with:
|
|
114
|
+
fetch-depth: 0
|
|
115
|
+
|
|
116
|
+
- name: Setup Node.js
|
|
117
|
+
uses: actions/setup-node@v4
|
|
118
|
+
with:
|
|
119
|
+
node-version: 20
|
|
120
|
+
|
|
121
|
+
- name: Install dependencies
|
|
122
|
+
run: npm ci
|
|
123
|
+
|
|
124
|
+
- name: Run Security Scan
|
|
125
|
+
run: npx pr-checkmate security
|
|
126
|
+
continue-on-error: true
|
|
127
|
+
|
|
128
|
+
dependency-check:
|
|
129
|
+
name: Dependency Check
|
|
130
|
+
runs-on: ubuntu-latest
|
|
131
|
+
steps:
|
|
132
|
+
- name: Checkout code
|
|
133
|
+
uses: actions/checkout@v4
|
|
134
|
+
with:
|
|
135
|
+
fetch-depth: 0
|
|
136
|
+
|
|
137
|
+
- name: Setup Node.js
|
|
138
|
+
uses: actions/setup-node@v4
|
|
139
|
+
with:
|
|
140
|
+
node-version: 20
|
|
141
|
+
|
|
142
|
+
- name: Install dependencies
|
|
143
|
+
run: npm ci
|
|
144
|
+
|
|
145
|
+
- name: Run Dependency Check
|
|
146
|
+
run: npx pr-checkmate dependencies
|
|
147
|
+
continue-on-error: true
|