Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Stop Type Erosion: Building a Zero-Dependency Type-Health Auditor for TypeScript

说明与用途

Any-Hunter 是一个零依赖工具,用于审计 TypeScript 代码库,生成类型健康得分(0–100)和 SARIF 报告,帮助团队在 CI 流水线中跟踪并缓解类型侵蚀问题。

问题

TypeScript projects often start with strict typing but over time developers introduce type bypasses (any, @ts-ignore, non-null assertions, unvalidated JSON.parse) leading to type erosion and runtime failures.

结果

Teams receive a concrete type health score, actionable SARIF reports, and can enforce type safety thresholds in CI, reducing runtime errors caused by type erosion.

工作流

  • Generate a .anyhunterrc.json with npx any-hunter --init
  • Run an audit against tsconfig.json using npx any-hunter ./tsconfig.json --threshold=85
  • Review the Type-Health score and SARIF report
  • Add any-hunter-disable-next-line comments for justified exceptions
  • Integrate Any-Hunter into CI via a GitHub Actions workflow

证据

Any-Hunter approaches typing from an architectural health perspective

来源

Outputs GitHub Step Summaries and standard OASIS SARIF files for GitHub Code Scanning

来源

  • 记录日期: 2026-09-05T18:52:38.631Z