Skip to content

Commit 5f8ca63

Browse files
committed
feat: improve biome default config handling
1 parent f6220f2 commit 5f8ca63

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Diff for: biome.json

+5
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,10 @@
1717
"enabled": true,
1818
"indentStyle": "space",
1919
"indentSize": 2
20+
},
21+
"javascript":{
22+
"formatter":{
23+
"quoteStyle": "double"
24+
}
2025
}
2126
}

Diff for: src/biome.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ const defaultConfig: Configuration = {
167167
},
168168
linter: {
169169
enabled: true,
170-
ignore: ["dist/**/*"],
171170
rules: {
172171
recommended: true,
173172
},
@@ -177,18 +176,24 @@ const defaultConfig: Configuration = {
177176
indentStyle: "space",
178177
indentSize: 2,
179178
},
179+
javascript: {
180+
formatter: {
181+
quoteStyle: "single",
182+
},
183+
},
180184
};
181185

182186
export const getBiomeConfig = (): Configuration => {
183187
try {
188+
let config = defaultConfig;
184189
const biomeConfigPath = findNearestBiomeConfig();
185190

186-
if (!biomeConfigPath) {
187-
throw new Error("No biome config found, using default config");
191+
if (biomeConfigPath) {
192+
const biomeConfig = readFileSync(biomeConfigPath, "utf8");
193+
config = Object.assign(config, JSON.parse(biomeConfig));
188194
}
189195

190-
const biomeConfig = readFileSync(biomeConfigPath, "utf8");
191-
return JSON.parse(biomeConfig);
196+
return config;
192197
} catch (error) {
193198
console.warn(error);
194199
return defaultConfig;

0 commit comments

Comments
 (0)