Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix verification of README code snippets #6868

Draft
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"dependencies": {
"@chainsafe/persistent-merkle-tree": "^0.7.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/api/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"test:spec:minimal": "LODESTAR_PRESET=minimal vitest --run --config vitest.spec.config.ts --dir test/spec/presets/",
"test:spec:mainnet": "LODESTAR_PRESET=mainnet vitest --run --config vitest.spec.config.ts --dir test/spec/presets/",
"test:spec": "yarn test:spec:bls && yarn test:spec:general && yarn test:spec:minimal && yarn test:spec:mainnet",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"dependencies": {
"@chainsafe/as-sha256": "^0.4.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/beacon-node/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test:sim:deneb": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/deneb.test.ts",
"test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/backupEthProvider.test.ts",
"test": "yarn test:unit && yarn test:e2e",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "yarn vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/config/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"dependencies": {
"@chainsafe/ssz": "^0.15.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/db/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/flare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/flare/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/fork-choice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"dependencies": {
"@chainsafe/ssz": "^0.15.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/fork-choice/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
6 changes: 3 additions & 3 deletions packages/light-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {

const config = getChainForkConfigFromNetwork("sepolia");
const logger = getConsoleLogger({logDebug: Boolean(process.env.DEBUG)});
const api = getApiFromUrl({urls: ["https://lodestar-sepolia.chainsafe.io"]}, {config});
const api = getApiFromUrl("https://lodestar-sepolia.chainsafe.io", "sepolia");

const lightclient = await Lightclient.initializeFromCheckpointRoot({
config,
Expand All @@ -83,11 +83,11 @@ await lightclient.start();
logger.info("Lightclient synced");

lightclient.emitter.on(LightclientEvent.lightClientFinalityHeader, async (finalityUpdate) => {
logger.info(finalityUpdate);
logger.info("Received finality update", {slot: finalityUpdate.beacon.slot});
});

lightclient.emitter.on(LightclientEvent.lightClientOptimisticHeader, async (optimisticUpdate) => {
logger.info(optimisticUpdate);
logger.info("Received optimistic update", {slot: optimisticUpdate.beacon.slot});
});
```

Expand Down
2 changes: 1 addition & 1 deletion packages/light-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"test:browsers:chrome": "yarn run build:dist && vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:firefox": "yarn run build:dist && vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"dependencies": {
"@chainsafe/bls": "7.1.3",
Expand Down
9 changes: 9 additions & 0 deletions packages/light-client/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
"test:e2e": "vitest --run --config vitest.e2e.config.ts --dir test/e2e",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"types": "lib/index.d.ts",
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions packages/logger/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/params/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
"test:e2e": "vitest --run --config vitest.e2e.config.ts --dir test/e2e/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/params/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to add comments in JSON, rename those to .jsoc extension so it does not highlight as error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's really only highlighted this way in the diff, we have comments in other tsconfig files as well

lodestar/tsconfig.json

Lines 12 to 15 in 14855ea

// We want to speed up the CI run for all tests, which require us to use the
// `transpileOnly` mode for the `ts-node`. This change requires to treat types for each module
// independently, which is done by setting the `isolatedModules` flag to `true`.
"isolatedModules": true,

tsconfig itself supports comments as is, might be able to remove this if upstream issue is fixed

// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
6 changes: 3 additions & 3 deletions packages/prover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A set of tools allowing to verify EL client JSON-RPC calls.
You can use the `@lodestar/prover` in two ways, as a Web3 Provider and as proxy. For prover use case see below example.

```ts
import Web3 from "web3";
import {Web3} from "web3";
import {createVerifiedExecutionProvider, LCTransport} from "@lodestar/prover";

const httpProvider = new Web3.providers.HttpProvider("https://lodestar-sepoliarpc.chainsafe.io");
Expand All @@ -38,7 +38,7 @@ In this scenario the actual provider is mutated to handle the RPC requests and v
For some scenarios when you don't want to mutate the provider you can pass an option `mutateProvider` as `false`. In this scenario the object `httpProvider` is not mutated and you get a new object `provider`. This is useful when your provider object does not allow mutation, e.g. Metamask provider accessible through `window.ethereum`. If not provided `mutateProvider` is considered as `true` by default. In coming releases we will switch its default behavior to `false`.

```ts
import Web3 from "web3";
import {Web3} from "web3";
import {createVerifiedExecutionProvider, LCTransport} from "@lodestar/prover";

const httpProvider = new Web3.providers.HttpProvider("https://lodestar-sepoliarpc.chainsafe.io");
Expand All @@ -51,7 +51,7 @@ const {provider, proofProvider} = createVerifiedExecutionProvider(httpProvider,
mutateProvider: false,
});

const web3 = new Web3(provider);
const web3 = new Web3(provider); // TODO: type is not compatible

const address = "0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134";
const balance = await web3.eth.getBalance(address, "latest");
Expand Down
2 changes: 1 addition & 1 deletion packages/prover/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
"test:e2e": "LODESTAR_PRESET=minimal vitest --run --config vitest.e2e.config.ts --dir test/e2e",
"check-readme": "typescript-docs-verifier",
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json",
"generate-fixtures": "node --loader ts-node/esm scripts/generate_fixtures.ts"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prover/test/e2e/web3_provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("web3_provider", function () {
mutateProvider: false,
});

const web3 = new Web3(nonVerifiedProvider);
const web3 = new Web3(verifiedProvider); //TODO: type is not compatible
Copy link
Member Author

@nflaig nflaig Jun 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nazarhussain the verifiedProvider is not compatible with what Web3 expects, and it's not clear to me why you would pass the nonVerifiedProvider provider as it is not mutated, meaning the prover is not used at all..

Same in the README, the example does not make sense to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const web3 = new Web3(verifiedProvider); //TODO: type is not compatible
const web3 = new Web3(nonVerifiedProvider);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we want to get the accounts via normal RPC and then verify it through our ELRpc object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the examples in the README show otherwise

Copy link
Member Author

@nflaig nflaig Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per README we pass the verifiedProvider to Web3 but the types are not compatible, the example in the README does not work

const web3 = new Web3(provider);

const accounts = await web3.eth.getAccounts();

await expect(verifiedProvider.request("eth_getBalance", [accounts[0], "latest"])).resolves.toBeDefined();
Expand Down
9 changes: 9 additions & 0 deletions packages/prover/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/reqresp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"dependencies": {
"@chainsafe/fast-crc32c": "^4.1.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/reqresp/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/spec-test-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"test": "yarn test:unit && yarn test:e2e",
"test:unit": "vitest --run --passWithNoTests --dir test/unit/",
"test:e2e": "vitest --run --config vitest.e2e.config.ts --dir test/e2e/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/spec-test-util/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/state-transition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"lint:fix": "yarn run lint --fix",
"test": "yarn test:unit",
"test:unit": "vitest --run --dir test/unit/",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"types": "lib/index.d.ts",
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions packages/state-transition/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"check-types": "tsc",
"lint": "eslint --color --ext .ts src/",
"lint:fix": "yarn run lint --fix",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/test-utils/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"types": "lib/index.d.ts",
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions packages/types/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
}
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"types": "lib/index.d.ts",
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions packages/utils/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {},
// `typescript-docs-verifier` uses `ts-node` to compile README snippets
// and hence it is required to disable `transpileOnly` mode as it disables
// all type checks. Set at root to be directly forwarded to `ts-node` until
// https://github.com/bbc/typescript-docs-verifier/issues/31 is resolved
"transpileOnly": false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to set this it should go under ts-node not on the root level.

"ts-node": {
   "transpileOnly": true
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This made me think if that config is actually have any effect or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is passed directly to ts-node by the typescript-docs-verifier module that's why it has to be in root, see code comment and issue bbc/typescript-docs-verifier#31

}
2 changes: 1 addition & 1 deletion packages/validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"test:spec": "vitest --run --config vitest.spec.config.ts --dir test/spec/",
"test:e2e": "vitest --run --config vitest.e2e.config.ts --dir test/e2e",
"download-spec-tests": "node --loader=ts-node/esm test/spec/downloadTests.ts",
"check-readme": "typescript-docs-verifier"
"check-readme": "typescript-docs-verifier --project tsconfig.doc.json"
},
"repository": {
"type": "git",
Expand Down
Loading
Loading