Skip to content

Commit

Permalink
Apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Apr 15, 2024
1 parent 458f6d8 commit a2ce71b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 0 additions & 2 deletions code/lib/core-common/src/utils/formatter.test.ts
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
5 changes: 2 additions & 3 deletions code/lib/core-common/src/utils/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a2ce71b

Please sign in to comment.