Skip to content

Commit c45a5d8

Browse files
chore(minor-deps): update dependency @scaleway/eslint-config-react to ^3.14.1 (#378)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Vincent Germain <[email protected]>
1 parent 87692e3 commit c45a5d8

File tree

16 files changed

+295
-162
lines changed

16 files changed

+295
-162
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@rollup/plugin-commonjs": "^24.0.1",
7979
"@rollup/plugin-inject": "^5.0.3",
8080
"@rollup/plugin-node-resolve": "^15.0.1",
81-
"@scaleway/eslint-config-react": "^3.13.7",
81+
"@scaleway/eslint-config-react": "^3.14.1",
8282
"@types/jest": "^29.2.6",
8383
"babel-plugin-annotate-pure-calls": "^0.4.0",
8484
"cross-env": "^7.0.3",

packages/clients/src/api/baremetal/v1/api.utils.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ export class BaremetalV1UtilsAPI extends API {
3131
return server.install
3232
})
3333

34-
if (!value) {
35-
throw new Error(
36-
`Server creation has not begun for server ${request.serverId}`,
37-
)
38-
}
39-
4034
return {
4135
done: !SERVER_INSTALL_TRANSIENT_STATUSES.includes(value.status),
4236
value,

packages/clients/src/api/instance/v1/api.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export class InstanceV1UtilsAPI extends API {
504504
method: 'PUT',
505505
path: `/instance/v1/zones/${validatePathParam(
506506
'zone',
507-
imageReq.zone ?? this.client.settings.defaultZone,
507+
imageReq.zone,
508508
)}/images/${validatePathParam('id', imageReq.id)}`,
509509
},
510510
unmarshalSetImageResponse,

packages/clients/src/helpers/__tests__/is-browser.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ describe('isBrowser', () => {
77
})
88

99
it('returns true after defining a window', () => {
10-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
11-
// @ts-ignore Fake window/document for the test
10+
// @ts-expect-error Fake window/document for the test
1211
global.window = { document: 'not-undefined' }
1312
expect(isBrowser()).toBe(true)
14-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
15-
// @ts-ignore Reset the global variable
13+
// @ts-expect-error Reset the global variable
1614
delete global.window
1715
})
1816
})

packages/clients/src/helpers/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const isJSONObject = (obj: unknown): obj is JSONObject => {
3636
objT !== 'string' &&
3737
objT !== 'number' &&
3838
objT !== 'boolean' &&
39-
Array.isArray(obj) === false &&
39+
!Array.isArray(obj) &&
4040
objT === 'object'
4141
)
4242
}

packages/clients/src/internal/async/interval-retrier.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type IntervalStrategy = Generator<number, never | number, number>
3434
export function* createFixedIntervalStrategy(
3535
interval: number,
3636
): IntervalStrategy {
37+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
3738
while (true) yield interval
3839
}
3940

@@ -51,6 +52,7 @@ export function* createFibonacciIntervalStrategy(
5152
factor = 1,
5253
): IntervalStrategy {
5354
let [prev, current] = [0, 1]
55+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
5456
while (true) {
5557
yield current * base
5658
;[prev, current] = [current, prev + current * factor]
@@ -79,6 +81,7 @@ export function* createExponentialBackoffStrategy(
7981
const ceiling = Math.log(maxDelay / minDelay) / Math.log(2) + 1
8082
const randomInRange = (min: number, max: number) =>
8183
min + Math.random() * (max - min)
84+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
8285
while (true) {
8386
if (attempt > ceiling) {
8487
yield maxDelay

packages/clients/src/internal/interceptors/interceptor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ export const composeInterceptors =
1515
async (instance: T): Promise<T> =>
1616
interceptors.reduce(
1717
async (asyncResult, interceptor) => interceptor(await asyncResult),
18-
Promise.resolve(instance) as Promise<T>,
18+
new Promise<T>(resolve => {
19+
resolve(instance)
20+
}),
1921
)

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,20 @@ const VALID_SETTINGS: Settings = {
1919
const INVALID_SETTINGS_LIST: Partial<Settings>[] = [
2020
{ apiURL: 'https://api.scaleway.com/' },
2121
{ apiURL: 'ftp://api.scaleway.com' },
22-
// @ts-ignore Unknown zone
2322
{ defaultZone: 'fr-par-0' },
24-
// @ts-ignore Unknown zone
2523
{ defaultZone: 'fr-par' },
26-
// @ts-ignore Unknown region
2724
{ defaultRegion: 'fr-par-1' },
28-
// @ts-ignore Unknown client type
25+
// @ts-expect-error Unknown client type
2926
{ httpClient: 'str-client' },
3027
{ defaultOrganizationId: '' },
3128
{ defaultOrganizationId: 'not-a-uuid-v4' },
3229
{ defaultProjectId: '' },
3330
{ defaultProjectId: 'not-a-uuid-v4' },
3431
{ defaultPageSize: 0 },
3532
{ defaultPageSize: -1 },
36-
// @ts-ignore
33+
// @ts-expect-error Wrong type
3734
{ defaultPageSize: '42' },
38-
// @ts-ignore Unknown user agent type
35+
// @ts-expect-error Unknown user agent type
3936
{ userAgent: null },
4037
]
4138
/* eslint-enable @typescript-eslint/ban-ts-comment */

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const assertValidSettings = (obj: Readonly<Settings>): void => {
6868
) {
6969
throw new Error('Default organization ID cannot be empty')
7070
}
71-
if (isOrganizationId(obj.defaultOrganizationId) !== true) {
71+
if (!isOrganizationId(obj.defaultOrganizationId)) {
7272
throw new Error(
7373
`Invalid organization ID format '${obj.defaultOrganizationId}', expected a UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,
7474
)
@@ -83,7 +83,7 @@ export const assertValidSettings = (obj: Readonly<Settings>): void => {
8383
) {
8484
throw new Error('Default project ID cannot be empty')
8585
}
86-
if (isProjectId(obj.defaultProjectId) !== true) {
86+
if (!isProjectId(obj.defaultProjectId)) {
8787
throw new Error(
8888
`Invalid project ID format '${obj.defaultProjectId}', expected a UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,
8989
)
@@ -105,7 +105,7 @@ export const assertValidSettings = (obj: Readonly<Settings>): void => {
105105
throw new Error(`Invalid URL ${obj.apiURL}`)
106106
}
107107

108-
if (obj.apiURL.slice(-1) === '/') {
108+
if (obj.apiURL.endsWith('/')) {
109109
throw new Error(
110110
`Invalid URL ${obj.apiURL}: it should not have a trailing slash`,
111111
)

packages/clients/src/scw/errors/scw-error.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,8 @@ export class ScalewayError extends Error {
6666
): ScalewayError | null {
6767
return new ScalewayError(status, obj)
6868
}
69+
70+
toString(): string {
71+
return `${this.name}: ${this.message}`
72+
}
6973
}

0 commit comments

Comments
 (0)