Skip to content

feat(lint): any-on-boundary rules + any/exported metadata in TS parser#65

Merged
smochan merged 2 commits into
feat/rank-untested-hotspotfrom
feat/lint-any-on-boundary
Jun 10, 2026
Merged

feat(lint): any-on-boundary rules + any/exported metadata in TS parser#65
smochan merged 2 commits into
feat/rank-untested-hotspotfrom
feat/lint-any-on-boundary

Conversation

@smochan

@smochan smochan commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #64 — final slice of the gap-analysis quick wins (Phase 3, Capability E):

  • TS parser: exported flag threaded from export_statement into function/lexical-decl handlers; metadata["any_params"]/any_return recorded from the already-captured type annotations (word-boundary match — Promise<any> yes, Company no).
  • Lint rule any-on-boundary (low): exported function/arrow with any in a param or return type.
  • Lint rule any-into-db-write (med): as any cast passed as an argument to a DB-write chain (db.insert|update|execute, .values(, .set().
  • Docs stance preserved: surface-syntax signal only, no type inference.

Implemented by a Sonnet subagent against a Fable-authored spec; reviewed and verified by the orchestrating session.

Test plan

  • 16 new tests (7 parser metadata, 9 lint: fires/negative per case, severities)
  • Full suite 706 passed; ruff + mypy --strict clean; self-lint 0 findings

🤖 Generated with Claude Code

smochan added 2 commits June 10, 2026 15:49
- Add _type_mentions_any() helper in typescript.py using \bany\b regex
- Thread exported=True flag through _handle_function_decl and
  _handle_lexical_decl when called from the export_statement branch
- Set metadata["exported"], metadata["any_params"], metadata["any_return"]
  on FUNCTION nodes for exported/any-typed functions and arrows
- Add any-on-boundary lint rule (severity low): fires on exported
  function/arrow declarations that use `any` in a param type or return type
- Add any-into-db-write lint rule (severity med): fires when an `as any`
  cast is passed as an argument to a DB-write chain
- Add tests/fixtures/lint_sample/src/api.ts fixture covering all cases
- Add parser tests in test_extractor_typescript.py for new metadata fields
- Add lint tests in test_lint.py for both new rules
@smochan smochan merged commit 649d680 into feat/rank-untested-hotspot Jun 10, 2026
4 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 2026
@smochan smochan deleted the feat/lint-any-on-boundary branch June 10, 2026 13:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant