Draft
refactor: enforce highest coding standards across the project#3
Conversation
Co-authored-by: ak4dev <92195328+ak4dev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor project to enforce highest coding standards
refactor: enforce highest coding standards across the project
Mar 14, 2026
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.
The codebase had several quality gaps: prop mutation used as an output channel, fragile regex-based number extraction, no runtime validation on imported state, a non-null assertion at the entry point, and ESLint configured without type-aware rules.
Core logic
growthMatrixremoved fromInvestmentCalculatorProps— it was mutated as an output channel, not used as input. Now a private internal field, reset at the top of eachcalculateGrowth()call.calculateGrowth()return type changed fromstringto{ formatted: string; numeric: number }, eliminating this pattern at every call site:isValidInput()now bounds-checks againstMAX_PROJECTED_GAIN/MAX_YEARS_OF_GROWTH; numeric string validation extracted into aprivate static isValidNumericString()helper.State import/export
isTH4State()type guard added — validates the fullTH4Stateshape before applying imported JSON. Previously any file was blindly applied to state.date-fnsformat()instead of manualtoISOString().replace(...).slice().Entry point
document.getElementById("root")!replaced with an explicit null guard that throws a descriptive error.ESLint
tseslint.configs.recommendedtotseslint.configs.recommendedTypeCheckedwithparserOptions.project, enabling the full suite of type-aware rules. Two violations surfaced and fixed: explicitnumberannotation on a recharts callback, and.toString()on a Stitcheskeyframesreference in a template literal.Original prompt
Created from VS Code.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.