Skip to content

Conversation

@coliff
Copy link
Member

@coliff coliff commented Jun 11, 2025

Overview

Comprehensive TypeScript configuration improvements with stricter rules, modern ES target, and enhanced type safety across the VS Code HTMLHint extension.

Changes Made

1. Main Extension (htmlhint/tsconfig.json)

  • Target: Upgraded from ES6 to ES2022
  • Libraries: Updated from ["es6", "dom"] to ["ES2022", "DOM"]
  • Strict Mode: Enabled comprehensive strict typing:
    • strict: true
    • noImplicitAny: true
    • noImplicitReturns: true
    • strictNullChecks: true
    • strictFunctionTypes: true
    • strictBindCallApply: true
    • strictPropertyInitialization: true
  • Additional Checks: Added unused code detection:
    • noUnusedLocals: true
    • noUnusedParameters: true
    • exactOptionalPropertyTypes: true
    • noUncheckedIndexedAccess: true
  • Output: Added declaration files generation
  • Performance: Added incremental compilation with build info caching

2. Server (htmlhint-server/src/tsconfig.json)

  • Target: Upgraded from ES6 to ES2022
  • Libraries: Updated to ["ES2022"]
  • Strict Mode: Enabled but temporarily relaxed some rules for gradual migration:
    • strict: true but with strictNullChecks: false and noImplicitAny: false
  • Output: Added declaration files generation
  • Performance: Added incremental compilation

3. Tests (test/tsconfig.json)

  • Target: Upgraded from ES6 to ES2022
  • Libraries: Updated to ["ES2022", "DOM"]
  • Strict Mode: Enabled with test-friendly relaxations:
    • strict: true but noUnusedLocals: false and noUnusedParameters: false
  • Testing: Maintained mocha types support

Code Fixes

Extension (htmlhint/extension.ts)

Fixed null safety issue with configuration retrieval:

// Before
let languages: string[] = config.get("documentSelector");

// After  
let languages: string[] = config.get("documentSelector") || ["html", "htm"];

Server (htmlhint-server/src/server.ts)

  • Settings null safety: Changed Settings to Settings | null
  • Configuration access: Added optional chaining settings?.htmlhint
  • Line access safety: Added null check for line array access
  • Function typing: Added proper parameter types to loadConfigurationFile
  • Error handling: Improved error type handling from any to unknown

Infrastructure Updates

Git Ignore (.gitignore)

Added TypeScript build info files:

gemini-code-assist[bot]

This comment was marked as resolved.

@coliff coliff force-pushed the dev/coliff/TypeScriptConfigurationUpgrades branch from 6ce716e to 8d08ccb Compare June 11, 2025 14:17
@coliff coliff merged commit 381c280 into main Jun 11, 2025
12 checks passed
@coliff coliff deleted the dev/coliff/TypeScriptConfigurationUpgrades branch June 11, 2025 14:19
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