Repository navigation
fix: remove duplicate imports and dead code (#520 #521 #522 #523) - #673
Merged
DeFiVC merged 1 commit intoOct 26, 2026
Conversation
…ainLearnOfficial#520, ChainLearnOfficial#521, ChainLearnOfficial#522) - credentials.ts: remove duplicate getValidToken import (ChainLearnOfficial#520) - module page: remove redundant type-guard render blocks, keep single parseModuleContent call with discriminated-union narrowing (ChainLearnOfficial#522) - types/course.ts: remove duplicate ModuleContent definition, duplicate Module.content property, and now-unused type guards / parseModuleContent - package.json: ChainLearnOfficial#521 no change needed (duplicates not present)
❌ Deploy Preview for chainlearn failed.
|
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.
Summary
Removes duplicate imports, dead code, and a broken render path across three files. Addresses #520, #521, #522, #523, plus a related types-file issue that was blocking compilation.
Changes
#520 —
src/lib/api/credentials.tsgetValidTokenimport that was misplaced mid-file (after theVerifyCredentialResultinterface). The correct top-of-file import is retained and still used bygetCredentialsandmintCredential.CredentialNFTand unusedCredentialMetadata; the current file had neither.CredentialNFTwas single and used;CredentialMetadatawas not imported. The real duplicate wasgetValidToken.#521 —
package.json@radix-ui/react-avatarand@radix-ui/react-dialogeach appeared exactly once in the current file. The duplicates described in the report were not present.#523 — vitest config files
vitest.config.tsexists;vitest.config.mtswas already removed in commitfbbabf2("refactor: consolidate duplicate vitest configs and test directories"). The single-config acceptance criterion is already met.#522 —
src/app/courses/[courseId]/modules/[moduleId]/page.tsxisTextContent,isVideoContent,isInteractiveContenton rawmodule.content) and their import.parseModuleContent(module)call (stored once incontent) and the discriminated-union ternary (content.type === "video"/"interactive", text as fallback).as anycasts existed; none were introduced.Types file —
src/types/course.tsModuleContenttype definition (two conflicting shapes existed in the same file).contentproperty on theModuleinterface (now a singlecontent: string | ModuleContent).isTextContent,isVideoContent,isInteractiveContent) and the deadparseModuleContent(content: ModuleContent): stringhelper. Grep confirms zero dangling references across the codebase.What was tested
ModuleContentnow appears exactly once with the correct shape, andparseModuleContentinsrc/lib/api/courses.tsreturns the structured union used by the page and the test suite.Not verified
tsc --noEmit, ESLint, and the test suite (vitest) could not be run becausenode_moduleswas not installed in the working environment. Recommend runningnpm install && npm run typecheck && npm run lint && npm testin CI.Closes #520, Closes #521, Closes #522, Closes #523