Skip to content

Commit 762396b

Browse files
authored
fix: upd biome formatting logging (#1197)
* fix: upd biome formatting logging * chore: add changeset
1 parent df50c8b commit 762396b

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
biome error logging

packages/cli/src/cli/loaders/formatters/biome.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ export type BiomeLoaderOptions = {
1010
alwaysFormat?: boolean;
1111
};
1212

13-
// Track warnings shown per file extension to avoid spam
14-
const shownWarnings = new Set<string>();
15-
1613
export default function createBiomeLoader(
1714
options: BiomeLoaderOptions,
1815
): ILoader<string, string> {
@@ -63,7 +60,11 @@ async function formatDataWithBiome(
6360
// Load config from biome.json/biome.jsonc if exists
6461
configPath = await findBiomeConfig(filePath);
6562
if (!configPath && !options.alwaysFormat) {
66-
return data; // Skip if no config and not forced
63+
console.log();
64+
console.log(
65+
`⚠️ Biome config not found for ${path.basename(filePath)} - skipping formatting`,
66+
);
67+
return data;
6768
}
6869

6970
if (configPath) {
@@ -84,19 +85,18 @@ async function formatDataWithBiome(
8485

8586
return formatted.content;
8687
} catch (error) {
87-
const ext = path.extname(filePath);
88-
89-
// Only show warning once per file extension
90-
if (!shownWarnings.has(ext)) {
91-
shownWarnings.add(ext);
92-
93-
console.log();
94-
console.log(
95-
`⚠️ Biome does not support ${ext} files - skipping formatting`,
96-
);
97-
98-
if (error instanceof Error && error.message) {
99-
console.log(` ${error.message}`);
88+
// Extract error message from Biome
89+
const errorMessage =
90+
error instanceof Error
91+
? error.message || (error as any).stackTrace?.toString().split("\n")[0]
92+
: "";
93+
94+
if (errorMessage?.includes("does not exist in the workspace")) {
95+
// Biome says "file does not exist in workspace" for unsupported formats - skip
96+
} else {
97+
console.log(`⚠️ Biome skipped ${path.basename(filePath)}`);
98+
if (errorMessage) {
99+
console.log(` ${errorMessage}`);
100100
}
101101
}
102102

0 commit comments

Comments
 (0)