Skip to content

Commit

Permalink
fix(devkit): respect expectComments when parsing json
Browse files Browse the repository at this point in the history
[This change](https://github.com/nrwl/nx/pull/10538/files#diff-7f0343ab5195423aded5b2ed7b98cef5fd459edbb66227eb67f0c0fa25eaf3a4L40-L50) introduced a small performance regression by removing the check for the `expectComments` flag.
  • Loading branch information
llwt authored and Steven Nance committed Feb 5, 2024
1 parent cc282b2 commit b805eca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/nx/src/utils/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export function parseJson<T extends object = any>(
options?: JsonParseOptions
): T {
try {
return JSON.parse(input);
if (options?.expectComments !== true) {
return JSON.parse(input);
}
} catch {}

options = { allowTrailingComma: true, ...options };
Expand Down

0 comments on commit b805eca

Please sign in to comment.