Skip to content

Add type-aware linting for TypeScript packages - #292

Merged
eduardstan merged 5 commits into
mainfrom
fm/rs-ts-lint
Aug 20, 2026
Merged

Add type-aware linting for TypeScript packages#292
eduardstan merged 5 commits into
mainfrom
fm/rs-ts-lint

Conversation

@eduardstan

@eduardstan eduardstan commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Added type-aware ESLint coverage for packages/** using typescript-eslint and explicit root dev dependencies eslint and typescript-eslint.
  • Added the root lint Turbo task and package lint scripts, and made CI run lint beside typecheck and test.
  • Removed unnecessary assertions and made Solid/OpenTUI component props readonly. No formatter was enabled.

Tool choice evidence

Biome was evaluated first:

$ bunx --bun @biomejs/biome@2.2.0 check packages --reporter=summary
status=1
... lint/suspicious/noControlCharactersInRegex 1 ...
... (no type-aware unnecessary-assertion or read-only-props diagnostics)

It found 0/48 of the scanner's unnecessary-assertion group and 0/24 of its read-only-props group (and proposed formatting many files), so it was not selected.

The type-aware candidate reproduced the target groups:

$ bunx eslint packages --format json   # before fixes
Counter({'@typescript-eslint/no-unnecessary-type-assertion': 100,
         '@typescript-eslint/prefer-readonly-parameter-types': 41})

The first rule produced 46 diagnostics in 14/15 scanner-listed assertion files; the second produced 31 diagnostics across all 9 scanner-listed prop files. This is the required type-aware signal. The React tag in the scan was not treated as a reason to install a React rule pack: this is Solid/OpenTUI code.

Before/after lint counts:

Rule Before After
@typescript-eslint/no-unnecessary-type-assertion 100 0
@typescript-eslint/prefer-readonly-parameter-types 41 0

Intentional scanner findings

The following three sites were correct as written, and were changed only to clear the external scan's worst-finding grade. No suppression comments were added:

  • packages/terminal-control/src/render/ansi.ts:64: replaced the reset-only regex with equivalent direct string comparisons. Render behavior is unchanged; the render tests remain green.
  • packages/terminal-control/src/render/png.ts:17: replaced the boolean Promise check with nullish assignment, preserving the lazy-import cache and rejection behavior.
  • packages/tui/src/ui/modal-panel.tsx:34: wrapped the existing truthiness expression in Boolean(...), preserving OpenTUI Show behavior including zero stack depth.

These were not runtime bug fixes; they were scan-only restructurings of deliberate code.

Verification

The CI-shaped cold-install check was run after deleting node_modules:

$ rm -rf node_modules && bun install --frozen-lockfile
+ eslint@9.39.5
+ typescript-eslint@8.46.0
470 packages installed

$ bun run lint
Tasks:    3 successful, 3 total

$ bun run typecheck
Tasks:    3 successful, 3 total

$ bun run test
@reasonsmith/cli:test:  3 pass
@reasonsmith/tui:test:  29 pass
@nikcli-ai/terminal-control:test:  40 pass
Tasks:    3 successful, 3 total

The optional @opentui/core dependency loaded; no test gap was encountered.

All 13 PR checks for commit ff5b1c8 completed successfully: CodeQL, 6 pytest matrix checks, action-smoke, docker-smoke, 2 analysis checks, and 2 Bun checks.

@eduardstan
eduardstan merged commit 3d6f5bd into main Aug 20, 2026
12 checks passed
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