Skip to content

Add dead code analysis (reanalyze) to all ReScript libs #807

@BlueHotDog

Description

@BlueHotDog

Problem

Only libs/client has dead code analysis configured. The remaining 11 ReScript libraries have no reanalyze config and no CI checks:

Library reanalyze in rescript.json CI job
libs/client Yes dead-code-client
libs/bindings No No
libs/experimental-rescript-webapi No No
libs/frontman-astro-browser No No
libs/frontman-astro No No
libs/frontman-client No No
libs/frontman-core No No
libs/frontman-nextjs No No
libs/frontman-protocol No No
libs/frontman-vite No No
libs/logs No No
libs/react-statestore No No

This gap let withLock in frontman-core ship as dead code — defined in src, only called from tests. Caught during PR #805 review.

What to do

  1. Add "reanalyze": { "analysis": ["dce"] } to each library's rescript.json
  2. Add CI jobs (or a single matrix job) that runs npx @rescript/tools reanalyze -config for each lib
  3. Fix any existing dead code flagged by the initial run
  4. Consider using the -transitive flag to catch code only kept alive by test imports

Notes

  • The existing dead-code-client job in .github/workflows/ci.yml:374-413 is a good template
  • A matrix strategy over all libs would be cleaner than N separate jobs

Metadata

Metadata

Assignees

No one assigned

    Labels

    skip-changelogSkip changelog check for this PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions