Skip to content

Tech-debt cleanup: remove dead imports and stale commented-out code - #178

Merged
buzz-code merged 2 commits into
mainfrom
claude/tech-debt-refactor
Sep 23, 2026
Merged

buzz-code merged 2 commits into
mainfrom
claude/tech-debt-refactor

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

What changed

Surgical, low-risk technical-debt cleanup. No public API, route, or behavior changes — every edit is either a dead import removal or a stale commented-out code block removal.

Server (server: remove dead imports and stale commented-out code)

  • Removed unused TypeORM/type imports across entities, view-entities, and a few entity-modules/reports/utils files: IsUniqueCombination, OneToMany/Klass/Lesson/StudentKlass (User.entity.ts), DataSource/JoinColumn/ManyToOne (several view-entities), AttGradeEffect, formatTime, Any, and an unused fillDefaultYearValue import in ReportGroupSession.entity.ts.
  • Dropped an unused destructured userId in teacherReportFile.ts (array destructure now skips that slot).
  • Removed stale commented-out code left over from prior work:
    • an inert early-return guard in student-by-year.config.ts
    • a disabled '0%' branch comment in studentReportData.util.ts
    • unused header-row scaffolding (hoursRow/topicRow/lessonCountRow/teacherRow/separatorRow) in klassAttendanceReport.ts

Client (client: remove unused imports)

  • Removed the unused default React import from ~20 components/entities. The project uses @vitejs/plugin-react with the automatic JSX runtime (React 18), so JSX no longer requires React in scope, and none of these files referenced React.* directly (verified individually).
  • Removed other unused named imports found alongside them: react-admin inputs/fields (DateInput, SelectInput, NumberInput, SelectField, BooleanInput, ReferenceArrayField/ReferenceArrayInput, FormDataConsumer, required, maxLength), shared utils (filterByUserId, CommonReferenceInputFilter, CommonSelectArrayField, useAuthState, usePermissions), and one unused default import (StudentEventReport in App.jsx).

No renames, no architecture changes, no route/signature changes. any types were audited but left as-is — this repo's ESLint config explicitly disables @typescript-eslint/no-explicit-any, and the remaining any usages are in CrudRequest<any, any>/doAction callback signatures that are load-bearing to the @dataui/crud pattern used consistently across all entity-modules; retyping them broadly was out of scope for a low-risk pass.

Why

Reduces dead-code noise (unused imports, disabled/orphaned code paths) without touching any working logic, making the affected files easier to read and slightly trimming bundle/compile surface.

Testing

Ran the existing unit test suites before and after, from a clean yarn install in both client/ and server/ (no Docker/e2e — not applicable here):

Suite Before After
server (yarn test) 117/117 suites, 1028/1028 tests passing* 117/117 suites, 1028/1028 tests passing
client (yarn test) 31/32 suites (1 pre-existing skip), 204/205 tests passing 31/32 suites (1 pre-existing skip), 204/205 tests passing — identical

