Skip to content

laws probe: wrap the project's ESLint config so Astro twins parse in any adopter - #73

Merged
VirtualMachinist merged 3 commits into
mainfrom
m3/probe-wrapper-tsconfig
Nov 20, 2026
Merged

VirtualMachinist merged 3 commits into
mainfrom
m3/probe-wrapper-tsconfig

Conversation

@VirtualMachinist

Copy link
Copy Markdown
Member

webtops laws probe now proves the Astro laws on a real adopter's project, not only on the kit's own test projects.

Why

In an astro-site project whose tsconfig names only its own sources (include: ["src/**/*"]), the probe reported all 18 W-49 twins as not-evaluated. The Astro preset parses .astro files with the project's own tsconfig. That tsconfig doesn't include the probe's scratch directory, so ESLint answered "The file was not found in any of the provided program instance(s)". The result was honest but useless to the adopter.

What it does

src/laws/probe/run.ts and the new src/laws/probe/wrapper.ts:

  • A wrapper config: the probe writes laws-probe.eslint.config.mjs beside its scratch directory, not inside it, so the wrapper isn't linted itself. The wrapper imports the project's ESLint config and adds one block for the scratch twins, which points the parser at the probe's scratch tsconfig. That tsconfig extends the project's own and includes every twin.
  • ESLint runs with --config set to the wrapper.
  • Finding the project's config:
    • the one named by --config or web-tops.yaml;
    • otherwise the one ESLint itself would find, in the directory or the nearest above;
    • with no config found, there is no wrapper, as before.

The wrapper applies to the TypeScript twins as well. That is what a project needs when it pins parserOptions.project to its root tsconfig, and for a projectService project it is the same program.

Tests

  • src/cli/laws-probe-adopter.test.ts (new): runs bun src/cli/main.ts laws probe as a process, with real ESLint and tsc, on an adopter whose tsconfig says nothing about .web-tops. W-49 passes over its .astro twins, with none skipped. This test failed before the fix.
  • src/laws/probe/wrapper.test.ts (new): the exact wrapper text, its location beside the scratch directory, and the order in which config names are searched.
  • src/laws/probe/run.test.ts: expects the wrapper and its import of the project's config, and no --config when there is no project config.

A config whose default export isn't importable as an ES module is a known limit. The loader handles a default export or the module itself.

Gate on this head

  • 4,632 tests in 214 files pass, with 99.49% coverage.
  • layers: 5 in range, 5 ran, 0 failed, 0 not-evaluated.
  • Mutation: 424 killed and 1 timeout, 0 survived, 284 excluded as compile errors.
  • The highest CRAP score is 4.00.

🤖 Generated with Claude Code

VirtualMachinist and others added 3 commits November 20, 2026 09:41
…nfig, so an adopter whose tsconfig does not include them is probed

The twins are copied to .web-tops/out/laws-probe, which a project tsconfig that names its own sources does not include, and the astro preset parses a .astro file with the project tsconfig, so the Astro twins were not evaluated in a real adopter. The probe now writes a wrapper beside the scratch directory that imports the project config, found as ESLint finds it when none is named, and adds one block for the twins: the parser reads the scratch tsconfig, which extends the project one and includes every twin. A real adopter test, whose tsconfig has no include for .web-tops, proves W-49 passes over its Astro twins.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nfig under

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@VirtualMachinist
VirtualMachinist merged commit dde6859 into main Nov 20, 2026
2 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