Skip to content

Commit 66f14d4

Browse files
committed
fix: resolve pre-release linting and formatting issues
- Move escapeRegex function definition before usage in api-report fixer.ts - Remove unused tsx dependency from interface-mapping-validator package.json - Auto-format davinci-client API report files
1 parent baf5d2b commit 66f14d4

6 files changed

Lines changed: 135 additions & 8 deletions

File tree

PRE_RELEASE_FIXES.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Pre-Release Fixes - Quick Reference
2+
3+
## 🟡 3 Minor Issues to Fix (5-7 minutes total)
4+
5+
### Issue #1: Formatting ⏱️ 2 min
6+
7+
**Status**: 2 files need formatting
8+
9+
```bash
10+
# Run formatter
11+
pnpm nx format
12+
13+
# Verify fix
14+
pnpm nx format:check
15+
```
16+
17+
**Files Affected**:
18+
19+
- `packages/davinci-client/api-report/davinci-client.api.md`
20+
- `packages/davinci-client/api-report/davinci-client.types.api.md`
21+
22+
---
23+
24+
### Issue #2: Lint Warning - Unused Dependency ⏱️ 2 min
25+
26+
**Location**: `tools/interface-mapping-validator/package.json:18:5`
27+
**Issue**: "tsx" package is not used
28+
29+
**Option A - Auto-fix**:
30+
31+
```bash
32+
pnpm nx lint tools/interface-mapping-validator --fix
33+
```
34+
35+
**Option B - Manual fix**:
36+
37+
```bash
38+
# Edit: tools/interface-mapping-validator/package.json
39+
# Remove "tsx" from devDependencies (line 18)
40+
# Then reinstall
41+
pnpm install
42+
```
43+
44+
---
45+
46+
### Issue #3: Lint Warning - Definition Order ⏱️ 1 min
47+
48+
**Location**: `tools/api-report/src/fixer.ts:57:7`
49+
**Issue**: 'escapeRegex' used before definition
50+
51+
**View the issue**:
52+
53+
```bash
54+
head -60 tools/api-report/src/fixer.ts | tail -10
55+
```
56+
57+
**Fix**: Move `escapeRegex` function definition above line 57 (where it's first used)
58+
59+
**Current Pattern** (line 57):
60+
61+
```typescript
62+
const escaped = escapeRegex(input);
63+
// ... lots of code ...
64+
function escapeRegex(str: string) { ... } // defined later
65+
```
66+
67+
**After Fix**:
68+
69+
```typescript
70+
function escapeRegex(str: string) { ... } // define first
71+
72+
// ... lots of code ...
73+
74+
const escaped = escapeRegex(input); // use after
75+
```
76+
77+
Or use auto-fix:
78+
79+
```bash
80+
pnpm nx lint tools/api-report --fix
81+
```
82+
83+
---
84+
85+
## Verification Commands
86+
87+
After fixing, run these to verify:
88+
89+
```bash
90+
# 1. Format check
91+
pnpm nx format:check
92+
93+
# 2. Lint check
94+
pnpm nx run-many -t lint
95+
96+
# 3. Full verification
97+
pnpm nx run-many -t build typecheck lint test
98+
```
99+
100+
---
101+
102+
## Expected Results After Fixes
103+
104+
```
105+
✅ pnpm nx format:check → PASS
106+
✅ pnpm nx run-many -t lint → No warnings
107+
✅ pnpm nx run-many -t test → All tests passing
108+
✅ pnpm nx run-many -t build → All projects building
109+
```
110+
111+
---
112+
113+
## Release Checklist
114+
115+
- [ ] Run `pnpm nx format`
116+
- [ ] Run `pnpm nx lint --fix` (or manually fix both warnings)
117+
- [ ] Run `pnpm nx format:check` (verify)
118+
- [ ] Run `pnpm nx run-many -t lint` (verify no warnings)
119+
- [ ] Run `pnpm nx run-many -t build typecheck test` (final verification)
120+
- [ ] Push to branch
121+
- [ ] Verify GitHub Actions CI/CD passes
122+
- [ ] **READY FOR RELEASE**
123+
124+
---
125+
126+
**Estimated Time**: 5-7 minutes
127+
**Risk Level**: MINIMAL (formatting and code order only)
128+
**Impact**: ZERO (no logic changes, no behavior changes)
46.3 KB
Loading

e2e/davinci-suites/debug-flows.png

32.9 KB
Loading

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/api-report/src/fixer.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ export function resolveSourcePackage(sourceFilePath: string, workspaceRoot: stri
4545
return null;
4646
}
4747

48+
/**
49+
* Escapes special regex characters in a string.
50+
*/
51+
function escapeRegex(str: string): string {
52+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
53+
}
54+
4855
/**
4956
* Finds the module specifier for a symbol's import in a .d.ts file.
5057
* Given `import { ForgottenType } from '@forgerock/sdk-types'`, returns '@forgerock/sdk-types'.
@@ -107,10 +114,6 @@ export function buildReExportStatement(
107114
return keyword + ' { ' + symbolName + " } from '" + sourcePackage + "';";
108115
}
109116

110-
function escapeRegex(str: string): string {
111-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
112-
}
113-
114117
/**
115118
* Inserts a re-export into a types.ts file content.
116119
* - If an existing re-export block for the same package and kind exists, appends to it.

tools/interface-mapping-validator/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
},
1616
"dependencies": {
1717
"ts-morph": "^28.0.0",
18-
"tsx": "catalog:",
1918
"vitest": "catalog:vitest"
2019
},
2120
"devDependencies": {

0 commit comments

Comments
 (0)