Skip to content

[PoC] Explore dedicated linting for AI#8351

Draft
zth wants to merge 14 commits intomasterfrom
rescript-ai
Draft

[PoC] Explore dedicated linting for AI#8351
zth wants to merge 14 commits intomasterfrom
rescript-ai

Conversation

@zth
Copy link
Copy Markdown
Member

@zth zth commented Apr 17, 2026

Heavy WIP/POC and vibe coded, in an attempt to discover interesting and useful things we can do to help AI, at various levels and in various levels of "aggressiveness".

Add AI-oriented rescript-tools commands

Commands

  • lint: Runs configurable AI-oriented lint checks on a file or project root using source and typed information.
  • rewrite: Rewrites source into a narrower agent-oriented normal form, with optional diff output.
  • active-rules: Lists lint and rewrite rules, whether they are active, and how they are configured.
  • show: Returns hover-style semantic information for a symbol path.
  • find-references: Finds references from either a symbol path or a source location.

Initial rules

  • Lint:
    • forbidden-reference: Bans using configured module, value, and type references.
    • single-use-function: Reports local helper functions that are defined once and only used once.
    • alias-avoidance: Reports local aliases like let f = Module.f, type t = Module.t, and module M = Long.Path. Prefer the fully qualified reference instead.
    • forbidden-source-root-reference: Reports value and type references whose declarations come from configured source roots such as generated code folders.
    • preferred-type-syntax: Reports non-canonical type spellings like Dict.t<_> in favor of builtin syntax like dict<_>.
  • Rewrite:
    • prefer-switch: Rewrites eligible if / else if chains and ternaries into canonical switch forms.
    • no-optional-some: Rewrites redundant ~label=?Some(expr) optional-argument wrapping into the direct labeled form.
    • preferred-type-syntax: Rewrites supported non-canonical type spellings like Dict.t<_> into builtin syntax like dict<_>.

Support

  • Add .rescript-lint.json config support, a shipped JSON schema, AI tooling docs, and golden tests for the new command surface

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