fix: integrate strict ESLint config and restore build stability#2709
fix: integrate strict ESLint config and restore build stability#2709Adarshkumar0509 wants to merge 21 commits intoOWASP:masterfrom
Conversation
…ct type assertions
|
Hi @sydseter,I have completed the integration of the strict ESLint configuration (eslint-config-love) and resolved the resulting build blockers. I utilized the AI-assisted refactoring approach as suggested in the issue to handle the complex type-assertion logic in deckService.ts. Ready for your review! |
There was a problem hiding this comment.
The coverage for deckService.ts has fallen with 30% which indicates that some tests have been removed. These should be restored.
There was a problem hiding this comment.
Sorry @sydseter! You are completely right. It looks like the automated eslint --fix or my manual cleanup accidentally stripped out some of the existing test blocks in deckService.test.ts. I will restore those missing tests, ensure they pass with the new strict types, and push an update shortly to get that coverage back up.
There was a problem hiding this comment.
sir the tests are restored and coverage is back to 100%.
…arshkumar0509/cornucopia into major-contribution-eslint-fix
Resolves #2647
Description
This PR integrates the new strict ESLint configuration into the build pipeline and, more importantly, restores project stability following the initial automated linting cleanup.
Key Technical Contributions:
Build Restoration: -
Manually identified and restored critical exports (Stores, Controllers, and Utils) that were accidentally stripped during the automated eslint --fix process. This was essential to move the project from a "Hard Crash" state back to a successful production build.
Strict Typing Refactor:-
Performed extensive manual refactoring in src/lib/services/deckService.ts and src/routes/api/lang/[edition]/[version]/server.test.ts to satisfy eslint-config-love without resorting to any overrides.
Safe Logic Implementation:-
Re-wrote the YAML parsing logic in deckService.ts. The new implementation uses safe JS traversal to satisfy the linter while maintaining the runtime integrity required to parse all 80/251 cards correctly.
Naming Alignment:-
Synchronized naming conventions (e.g., DevGuideMapping) between logic files and Svelte components to resolve UI compilation errors.
Testing & Verification:
Production Build: Confirmed pnpm run build now completes successfully, generating the sitemap and production assets.
Logic Tests: All 29 core logic tests are passing green.
Coverage Note: Global coverage is currently at ~67%. This is a known baseline issue in the repo (e.g., authorController.ts at 0%). Restoring the unexported logic allows the build to pass, even though these areas lack legacy unit tests.
AI Disclosure
In alignment with the suggestion from @sydseter in the related issue, I utilized an AI assistant Chatgpt as a technical peer to help navigate the most complex manual refactoring required by the strict eslint-config-love rules. Specifically, I used AI to help brainstorm safe TypeScript patterns for bridging dynamic YAML outputs into strict Card types without breaking runtime logic. All resulting code was manually reviewed, integrated, and verified against the local build environment.