mirror of
https://github.com/formax68/memoChron.git
synced 2026-07-22 05:45:44 +00:00
docs(08-01): summary for unused vars cleanup plan
Records the 18 @typescript-eslint/no-unused-vars violations closed, the two catch-binding conversions, per-symbol grep verifications, and the two minor deviations (DEFAULT_CALENDAR_URLS export delete in constants.ts; split into two atomic per-task commits per executor protocol).
This commit is contained in:
parent
a557c10c68
commit
99865a8903
1 changed files with 186 additions and 0 deletions
186
.planning/phases/08-type-hygiene-conventions/08-01-SUMMARY.md
Normal file
186
.planning/phases/08-type-hygiene-conventions/08-01-SUMMARY.md
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
---
|
||||
phase: 08-type-hygiene-conventions
|
||||
plan: 01
|
||||
subsystem: type-hygiene
|
||||
tags: [refactor, lint, dir-10, unused-vars]
|
||||
requires: []
|
||||
provides:
|
||||
- "DIR-10 closed at the violation level (0 @typescript-eslint/no-unused-vars across src/)"
|
||||
- "2 unused catch bindings replaced with catch {} (no binding) per D-09 default"
|
||||
affects:
|
||||
- src/services/CalendarService.ts
|
||||
- src/services/IcsImportService.ts
|
||||
- src/settings/SettingsTab.ts
|
||||
- src/settings/types.ts
|
||||
- src/utils/constants.ts
|
||||
- src/utils/viewRenderers.ts
|
||||
- src/views/CalendarView.ts
|
||||
- src/views/EmbeddedCalendarView.ts
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns:
|
||||
- "catch { /* unused error */ } — TypeScript 4.4+ optional catch binding"
|
||||
key-files:
|
||||
created: []
|
||||
modified:
|
||||
- src/services/CalendarService.ts
|
||||
- src/services/IcsImportService.ts
|
||||
- src/settings/SettingsTab.ts
|
||||
- src/settings/types.ts
|
||||
- src/utils/constants.ts
|
||||
- src/utils/viewRenderers.ts
|
||||
- src/views/CalendarView.ts
|
||||
- src/views/EmbeddedCalendarView.ts
|
||||
decisions:
|
||||
- "Removed both the unused import in types.ts AND the unused export in constants.ts for DEFAULT_CALENDAR_URLS to satisfy the plan acceptance criterion that grep -rn returns zero matches anywhere in src/. constants.ts was not in the plan's files_modified list but the plan's action text and acceptance criteria both require the export deletion."
|
||||
- "Split the single planner-suggested commit (Task 3 'EXACT message') into two atomic per-task commits (Task 1 and Task 2) per the executor protocol's per-task-commit rule. No work content changed."
|
||||
metrics:
|
||||
duration: "3m 33s"
|
||||
completed: "2026-05-16T15:05:38Z"
|
||||
tasks_completed: 3
|
||||
commits: 2
|
||||
files_modified: 8
|
||||
violations_closed: 18
|
||||
---
|
||||
|
||||
# Phase 08 Plan 01: Unused Vars Cleanup (DIR-10) Summary
|
||||
|
||||
Deleted every `@typescript-eslint/no-unused-vars` violation in `src/` — 18 sites across 8 files — landing the smallest mechanical commit of Phase 8 with zero behaviour change.
|
||||
|
||||
## Result
|
||||
|
||||
- **Total violations closed:** 18 of 18 (100%)
|
||||
- **Catch bindings converted to `catch { }`:** 2 (`CalendarService.ts:531`, `SettingsTab.ts:1174`)
|
||||
- **Imports removed:** 12 named symbols across 6 files
|
||||
- **Local variables inlined / interface deleted:** 4 (`controls`, two `title` bindings, `DateElements` interface)
|
||||
- **Unused exports deleted:** 1 (`DEFAULT_CALENDAR_URLS` in `constants.ts`)
|
||||
- **ESLint final state:** `npm run lint` exit 0; rule-explicit pass `npx eslint 'src/**/*.ts' --rule '@typescript-eslint/no-unused-vars: ["error", { "args": "none" }]'` reports zero `no-unused-vars` errors
|
||||
- **Build:** `npm run build` exit 0
|
||||
|
||||
## Per-File Symbol Inventory
|
||||
|
||||
| File | Symbols Removed | Count |
|
||||
| ---- | --------------- | ----- |
|
||||
| `src/services/CalendarService.ts` | `convertTimezone` import (line 12); `error` catch binding (line 531) → `catch { }` | 2 |
|
||||
| `src/services/IcsImportService.ts` | `Property` import (line 5) | 1 |
|
||||
| `src/settings/SettingsTab.ts` | `TextAreaComponent`, `DropdownComponent`, `CalendarNotesSettings` imports; `error` catch binding (line 1174) → `catch { }` | 4 |
|
||||
| `src/settings/types.ts` | `DEFAULT_CALENDAR_URLS` import (line 4) | 1 |
|
||||
| `src/utils/constants.ts` | `DEFAULT_CALENDAR_URLS` export declaration (line 5) — see Deviations | 1 |
|
||||
| `src/utils/viewRenderers.ts` | `MemoChronSettings`, `TFile`, `Notice`, `App` imports (lines 2–3) | 4 |
|
||||
| `src/views/CalendarView.ts` | `DropdownComponent` import (line 1); `DateElements` interface (line 14); `controls` local var (line 200); `title` local var (line 1101) | 4 |
|
||||
| `src/views/EmbeddedCalendarView.ts` | `CalendarEvent` import (line 15); `title` local var (line 109) | 2 |
|
||||
| **Total** | | **19** |
|
||||
|
||||
(18 violations + 1 dependent unused export.)
|
||||
|
||||
## Catch-Binding Conversions (D-09 default)
|
||||
|
||||
Both unused-`error` catch sites were converted to `catch { }` (no binding) per the CONTEXT.md D-09 default and the RESEARCH.md per-site verification:
|
||||
|
||||
1. **`src/services/CalendarService.ts:531`** — body returns a fixed `{ status: 404, text: "Cannot read file: ..." }`; the error is never referenced. Now `} catch {`.
|
||||
2. **`src/settings/SettingsTab.ts:1174`** — body renders a generic `"Invalid template format"` notice; the error is never referenced. Now `} catch {`.
|
||||
|
||||
Neither change is a UX or behaviour change — the surfaced text and the surrounding control flow are identical.
|
||||
|
||||
## Verification Commands and Results
|
||||
|
||||
### `npm run lint`
|
||||
|
||||
```
|
||||
> memochron@1.14.0 lint
|
||||
> eslint src/
|
||||
```
|
||||
|
||||
Exit 0; no output (no violations).
|
||||
|
||||
### `npm run build`
|
||||
|
||||
```
|
||||
> memochron@1.14.0 build
|
||||
> tsc -noEmit -skipLibCheck && node esbuild.config.mjs production
|
||||
```
|
||||
|
||||
Exit 0; clean tsc + esbuild production output.
|
||||
|
||||
### Rule-explicit `no-unused-vars` pass (bypasses the file-level override block)
|
||||
|
||||
```
|
||||
$ npx eslint 'src/**/*.ts' --rule '@typescript-eslint/no-unused-vars: ["error", { "args": "none" }]' 2>&1 | grep -c "no-unused-vars"
|
||||
0
|
||||
```
|
||||
|
||||
Zero remaining `no-unused-vars` violations across the entire `src/` tree, including the 7 files that the `eslint.config.mjs:92–105` per-file override currently suppresses. Plan 04 will delete that override block; this plan ensures it will continue passing once it does.
|
||||
|
||||
### Per-symbol grep verifications
|
||||
|
||||
All 18 RESEARCH.md-listed sites verified absent via word-boundary greps:
|
||||
|
||||
| Symbol | File | Hits |
|
||||
| ------ | ---- | ---- |
|
||||
| `\bconvertTimezone\b` | `src/services/CalendarService.ts` | 0 |
|
||||
| `\berror\b` (catch site 531) | `src/services/CalendarService.ts` — `} catch {` count ≥ 1 | OK |
|
||||
| `\bProperty\b` | `src/services/IcsImportService.ts` | 0 |
|
||||
| `\bTextAreaComponent\b` | `src/settings/SettingsTab.ts` | 0 |
|
||||
| `\bDropdownComponent\b` | `src/settings/SettingsTab.ts` | 0 |
|
||||
| `\bCalendarNotesSettings\b` | `src/settings/SettingsTab.ts` | 0 |
|
||||
| `\berror\b` (catch site 1174) | `src/settings/SettingsTab.ts` — `} catch {` count ≥ 1 | OK |
|
||||
| `\bDEFAULT_CALENDAR_URLS\b` | `src/` (recursive) | 0 |
|
||||
| `\bMemoChronSettings\b` | `src/utils/viewRenderers.ts` | 0 |
|
||||
| `\bTFile\b` | `src/utils/viewRenderers.ts` | 0 |
|
||||
| `\bNotice\b` | `src/utils/viewRenderers.ts` | 0 |
|
||||
| `\bApp\b` | `src/utils/viewRenderers.ts` | 0 |
|
||||
| `\bDropdownComponent\b` | `src/views/CalendarView.ts` | 0 |
|
||||
| `\binterface DateElements\b` | `src/views/CalendarView.ts` | 0 |
|
||||
| `\bDateElements\b` | `src/views/CalendarView.ts` | 0 |
|
||||
| `^\s*const controls\s*=` near line 200 | `src/views/CalendarView.ts` | gone |
|
||||
| `^\s*const title\s*=` near line 1101 | `src/views/CalendarView.ts` | gone |
|
||||
| `\bCalendarEvent\b` | `src/views/EmbeddedCalendarView.ts` | 0 |
|
||||
| `^\s*const title\s*=` near line 109 | `src/views/EmbeddedCalendarView.ts` | gone |
|
||||
|
||||
(Plain `grep -c` produced false positives for `Property` — matches `getFirstProperty`/`hasProperty` method names — and `CalendarNotesSettings` — matches `CalendarNotesSettingsModal`. Word-boundary `\b` grep confirmed both target symbols are gone.)
|
||||
|
||||
## Commits
|
||||
|
||||
| # | Hash | Subject |
|
||||
| - | ---- | ------- |
|
||||
| 1 | `c962547` | `refactor(08-01): remove unused vars in services and settings (Task 1)` |
|
||||
| 2 | `a557c10` | `refactor(08-01): remove unused vars in utils and views (Task 2)` |
|
||||
|
||||
Neither commit message contains "Claude", "AI", "Anthropic", or "claude.ai" (case-insensitive) per `CLAUDE.md` Memory Reminders.
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### [Rule 2 – Missing critical action] Deleted `DEFAULT_CALENDAR_URLS` export in `constants.ts` (not listed in plan's `files_modified`)
|
||||
|
||||
- **Found during:** Task 1
|
||||
- **Issue:** The plan's `files_modified` frontmatter lists `src/settings/types.ts` (the import line) but not `src/utils/constants.ts` (the export declaration). However, the plan's action step 8 explicitly says "Delete the `DEFAULT_CALENDAR_URLS` export" and its acceptance criterion `grep -rn "DEFAULT_CALENDAR_URLS" src/` requires zero matches anywhere in `src/`. Removing only the import would leave the unused export in `constants.ts` and fail the acceptance criterion.
|
||||
- **Fix:** Deleted both the import in `src/settings/types.ts:4` and the unused export declaration in `src/utils/constants.ts:5`. No other code references the symbol (verified via repo-wide grep before deletion).
|
||||
- **Files modified:** `src/utils/constants.ts` (added to Task 1 commit)
|
||||
- **Commit:** `c962547`
|
||||
|
||||
### [Protocol — atomic commits] Task 3's single "EXACT" commit message replaced by two per-task commits
|
||||
|
||||
- **Found during:** Task 3 (verification)
|
||||
- **Issue:** Task 3's action specifies a single commit message that would land all 18 violations as one commit. The executor protocol's `<task_commit_protocol>` requires committing after each task completes. Tasks 1 and 2 were already committed atomically before Task 3 ran, so Task 3 found no modified files left to commit.
|
||||
- **Fix:** Used two per-task commit messages (one for Task 1, one for Task 2) instead of the single combined message. The total set of source changes is identical to what Task 3's combined message described, just split across two commits.
|
||||
- **Files modified:** None (commit-message-only deviation)
|
||||
- **Commits:** `c962547` (Task 1), `a557c10` (Task 2)
|
||||
|
||||
## Authentication Gates
|
||||
|
||||
None — DIR-10 cleanup is a pure compile-time / static-analysis refactor.
|
||||
|
||||
## Known Stubs
|
||||
|
||||
None — every deletion is dead code. No new stub patterns introduced; no `TODO`/`FIXME`/`coming soon` strings added.
|
||||
|
||||
## Threat Flags
|
||||
|
||||
None — pure deletion of unused source symbols. No new network endpoints, auth paths, or trust-boundary changes.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
- File `.planning/phases/08-type-hygiene-conventions/08-01-SUMMARY.md` — created (this file).
|
||||
- Commit `c962547` — FOUND in `git log`.
|
||||
- Commit `a557c10` — FOUND in `git log`.
|
||||
- All 8 modified source files — FOUND on disk and committed.
|
||||
Loading…
Reference in a new issue