Skip to content

TypeScript ESLint Technical Debt: 381 Suppressed Errors Requiring Resolution #783

@justin808

Description

@justin808

Summary

While issues #723 and #644 have been successfully closed, there remain 381 ESLint errors in the TypeScript codebase that are currently suppressed via the ignore pattern package/**/*.ts in eslint.config.js. These errors are well-documented in ESLINT_TECHNICAL_DEBT.md but require dedicated effort to resolve.

Current State

  • TypeScript compilation: All files compile without errors (tsc --noEmit passes)
  • ESLint (with ignores): CI passes with 0 errors, 3 acceptable warnings
  • ⚠️ ESLint (full check): 381 errors when running yarn eslint package/**/*.ts --no-ignore

Error Breakdown by Category

When linting is enabled on TypeScript files, the following major categories of errors emerge:

1. Type Safety Issues (~70% of errors)

  • @typescript-eslint/no-explicit-any (22 instances)
  • @typescript-eslint/no-unsafe-* violations (85+ instances):
    • no-unsafe-assignment: 47
    • no-unsafe-member-access: 20+
    • no-unsafe-call: 8+
    • no-unsafe-return: 8+
    • no-unsafe-argument: 7+
  • @typescript-eslint/no-base-to-string: Object stringification issues
  • @typescript-eslint/restrict-template-expressions: Invalid template literal types

2. Module System Issues

  • @typescript-eslint/no-require-imports: Extensive use of require() instead of ES6 imports
  • import/order: Import ordering violations
  • import/newline-after-import: Missing newlines after imports
  • import/first: Imports not at top of modules
  • import/no-import-module-exports: Mixed import/export styles
  • import/prefer-default-export: Single-export modules without defaults

3. Code Quality Issues

  • @typescript-eslint/no-use-before-define: Functions/variables used before definition (especially in cli.ts)
  • class-methods-use-this: Instance methods that don't use this
  • no-shadow: Variable name shadowing
  • prefer-destructuring: Missing object destructuring
  • prefer-template: String concatenation instead of template literals
  • prefer-const: Reassignment-free variables declared with let

4. Style Issues

  • no-plusplus: Unary increment/decrement operators
  • no-continue: Use of continue statements
  • no-restricted-globals: Use of isNaN instead of Number.isNaN
  • Unused inline config directives

Most Affected Files

The heaviest concentration of errors appears in:

  1. package/configExporter/cli.ts: ~50+ errors

    • Extensive no-use-before-define violations
    • Module system issues with require()
    • Type safety problems
  2. package/environments/base.ts: ~40+ errors

    • Heavy use of any types
    • Unsafe member access on config objects
    • Module import ordering issues
  3. package/configExporter/buildValidator.ts: ~13 errors

    • Class method issues
    • Object stringification problems
    • Style violations
  4. package/configExporter/configFile.ts: Multiple class method and type safety issues

  5. All environment files (development.ts, production.ts, test.ts): Module system and type safety violations

Related Documentation

  • ESLINT_TECHNICAL_DEBT.md contains detailed tracking and prioritization
  • Files with remaining errors have explicit rule overrides in eslint.config.js (lines 170-256)
  • The technical debt document estimates ~163 suppressed errors, but the actual count when fully enabled is 381 errors

Recommended Approach

As outlined in ESLINT_TECHNICAL_DEBT.md:

Phase 1: Non-Breaking Fixes (Can be done incrementally)

  • Fix style issues: prefer-const, prefer-template, no-plusplus
  • Remove unused directives
  • Fix prefer-destructuring violations
  • Address no-shadow and no-use-before-define by reordering code

Phase 2: Type Safety Improvements (Requires careful refactoring)

  • Replace any with unknown or proper types
  • Add explicit type definitions for configuration objects
  • Fix unsafe member access by adding proper type guards
  • Address @typescript-eslint/no-base-to-string issues

Phase 3: Module System Modernization (Potentially breaking)

  • Convert require() to ES6 import
  • Fix import ordering and organization
  • Add default exports where appropriate
  • Consider providing codemods for consumers

Success Criteria

  • Remove package/**/*.ts ignore pattern from eslint.config.js line 26
  • Reduce file-specific rule overrides in eslint.config.js (lines 170-256)
  • Achieve 0 ESLint errors when running yarn eslint package/**/*.ts
  • Maintain TypeScript compilation success
  • No breaking changes to public API (or provide migration guide if needed)

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions