From 3ced40dcb5029aca7a4df4281f45eca0fea2f3e4 Mon Sep 17 00:00:00 2001 From: sniperc96 Date: Tue, 2 Sep 2025 19:20:08 +0800 Subject: [PATCH] change json to json5 Signed-off-by: sniperc96 Change-Id: I2bd6025f0d59ec9cf081fc7d34d5dff2ccadfabb --- arkui-plugins/package.json | 3 ++- arkui-plugins/ui-syntax-plugins/utils/index.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arkui-plugins/package.json b/arkui-plugins/package.json index 929c12377..99b4cbda4 100644 --- a/arkui-plugins/package.json +++ b/arkui-plugins/package.json @@ -31,6 +31,7 @@ "typescript": "^5.0.0" }, "dependencies": { - "@koalaui/libarkts": "../koala-wrapper" + "@koalaui/libarkts": "../koala-wrapper", + "json5": "2.2.3" } } diff --git a/arkui-plugins/ui-syntax-plugins/utils/index.ts b/arkui-plugins/ui-syntax-plugins/utils/index.ts index 0e3f34341..0f01d41d9 100644 --- a/arkui-plugins/ui-syntax-plugins/utils/index.ts +++ b/arkui-plugins/ui-syntax-plugins/utils/index.ts @@ -16,6 +16,7 @@ import * as arkts from '@koalaui/libarkts'; import * as fs from 'fs'; import * as path from 'path'; +import JSON5 from 'json5'; import { UISyntaxRuleContext } from 'ui-syntax-plugins/rules/ui-syntax-rule'; export const EXCLUDE_EXTERNAL_SOURCE_PREFIXES: Array = [ @@ -443,7 +444,7 @@ export function readJSON(path: string): T | null { if (!content) { return null; } - return JSON.parse(content) as T; + return JSON5.parse(content) as T; } export function tracePerformance any>(name: string, fn: T): T { -- Gitee