* The very first server run (before sqlite3's native binding had finished building in this sandbox) showed 8 unrelated suite failures from DriverPackageNotInstalledError: SQLite package has not been found installed; that's an environment/native-module build artifact unconnected to this diff, and it cleared up on its own once the binding finished — included here for transparency, not as a regression.

No pre-existing failures remain in either suite; no new failures introduced.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Nk3qfmWuX1u4GpRMBL2jog


Generated by Claude Code

Low-risk cleanup pass, no behavior change:
- Remove unused TypeORM/type imports across entities, view-entities,
  and a few entity-modules/reports/utils files (IsUniqueCombination,
  OneToMany/Klass/Lesson/StudentKlass, DataSource/JoinColumn/ManyToOne,
  AttGradeEffect, formatTime, Any, fillDefaultYearValue where unused).
- Drop an unused destructured `userId` in teacherReportFile.ts.
- Remove stale commented-out code blocks left over from prior work:
  an inert early-return guard in student-by-year.config.ts, a
  disabled '0%' branch in studentReportData.util.ts, and unused
  header-row scaffolding (hoursRow/topicRow/etc.) in
  klassAttendanceReport.ts.

Verified via `yarn test` in server/ before and after: 117/117 suites,
1028/1028 tests passing both times (no regressions).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nk3qfmWuX1u4GpRMBL2jog
Low-risk cleanup pass, no behavior change:
- Remove the unused default `React` import from ~20 components/entities.
  The project uses @vitejs/plugin-react with the automatic JSX runtime
  (React 18), so JSX no longer requires React in scope; none of these
  files referenced `React.*` directly.
- Remove other unused named imports found alongside them (react-admin
  inputs/fields like DateInput, SelectInput, NumberInput, SelectField,
  BooleanInput, ReferenceArrayField/Input, FormDataConsumer, required,
  maxLength, filterByUserId, CommonReferenceInputFilter,
  CommonSelectArrayField, useAuthState, usePermissions) and one unused
  default import (StudentEventReport in App.jsx).

Verified via `yarn test` in client/ before and after: identical results,
31/32 suites passing (1 pre-existing skip), 204/205 tests passing both
times (no regressions).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nk3qfmWuX1u4GpRMBL2jog
Copilot AI lite review requested due to automatic review settings September 5, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Changes limited to unused-import removal and deletion of commented-out dead code, with no functional deltas found in reviewed hunks.

Pull request overview

Tech-debt cleanup across server (NestJS/TypeORM) and client (React-Admin) to reduce dead-code noise by removing unused imports and stale commented-out blocks, without changing routes or public behavior.

Changes:

  • Server: drop unused TypeORM/shared imports; remove inert commented-out report/config code; small destructuring cleanup in report param parsing
  • Client: remove unused React default imports (automatic JSX runtime) plus other unused react-admin/shared imports
  • App wiring: remove unused StudentEventReport import
File summaries
File Description
server/src/utils/studentReportData.util.ts Remove unused TypeORM Any import and stale commented branch
server/src/reports/teacherReportFile.ts Remove unused destructured userId from params.id split
server/src/reports/klassAttendanceReport.ts Remove unused formatTime import and commented header-row scaffolding
server/src/entity-modules/student-percent-report.config.ts Remove unused AttGradeEffect import
server/src/entity-modules/student-by-year.config.ts Remove inert commented early-return guard
server/src/db/view-entities/TeacherReportStatus.entity.ts Remove unused TypeORM relation imports
server/src/db/view-entities/TeacherGradeReportStatus.entity.ts Remove unused TypeORM relation imports
server/src/db/view-entities/StudentByYear.entity.ts Remove unused TypeORM relation imports
server/src/db/view-entities/LessonKlassName.entity.ts Remove unused entity imports (and unused TypeORM import)
server/src/db/view-entities/AttReportAndGrade.entity.ts Remove unused relation/entity imports (and unused TypeORM import)
server/src/db/entities/User.entity.ts Remove unused OneToMany and unused entity imports
server/src/db/entities/ReportGroupSession.entity.ts Remove unused fillDefaultYearValue import
server/src/db/entities/AbsenceType.entity.ts Remove unused IsUniqueCombination import
client/src/settings/Settings.jsx Remove unused default React import
client/src/settings/ReportStylesInput.jsx Remove unused default React import
client/src/settings/ReportCardSettingsInput.jsx Remove unused default React import
client/src/settings/GeneralSettingsInput.jsx Remove unused default React import
client/src/RootDashboard.jsx Remove unused default React import
client/src/reports/InLessonReport.jsx Remove unused default React import (keep hooks)
client/src/reports/in-lesson-report/TeacherSelector.jsx Remove unused default React import (keep hooks)
client/src/reports/in-lesson-report/StudentList.jsx Remove unused default React import (keep hooks)
client/src/reports/in-lesson-report/ReportHeader.jsx Remove unused default React import (keep hooks)
client/src/reports/in-lesson-report/MainReport.jsx Remove unused default React import
client/src/reports/in-lesson-report/LessonSelector.jsx Remove unused default React import (keep hooks)
client/src/reports/in-lesson-report/index.jsx Remove unused React hooks from import list
client/src/reports/in-lesson-report/FormActions.jsx Remove unused default React import (keep hooks)
client/src/pivots/StudentAttendanceList.jsx Remove unused react-admin/shared imports
client/src/pivots/PercentReportWithDatesList.jsx Remove unused react-admin hooks imports
client/src/entities/teacher.jsx Remove unused react-admin import(s)
client/src/entities/teacher-salary-report.jsx Remove unused react-admin field import
client/src/entities/student.jsx Remove unused react-admin/shared imports
client/src/entities/student-klasses-report.jsx Remove unused react-admin field import
client/src/entities/student-klass.jsx Remove unused react-admin import(s)
client/src/entities/report-month.jsx Remove unused react-admin import(s)
client/src/entities/lesson.jsx Remove unused react-admin array field/input imports
client/src/entities/known-absence.jsx Remove unused shared util import
client/src/entities/attendance-name.jsx Remove unused shared filter import
client/src/entities/att-report-with-report-month.jsx Remove unused required import
client/src/entities/att-grade-effect.jsx Remove unused maxLength import
client/src/components/TeacherView/TeacherAccess.jsx Remove unused default React import
client/src/components/StudentView/StudentAccess.jsx Remove unused default React import
client/src/components/StudentView/student-event-report.jsx Remove unused react-admin import
client/src/components/LessonSignatureFields.jsx Remove unused default React import
client/src/components/fields/ThresholdColorField.jsx Remove unused default React import
client/src/components/ApprovedAbsencesUpload/PreviewTable.jsx Remove unused default React import
client/src/components/ApprovedAbsencesUpload/PreviewSummary.jsx Remove unused default React import
client/src/components/ApprovedAbsencesUpload/FileUploadSection.jsx Remove unused default React import
client/src/components/ApprovedAbsencesUpload/ConfigurationForm.jsx Remove unused default React import
client/src/components/ApprovedAbsencesUpload/ActionButtons.jsx Remove unused default React import
client/src/components/ApprovedAbsencesUpload.jsx Remove unused default React import (keep hooks)
client/src/App.jsx Remove unused StudentEventReport import
Review details
  • Files reviewed: 51/51 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@buzz-code
buzz-code merged commit e0272b6 into main Sep 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants