Skip to content

Commit e6b1391

Browse files
authored
fix: exclude generated config files from biome formatting (#2661)
1 parent c55f951 commit e6b1391

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

biome.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"overrides": [
5555
{
56-
"includes": ["packages_generated/**", "**/dist/**", "coverage/**", "**/examples/**", "**/*.gen.ts"],
56+
"includes": ["packages_generated/**", "**/dist/**", "coverage/**", "**/examples/**", "**/*.gen.ts", "scripts/templates/**"],
5757
"formatter": {
5858
"enabled": false
5959
},
@@ -62,7 +62,7 @@
6262
}
6363
},
6464
{
65-
"includes": ["vite.config.ts", "vitest.config.ts", "**/*.config.ts", "**/*.config.js"],
65+
"includes": ["vite.config.ts", "vitest.config.ts", "packages/**/*.config.ts", "packages/**/*.config.js"],
6666
"linter": {
6767
"rules": {
6868
"style": {

packages/client/.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { join } = require('path')
1+
const { join } = require('node:path')
22

33
module.exports = {
44
rules: {

packages/configuration-loader/.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { join } = require('path')
1+
const { join } = require('node:path')
22

33
module.exports = {
44
rules: {

scripts/setupNewProducts.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import { snakeToSlug } from './helpers'
2323

2424
type Scope = '@scaleway' | '@scaleway-internal'
2525

26+
interface SdkPackageJson {
27+
dependencies?: Record<string, string>
28+
devDependencies?: Record<string, string>
29+
[key: string]: unknown
30+
}
31+
2632
const options: ParseArgsConfig['options'] = {
2733
'dry-run': { type: 'boolean', default: false },
2834
src: { type: 'string', default: 'packages_generated' },
@@ -78,7 +84,7 @@ function safeReadJson(path: string): unknown {
7884
}
7985

8086
function writeJsonIfChanged(path: string, data: unknown) {
81-
const newContent = JSON.stringify(data, null, 2) + '\n'
87+
const newContent = `${JSON.stringify(data, null, 2)}\n`
8288
const oldContent = existsSync(path) ? readFileSync(path, 'utf8') : ''
8389
if (oldContent !== newContent) {
8490
if (DRY_RUN) {
@@ -95,8 +101,9 @@ function writeJsonIfChanged(path: string, data: unknown) {
95101
function walkHasGenFiles(root: string): boolean {
96102
if (!existsSync(root)) return false
97103
const stack = [root]
98-
while (stack.length) {
99-
const p = stack.pop()!
104+
while (stack.length > 0) {
105+
const p = stack.pop()
106+
if (!p) break
100107
const st = statSync(p)
101108
if (st.isDirectory()) {
102109
for (const name of readdirSync(p)) stack.push(join(p, name))
@@ -162,7 +169,7 @@ function detectPackageScope(sdkPackageJsonPath: string): Scope {
162169
warn('⚠️ SDK package.json not found, using @scaleway scope')
163170
return '@scaleway'
164171
}
165-
const sdkPackage = safeReadJson(sdkPackageJsonPath) as any
172+
const sdkPackage = safeReadJson(sdkPackageJsonPath) as SdkPackageJson
166173
const deps: Record<string, string> = sdkPackage?.dependencies ?? {}
167174
const hasInternal = Object.keys(deps).some(k =>
168175
k.startsWith('@scaleway-internal/sdk-'),
@@ -180,7 +187,7 @@ function updateSdkPackageJson(
180187
return { added: [] }
181188
}
182189

183-
const sdkPackage = safeReadJson(sdkPackageJsonPath) as any
190+
const sdkPackage = safeReadJson(sdkPackageJsonPath) as SdkPackageJson
184191
sdkPackage.dependencies = sdkPackage.dependencies ?? {}
185192
sdkPackage.devDependencies = sdkPackage.devDependencies ?? {}
186193

0 commit comments

Comments
 (0)