Skip to content

Commit 351170c

Browse files
committed
fix: resolve all non-breaking lint warnings and exclude generated files
1 parent 15e6e55 commit 351170c

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

biome.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@
112112
}
113113
},
114114
"overrides": [
115+
{
116+
"includes": ["packages_generated/**"],
117+
"linter": {
118+
"enabled": false
119+
}
120+
},
115121
{
116122
"includes": ["**/dist/**"],
117123
"linter": {

packages/client/src/helpers/__tests__/marshalling.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ describe('resolveOneOf', () => {
9494
[{ default: undefined, param: 'my_key', value: '42' }],
9595
true,
9696
),
97-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
9897
).toStrictEqual({ my_key: '42' })
9998
})
10099

@@ -107,7 +106,6 @@ describe('resolveOneOf', () => {
107106
],
108107
true,
109108
),
110-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
111109
).toStrictEqual({ my_key_2: '42' })
112110
})
113111

@@ -120,7 +118,6 @@ describe('resolveOneOf', () => {
120118
],
121119
true,
122120
),
123-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
124121
).toStrictEqual({ my_key_1: '42' })
125122

126123
expect(
@@ -131,7 +128,6 @@ describe('resolveOneOf', () => {
131128
],
132129
true,
133130
),
134-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
135131
).toStrictEqual({ my_key_1: '42' })
136132
})
137133

@@ -172,7 +168,6 @@ describe('resolveOneOf', () => {
172168
],
173169
false,
174170
),
175-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
176171
).toStrictEqual({ my_key_1: false })
177172
})
178173
})
@@ -206,7 +201,6 @@ describe('unmarshalArrayOfObject', () => {
206201
it('unmarshals valid array of object', () => {
207202
expect(
208203
unmarshalArrayOfObject(
209-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
210204
[{ my_number: 42 }, { my_number: 94 }],
211205
unmarshaller,
212206
),
@@ -235,7 +229,6 @@ describe('unmarshalMapOfObject', () => {
235229
it('unmarshals valid array of object', () => {
236230
expect(
237231
unmarshalMapOfObject(
238-
/* biome-ignore lint/style/useNamingConvention: test data uses snake_case intentionally */
239232
{ 'first-key': { my_number: 42 }, 'second-key': { my_number: 94 } },
240233
unmarshaller,
241234
),

packages/client/src/scw/client-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export interface Settings extends DefaultValues {
7070
*
7171
* @internal
7272
*/
73+
/* biome-ignore lint/complexity/noExcessiveCognitiveComplexity: validation function with multiple checks */
7374
export const assertValidSettings = (obj: Readonly<Settings>): void => {
7475
// Default Organization ID.
7576
if (obj.defaultOrganizationId !== undefined) {

packages/client/src/scw/fetch/response-parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const responseParser =
5050
unmarshaller: ResponseUnmarshaller<T>,
5151
responseType: 'json' | 'text' | 'blob',
5252
) =>
53+
/* biome-ignore lint/complexity/noExcessiveCognitiveComplexity: response parsing with multiple content types and error handling */
5354
async (response: Response): Promise<T> => {
5455
if (!isResponse(response)) {
5556
throw new TypeError('Invalid response object')

packages/configuration-loader/src/config-loader.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ export const loadAllProfilesFromConfigurationFile = (
5555
}
5656
const configs = loadConfigurationFromFile(filePath)
5757

58-
return Object.keys(configs).reduce<Record<string, Profile>>(
59-
(prev, pKey) => ({
60-
...prev,
61-
[pKey]: convertFileConfigToSDK(configs[pKey]),
62-
}),
63-
{},
64-
)
58+
const result: Record<string, Profile> = {}
59+
for (const pKey of Object.keys(configs)) {
60+
result[pKey] = convertFileConfigToSDK(configs[pKey])
61+
}
62+
return result
6563
}
6664

6765
/**

packages/configuration-loader/src/yml-loader.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ const DETECT_ITEM_REGEX = /^\s*(.+?)\s*:\s*(.+?)\s*$/
1515
*/
1616
export const convertYamlToConfiguration = (
1717
input: string | null,
18+
/* biome-ignore lint/complexity/noExcessiveCognitiveComplexity: YAML parsing with multiple states */
1819
): ConfigurationType => {
1920
let foundProfilesKey = false
2021
let currentSection: string | undefined = 'default'
2122
const map: ConfigurationType = {}
2223
if (typeof input !== 'string') {
2324
return map
2425
}
25-
input.split(/\r?\n/).forEach(rawLine => {
26+
for (const rawLine of input.split(/\r?\n/)) {
2627
// remove comments
2728
const line = rawLine.split(STRIP_COMMENT_REGEX)[0]
2829
// parse sections
@@ -45,7 +46,7 @@ export const convertYamlToConfiguration = (
4546
;[, , map[currentSection][item[1]]] = item
4647
}
4748
}
48-
})
49+
}
4950

5051
return map
5152
}

scripts/setupNewProducts.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { cwd } from 'node:process'
2020
import type { ParseArgsConfig } from 'node:util'
2121
import { parseArgs } from 'node:util'
2222
import { snakeToSlug } from './helpers'
23+
import type { PackageJSON } from './types'
2324

2425
type Scope = '@scaleway' | '@scaleway-internal'
2526

@@ -81,7 +82,8 @@ function walkHasGenFiles(root: string): boolean {
8182
if (!existsSync(root)) return false
8283
const stack = [root]
8384
while (stack.length) {
84-
const p = stack.pop()!
85+
const p = stack.pop()
86+
if (!p) break
8587
const st = statSync(p)
8688
if (st.isDirectory()) {
8789
for (const name of readdirSync(p)) stack.push(join(p, name))
@@ -120,7 +122,7 @@ function detectPackageScope(sdkPackageJsonPath: string): Scope {
120122
warn('⚠️ SDK package.json not found, using @scaleway scope')
121123
return '@scaleway'
122124
}
123-
const sdkPackage = safeReadJson(sdkPackageJsonPath) as any
125+
const sdkPackage = safeReadJson(sdkPackageJsonPath) as PackageJSON
124126
const deps: Record<string, string> = sdkPackage?.dependencies ?? {}
125127
const hasInternal = Object.keys(deps).some(k =>
126128
k.startsWith('@scaleway-internal/sdk-'),
@@ -138,7 +140,7 @@ function updateSdkPackageJson(
138140
return { added: [] }
139141
}
140142

141-
const sdkPackage = safeReadJson(sdkPackageJsonPath) as any
143+
const sdkPackage = safeReadJson(sdkPackageJsonPath) as PackageJSON
142144
sdkPackage.dependencies = sdkPackage.dependencies ?? {}
143145
sdkPackage.devDependencies = sdkPackage.devDependencies ?? {}
144146

0 commit comments

Comments
 (0)