Skip to content

fix(tooling): make pnpm lint and pnpm typecheck cover what precommit covers - #956

Closed
chughtapan wants to merge 1 commit into
mainfrom
fix/wire-lint-and-typecheck-gates
Closed

fix(tooling): make pnpm lint and pnpm typecheck cover what precommit covers#956
chughtapan wants to merge 1 commit into
mainfrom
fix/wire-lint-and-typecheck-gates

Conversation

@chughtapan

Copy link
Copy Markdown
Owner

Found while implementing the harness stack: I reported "typecheck 0 errors, lint 0 errors" on work that the pre-commit hook then rejected — twice. The commands were not lying so much as under-scoped.

The two gaps

lint:sloppy-code-guard hung off precommit, not lint. So pnpm lint never ran the Effect-hygiene guards. This is not redundant with eslint: for an async in production source carrying an eslint-disable comment, eslint reports only a warning (unused directive) while the guard reports [FAIL]. That exact case shipped past pnpm lint in #955 and was caught only at commit time.

pnpm typecheck stopped at the typecheck target. Test files are covered by a separate typecheck:tests target, so seven type errors in test files passed a clean pnpm typecheck in #954 before the hook caught them.

Root cause of the drift

The root package.json scripts restated the workspace:lint dependency graph as a shell && chain. Two definitions of the same thing, so adding a check to one silently left the other behind. That is why the guard ended up attached to precommit — it was the only place someone remembered to wire it.

The fix

  • lint:sloppy-code-guard moves into workspace:lint's dependsOn. check and precommit both depend on lint, so they inherit it — and its now-redundant direct listing in precommit is removed.
  • A workspace:typecheck target states every type surface once: build, per-package typecheck, the two v2 packages, and typecheck:tests.
  • Root lint and typecheck scripts delegate to those targets instead of restating them.
  • oxlint joins ignoreDependencies in knip.json. It is still invoked, by workspace:lint:oxlint; knip reads package scripts and cannot see nx targets. This follows the existing entries for typedoc and @mermaid-js/mermaid-cli, which are there for the same reason.

Non-vacuity

Both gates were verified to catch what they previously missed, not merely to pass:

Probe Before After
async in production source with an eslint-disable eslint: 1 warning → would not fail sloppy-code-guard: [FAIL] [async-keyword], 1 violation
const x: number = "str" in profile.test.ts not in typecheck's scope typecheck:tests: error TS2322: Type 'string' is not assignable to type 'number'

Both probes were reverted; the working tree is clean. nx show project workspace confirms lintlint:sloppy-code-guard and typechecktypecheck:tests are in the graphs.

pnpm nx run workspace:precommit exits 0 on the result.

ADR conformance (R-pass)

Governing outcome Record Owner Binds this diff? Verdict Evidence
— none — n/a n/a n/a CONFORMS (vacuously) Discovered from docs/decisions/README.md on main (49 records). No accepted outcome governs build tooling or task wiring. The diff changes no wire contract, public interface, trust boundary, or persistence — the categories ADRs here govern.

Stated rather than left silent, per the R-pass rule that "no ADR governs this" is itself a reviewable claim.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P76aaa1STr3WPZ3nDascta

…covers

`lint:sloppy-code-guard` hung off `precommit` rather than `lint`, and the
root `typecheck` script stopped at `typecheck`, so neither top-level
command saw the Effect-hygiene guards or any type error in a test file.
Both gaps only surfaced at commit time, after the checks had already
reported green.

The root scripts also restated the `workspace:lint` dependency graph as a
shell chain, which is how the two drifted apart in the first place. They
now delegate, and `workspace:typecheck` states the full set of type
surfaces once.

`oxlint` joins the existing `ignoreDependencies` entries for tools invoked
from nx targets instead of package scripts, alongside typedoc and
mermaid-cli.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P76aaa1STr3WPZ3nDascta
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