Skip to content

refactor: comprehensive code quality improvements#2

Open
Luna161 wants to merge 23 commits into
Jespermagician:mainfrom
Luna161:refactor/code-quality-improvements
Open

refactor: comprehensive code quality improvements#2
Luna161 wants to merge 23 commits into
Jespermagician:mainfrom
Luna161:refactor/code-quality-improvements

Conversation

@Luna161
Copy link
Copy Markdown

@Luna161 Luna161 commented May 9, 2026

Summary

This PR delivers comprehensive code quality improvements across the entire Web-Calculator codebase: TypeScript source, HTML, CSS, and project configuration.

TypeScript Improvements

  • Type safety: Renamed operation interface to PascalCase Operation, replaced any with proper constructor type new () => Operation, made second parameter optional to properly support unary operations
  • Bug fixes: Added division-by-zero guards (division, modulo, wolfram), fixed backspace() to use Math.trunc for correct negative number handling, fixed decimal() comparison (<====), reset this.op in clear(), reset lastResult in setZero()
  • Logic fix: Unary operations (root2, power2, wolfram, flipNumber) no longer incorrectly set this.op, preventing wrong equal() behavior
  • Cleanup: Removed all console.log debug statements, removed empty constructors, removed the redundant DOMContentLoaded click listener, replaced custom power() function with the ** operator, added missing semicolons

HTML Fixes

  • Fixed double-quote typo in root2 onclick attribute
  • Corrected stong-text typo → strong-text throughout
  • Fixed all icon alt texts to match their operations (were all "÷")

CSS Improvements

  • Merged duplicate #calculator and #numpad rule blocks
  • Removed pointless border-radius on body
  • Removed commented-out .column dead code
  • Renamed .stong-text.strong-text

Project Configuration

  • Cleaned up tsconfig.json — removed 100+ lines of commented-out defaults
  • Fixed package.json main field from non-existent myscripts.jspage/dist/script.js
  • Added /page/dist/ to .gitignore — compiled output removed from source control

Commits

22 atomic commits with conventional commit messages (fix:, refactor:, style:, chore:).

Luna added 23 commits May 9, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant