Skip to content

objectui check exits 1 on any TypeScript project: every tsconfig*.json is JSONC and JSON.parse counts each one as an error — 64 errors and a failing pnpm check in this repo today #5237

Description

@os-support-ai

Found while establishing the measured baseline for #5127. Outside that card's radius (different arm of the same command, different mechanism, different fix) — not carried into its branch. Filed unassigned, not claiming.

Symptom

objectui check run at this repository's root, on main (118419214), with the CLI built from source:

$ node packages/cli/dist/cli.js check
Object UI Schema Check
Analyzing 612 files...
x Invalid JSON in tsconfig.vitest-setup.json: Unexpected token '/', "// Type-ch"... is not valid JSON
x Invalid JSON in tsconfig.json: Expected double-quoted property name in JSON at position 187 (line 9 column 5)
x Invalid JSON in packages/types/tsconfig.test.json: Expected property name or '}' in JSON at position 4 (line 2 column 3)
... 61 more ...
Found 64 errors
$ echo $?
1

All 64 are tsconfig*.json files. Every one of them is valid JSONC — the format TypeScript actually specifies for tsconfig.json — and every one of them fails JSON.parse, on either a // comment or a trailing comma.

Mechanism

packages/cli/src/commands/check.ts globs **/*.{json,yaml,yml} and hands every .json hit straight to JSON.parse:

const content = JSON.parse(readFileSync(join(cwd, file), 'utf-8'));

A throw here is the only thing that increments errors, and a non-zero errors is the only thing that calls process.exit(1). So a comment in a tsconfig.json — the normal, documented way to write one — is reported as a malformed file and fails the run.

Severity: this is the blocking arm, not the noisy one

#5127 documents the warning arm of the same command and notes, correctly for its own probe directory, that warnings do not affect the exit code. That probe held a bare package.json only. Put a tsconfig.json next to it — i.e. make it a TypeScript project, which every real consumer of this CLI is — and the command fails:

mkdir -p /tmp/oc-tsconfig && cd /tmp/oc-tsconfig
printf '{\n // a comment, as tsconfig permits\n "compilerOptions": { "strict": true }\n}\n' ~ tsconfig.json
node "$REPO/packages/cli/dist/cli.js" check ; echo "exit=$?"
# x Invalid JSON in tsconfig.json: ...
# Found 1 errors
# exit=1

(~ above stands for the shell redirect, spelled out so the snippet survives issue rendering.)

The repo's own pnpm check script is node packages/cli/dist/cli.js check, so pnpm check fails in this repository right now — 64 errors, exit 1. It appears not to be wired into any workflow, which is presumably why nobody has hit it.

Boundary against #5127

Independent, and #5127 cannot fix this as a side effect. The parse happens before any judgement of the file's contents, so a positive-marker gate (the ruled direction C) cannot skip it — you have to parse a file to find out whether it carries a marker. The two defects sit on either side of the same try:

Fixing either leaves the other exactly as it is.

Directions, not prejudged

Recommend deciding this one together with #5127's marker, since the second and third options share machinery with it — but it needs its own decision because the exit-code semantics are a separate contract from the warning semantics.

Reproduce

With REPO the repository root:

cd "$REPO"
pnpm --filter @object-ui/types build && pnpm --filter @object-ui/cli build
node packages/cli/dist/cli.js check ; echo "exit=$?"

(The @object-ui/types build is needed first — dist/cli.js imports its dist/zod/index.zod.js at load time.)

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions