Repository navigation
Tech-debt cleanup: remove dead imports and stale commented-out code - #178
Merged
Merged
Conversation
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
There was a problem hiding this comment.
🟢 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
Reactdefault imports (automatic JSX runtime) plus other unused react-admin/shared imports - App wiring: remove unused
StudentEventReportimport
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)entity-modules/reports/utilsfiles:IsUniqueCombination,OneToMany/Klass/Lesson/StudentKlass(User.entity.ts),DataSource/JoinColumn/ManyToOne(several view-entities),AttGradeEffect,formatTime,Any, and an unusedfillDefaultYearValueimport inReportGroupSession.entity.ts.userIdinteacherReportFile.ts(array destructure now skips that slot).student-by-year.config.ts'0%'branch comment instudentReportData.util.tshoursRow/topicRow/lessonCountRow/teacherRow/separatorRow) inklassAttendanceReport.tsClient (
client: remove unused imports)Reactimport from ~20 components/entities. The project uses@vitejs/plugin-reactwith the automatic JSX runtime (React 18), so JSX no longer requiresReactin scope, and none of these files referencedReact.*directly (verified individually).DateInput,SelectInput,NumberInput,SelectField,BooleanInput,ReferenceArrayField/ReferenceArrayInput,FormDataConsumer,required,maxLength), shared utils (filterByUserId,CommonReferenceInputFilter,CommonSelectArrayField,useAuthState,usePermissions), and one unused default import (StudentEventReportinApp.jsx).No renames, no architecture changes, no route/signature changes.
anytypes were audited but left as-is — this repo's ESLint config explicitly disables@typescript-eslint/no-explicit-any, and the remaininganyusages are inCrudRequest<any, any>/doActioncallback signatures that are load-bearing to the@dataui/crudpattern 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 installin bothclient/andserver/(no Docker/e2e — not applicable here):server(yarn test)client(yarn test)* The very first server run (before
sqlite3's native binding had finished building in this sandbox) showed 8 unrelated suite failures fromDriverPackageNotInstalledError: 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