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.)
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 checkrun at this repository's root, onmain(118419214), with the CLI built from source:All 64 are
tsconfig*.jsonfiles. Every one of them is valid JSONC — the format TypeScript actually specifies fortsconfig.json— and every one of them failsJSON.parse, on either a//comment or a trailing comma.Mechanism
packages/cli/src/commands/check.tsglobs**/*.{json,yaml,yml}and hands every.jsonhit straight toJSON.parse:A throw here is the only thing that increments
errors, and a non-zeroerrorsis the only thing that callsprocess.exit(1). So a comment in atsconfig.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.jsononly. Put atsconfig.jsonnext to it — i.e. make it a TypeScript project, which every real consumer of this CLI is — and the command fails:(
~above stands for the shell redirect, spelled out so the snippet survives issue rendering.)The repo's own
pnpm checkscript isnode packages/cli/dist/cli.js check, sopnpm checkfails 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:catcharm: valid JSONC counted as a malformed file, run fails;objectui check把每个 JSON 文件的根type都当成组件键判定,于是在任何 Node 工程里都对 package.json 的"type": "module"报未知类型 #5127 — thetryarm: a foreign roottypejudged as a component key, warning printed.Fixing either leaves the other exactly as it is.
Directions, not prejudged
.jsonwith a JSONC-tolerant reader. Matches what the ecosystem means by these files;tsconfig,.eslintrc.json,devcontainer.jsonand VS Code's own settings are all JSONC in practice. Adds a dependency (or a small tolerant pre-strip, which has its own string-literal edge cases).JSON.parsebut stop treating a parse failure on a file the tool was never asked about as an error — e.g. demote to a warning, or only hard-fail on files that positively read as ObjectUI schemas. Note this couples to whateverobjectui check把每个 JSON 文件的根type都当成组件键判定,于是在任何 Node 工程里都对 package.json 的"type": "module"报未知类型 #5127 lands, so sequencing matters.objectui check把每个 JSON 文件的根type都当成组件键判定,于是在任何 Node 工程里都对 package.json 的"type": "module"报未知类型 #5127.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
REPOthe repository root:(The
@object-ui/typesbuild is needed first —dist/cli.jsimports itsdist/zod/index.zod.jsat load time.)