Skip to content

Commit b3fb10d

Browse files
committed
feat: Assume --trailing-commas if --trim-trailing-commas is requested
It can be expected, if the trailing commas need to be trimmed, that they can appear in the intput. This should not break any existing scenarios. Fixes #22.
1 parent 355aad5 commit b3fb10d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ function processContents (source, file) {
295295
mode: params.mode,
296296
ignoreBOM: params.bom,
297297
ignoreComments: params.comments,
298-
ignoreTrailingCommas: params.trailingCommas,
298+
ignoreTrailingCommas: params.trailingCommas || params.trimTrailingCommas,
299299
allowSingleQuotedStrings: params.singleQuotedStrings,
300300
allowDuplicateObjectKeys: params.duplicateKeys
301301
}

web/jsonlint.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ <h2>Result</h2>
338338
ignoreComments: document.getElementById('comments').checked ||
339339
mode === 'cjson' || mode === 'json5',
340340
ignoreTrailingCommas: document.getElementById('trailing-commas').checked ||
341+
document.getElementById('trim-trailing-commas').checked ||
341342
mode === 'json5',
342343
allowSingleQuotedStrings: document.getElementById('single-quoted-strings').checked ||
343344
mode === 'json5',

0 commit comments

Comments
 (0)