From a2ce71b052948f0d9481df653d545f9bb2f9fc05 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 15 Apr 2024 09:41:53 +0200 Subject: [PATCH] Apply suggested changes --- code/lib/core-common/src/utils/formatter.test.ts | 2 -- code/lib/core-common/src/utils/formatter.ts | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/code/lib/core-common/src/utils/formatter.test.ts b/code/lib/core-common/src/utils/formatter.test.ts index 7f8c22036e81..3f8eaf003478 100644 --- a/code/lib/core-common/src/utils/formatter.test.ts +++ b/code/lib/core-common/src/utils/formatter.test.ts @@ -1,8 +1,6 @@ import { formatFileContent } from './formatter'; import { describe, it, expect, vi } from 'vitest'; import path from 'node:path'; -import dedent from 'ts-dedent'; -import { resolveConfigFile } from 'prettier-v2'; const mockPrettier = vi.hoisted(() => ({ resolveConfig: vi.fn(), diff --git a/code/lib/core-common/src/utils/formatter.ts b/code/lib/core-common/src/utils/formatter.ts index 6f0033e668a4..f18951cabf63 100644 --- a/code/lib/core-common/src/utils/formatter.ts +++ b/code/lib/core-common/src/utils/formatter.ts @@ -69,14 +69,13 @@ export async function formatFileContent(filePath: string, content: string): Prom (prettier as any).version } is not supported to format files which were edited by Storybook. Please raise an issue on the Storybook GitHub repository. - Fallback to EditorConfig settings if available. + Falling back to EditorConfig settings, if available. `); + return await formatWithEditorConfig(filePath, content); } } catch (error) { return content; } - - return content; } async function formatWithEditorConfig(filePath: string, content: string) {