lodestar icon indicating copy to clipboard operation
lodestar copied to clipboard

Fix yarn check-readme

Open nflaig opened this issue 1 year ago • 3 comments

Maybe we should run yarn check-readme in CI along with tests to keep these readmes compile-able?

We actually do https://github.com/ChainSafe/lodestar/blob/88744d8a4877499c8c7aa43aeb4d576b98581faf/.github/workflows/test.yml#L144-L145

But it doesn't seem to care at all

~/projects/ethereum/lodestar/packages/light-client [unstable ≡ +0 ~1 -0 !]> yarn check-readme
yarn run v1.22.19
$ typescript-docs-verifier
ℹ Compiling documentation TypeScript code snippets from README.md
ℹ Found 1 TypeScript snippets
✔ All snippets compiled OK

@jeluard how did you verify and determine the changes to make it compile, just copy pasted it into a .ts file?

Originally posted by @nflaig in https://github.com/ChainSafe/lodestar/issues/6297#issuecomment-1892407830

nflaig avatar Jan 15 '24 19:01 nflaig

@nflaig yes just a plain copy

jeluard avatar Jan 15 '24 19:01 jeluard

Some findings:

  • it actually detects some things, like unknown variables at top-level, but not inside a function
  • if I comment "transpileOnly": true, all errors seem to be picked up

jeluard avatar Jan 15 '24 19:01 jeluard

Nice catch!!! Your thoroughness is commendable @jeluard!!! It looks like we can pass a “—project” to the typescript-docs-verifier. Perhaps we have a tsconfig.docs.json with that set to false to make sure it runs correctly

matthewkeil avatar Jan 15 '24 19:01 matthewkeil