Skip to content

Commit 324795f

Browse files
committed
Allow comments in tsdoc.json file
1 parent 5c7e005 commit 324795f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tsdoc-config/src/TSDocConfigFile.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import * as fs from 'fs';
1212
import * as resolve from 'resolve';
1313
import * as path from 'path';
1414
import * as Ajv from 'ajv';
15+
import * as jju from 'jju';
1516

1617
const ajv: Ajv.Ajv = new Ajv({ verbose: true });
1718

1819
function initializeSchemaValidator(): Ajv.ValidateFunction {
1920
const jsonSchemaPath: string = resolve.sync('@microsoft/tsdoc/schemas/tsdoc.schema.json', { basedir: __dirname });
2021
const jsonSchemaContent: string = fs.readFileSync(jsonSchemaPath).toString();
21-
const jsonSchema: object = JSON.parse(jsonSchemaContent);
22+
const jsonSchema: object = jju.parse(jsonSchemaContent, { mode: 'cjson' });
2223
return ajv.compile(jsonSchema);
2324
}
2425

@@ -139,7 +140,7 @@ export class TSDocConfigFile {
139140

140141
this._fileNotFound = false;
141142

142-
const configJson: IConfigJson = JSON.parse(configJsonContent);
143+
const configJson: IConfigJson = jju.parse(configJsonContent, { mode: 'cjson' });
143144

144145
if (configJson.$schema !== TSDocConfigFile.CURRENT_SCHEMA_URL) {
145146
this._reportError({

0 commit comments

Comments
 (0)