Enforce strict TypeScript and improve code quality #6
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
This PR strengthens the codebase's type safety and code quality by enforcing stricter TypeScript rules, eliminating unsafe type assertions, and fixing regex patterns that could cause performance issues.
Key Changes
TypeScript & Type Safety
@typescript-eslint/explicit-function-return-typeand@typescript-eslint/no-explicit-anyfromwarntoerroras anyassertions: Replaced allas anycasts with proper type annotations throughout the codebasesite/src/routes/docs/+layout.server.ts: Changed toas { message: string }site/src/routes/docs/[...slug]/+page.server.ts: Multiple instances updated with proper error typessrc/lib/generators/api-docs.ts: Replaced with nullish coalescing operator!) with optional chaining and nullish coalescing where appropriatepackages/docs-engine-cli/src/link-checker.ts: Refactored cache lookup to avoid non-null assertionsrc/lib/generators/api-docs.test.ts: Used nullish coalescing for safe accessCode Quality & Security
eslint-plugin-securityrules with intentional exceptions for safe patternsdetect-object-injectionfor typed objects with validated keysdetect-non-literal-regexpfor intentional search functionalitydetect-unsafe-regexto warn for manual reviewpackages/docs-engine-cli/src/link-extractor.ts: Simplified HTML link regex to avoid nested quantifierssrc/lib/generators/parsers/env-parser.ts: Replaced nested\s*with single\sin variable matching patternType System Improvements
src/lib/generators/generic-generator.ts: Moved all types fromtypes.tsinto the main file with full documentationsrc/lib/generators/parsers/sql-parser.ts: AddedSqlColumnandSqlTableinterfaces for claritysrc/lib/components/ScreenshotImage.svelte: DefinedScreenshotImagePropsinlinesrc/lib/components/types.tsandsrc/lib/generators/parsers/types.ts, consolidating exportsDependencies
@types/nodefrom^25.0.10to^25.1.0sveltefrom^5.48.2to^5.48.5happy-domfrom^20.3.9to^20.4.0@types/dompurify(dompurify provides its own types)@rollup/rollup-linux-arm64-gnufrom4.53.2to4.57.0package.jsonfor clarityDocumentation
Implementation Details
anyhttps://claude.ai/code/session_01N5cEyCdZeuFrMLbqeeDqM7