From 778c12ff0df7148b178b0d67e0c033e11208aa55 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:58:27 +0000 Subject: [PATCH] Use import attributes when importing json files (#1174) (#1176) * Use import attributes for json imports. * rush change * Add useTranslation to prettierignore (cherry picked from commit cc0078559aa5ab0118ef397e7993435c0a89dca2) Co-authored-by: GerardasB <10091419+GerardasB@users.noreply.github.com> --- .prettierignore | 3 +++ .../appui-react/issue-1165_2025-01-15-15-07.json | 10 ++++++++++ .../components-react/issue-1165_2025-01-15-15-07.json | 10 ++++++++++ .../@itwin/core-react/issue-1165_2025-01-15-15-07.json | 10 ++++++++++ .../issue-1165_2025-01-15-15-07.json | 10 ++++++++++ .../src/appui-react/hooks/useTranslation.tsx | 2 +- .../src/components-react/l10n/useTranslation.tsx | 2 +- ui/core-react/src/core-react/l10n/useTranslation.tsx | 2 +- .../src/imodel-components-react/useTranslation.tsx | 2 +- 9 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 common/changes/@itwin/appui-react/issue-1165_2025-01-15-15-07.json create mode 100644 common/changes/@itwin/components-react/issue-1165_2025-01-15-15-07.json create mode 100644 common/changes/@itwin/core-react/issue-1165_2025-01-15-15-07.json create mode 100644 common/changes/@itwin/imodel-components-react/issue-1165_2025-01-15-15-07.json diff --git a/.prettierignore b/.prettierignore index 82904a8e2e6..6abdbaa8b43 100644 --- a/.prettierignore +++ b/.prettierignore @@ -31,3 +31,6 @@ playwright-report # test-app specific routeTree.gen.ts + +# temporary until prettier is updated +useTranslation.tsx diff --git a/common/changes/@itwin/appui-react/issue-1165_2025-01-15-15-07.json b/common/changes/@itwin/appui-react/issue-1165_2025-01-15-15-07.json new file mode 100644 index 00000000000..8a7d5bac5ec --- /dev/null +++ b/common/changes/@itwin/appui-react/issue-1165_2025-01-15-15-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/appui-react", + "comment": "Use import attributes for json imports.", + "type": "none" + } + ], + "packageName": "@itwin/appui-react" +} \ No newline at end of file diff --git a/common/changes/@itwin/components-react/issue-1165_2025-01-15-15-07.json b/common/changes/@itwin/components-react/issue-1165_2025-01-15-15-07.json new file mode 100644 index 00000000000..71b9c96ad0e --- /dev/null +++ b/common/changes/@itwin/components-react/issue-1165_2025-01-15-15-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/components-react", + "comment": "Use import attributes for json imports.", + "type": "none" + } + ], + "packageName": "@itwin/components-react" +} \ No newline at end of file diff --git a/common/changes/@itwin/core-react/issue-1165_2025-01-15-15-07.json b/common/changes/@itwin/core-react/issue-1165_2025-01-15-15-07.json new file mode 100644 index 00000000000..909cbe388f8 --- /dev/null +++ b/common/changes/@itwin/core-react/issue-1165_2025-01-15-15-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/core-react", + "comment": "Use import attributes for json imports.", + "type": "none" + } + ], + "packageName": "@itwin/core-react" +} \ No newline at end of file diff --git a/common/changes/@itwin/imodel-components-react/issue-1165_2025-01-15-15-07.json b/common/changes/@itwin/imodel-components-react/issue-1165_2025-01-15-15-07.json new file mode 100644 index 00000000000..b51535f7d66 --- /dev/null +++ b/common/changes/@itwin/imodel-components-react/issue-1165_2025-01-15-15-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/imodel-components-react", + "comment": "Use import attributes for json imports.", + "type": "none" + } + ], + "packageName": "@itwin/imodel-components-react" +} \ No newline at end of file diff --git a/ui/appui-react/src/appui-react/hooks/useTranslation.tsx b/ui/appui-react/src/appui-react/hooks/useTranslation.tsx index ebf3fdfdd39..e54555bf891 100644 --- a/ui/appui-react/src/appui-react/hooks/useTranslation.tsx +++ b/ui/appui-react/src/appui-react/hooks/useTranslation.tsx @@ -2,7 +2,7 @@ * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import * as defaults from "../UiFramework.json"; +import * as defaults from "../UiFramework.json" with { type: "json" }; import * as React from "react"; import { usePackageTranslation } from "@itwin/core-react/internal"; import { UiFramework } from "../UiFramework.js"; diff --git a/ui/components-react/src/components-react/l10n/useTranslation.tsx b/ui/components-react/src/components-react/l10n/useTranslation.tsx index 948269763f3..0b4ae2df5af 100644 --- a/ui/components-react/src/components-react/l10n/useTranslation.tsx +++ b/ui/components-react/src/components-react/l10n/useTranslation.tsx @@ -2,7 +2,7 @@ * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import * as defaults from "../UiComponents.json"; +import * as defaults from "../UiComponents.json" with { type: "json" }; import * as React from "react"; import { usePackageTranslation } from "@itwin/core-react/internal"; import { UiComponents } from "../UiComponents.js"; diff --git a/ui/core-react/src/core-react/l10n/useTranslation.tsx b/ui/core-react/src/core-react/l10n/useTranslation.tsx index fd482ce01bd..0d1a4740a82 100644 --- a/ui/core-react/src/core-react/l10n/useTranslation.tsx +++ b/ui/core-react/src/core-react/l10n/useTranslation.tsx @@ -2,7 +2,7 @@ * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import * as defaults from "../UiCore.json"; +import * as defaults from "../UiCore.json" with { type: "json" }; import * as React from "react"; import { UiCore } from "../UiCore.js"; import { usePackageTranslation } from "./usePackageTranslation.js"; diff --git a/ui/imodel-components-react/src/imodel-components-react/useTranslation.tsx b/ui/imodel-components-react/src/imodel-components-react/useTranslation.tsx index 9c36886e5fb..c933bc02775 100644 --- a/ui/imodel-components-react/src/imodel-components-react/useTranslation.tsx +++ b/ui/imodel-components-react/src/imodel-components-react/useTranslation.tsx @@ -2,7 +2,7 @@ * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import * as defaults from "./UiIModelComponents.json"; +import * as defaults from "./UiIModelComponents.json" with { type: "json" }; import * as React from "react"; import { usePackageTranslation } from "@itwin/core-react/internal"; import { UiIModelComponents } from "./UiIModelComponents.js";