Skip to content

Commit bf7f41f

Browse files
renovate[bot]scaleway-botphilibea
authored
fix(deps): update typescript-eslint monorepo to v6 (major) (#1401)
* fix(deps): update typescript-eslint monorepo to v6 * chore: add changeset renovate-475bdf8 * fix(ts-lint): update rules --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Scaleway Bot <[email protected]> Co-authored-by: Alexandre Philibeaux <[email protected]>
1 parent 11266a9 commit bf7f41f

File tree

13 files changed

+230
-88
lines changed

13 files changed

+230
-88
lines changed

.changeset/renovate-475bdf8.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@scaleway/eslint-config-react': patch
3+
---
4+
5+
Updated dependency `@typescript-eslint/eslint-plugin` to `6.4.0`.
6+
Updated dependency `@typescript-eslint/parser` to `6.4.0`.

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
},
2828
"extends": ["@scaleway/react/typescript"],
2929
"rules": {
30-
"no-console": "off"
30+
"no-console": "off",
31+
"@typescript-eslint/no-explicit-any": "warn",
32+
"@typescript-eslint/no-floating-promises": "warn"
3133
}
3234
},
3335
{

packages/changesets-renovate/src/__tests__/generate-changeset.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'
1+
import {
2+
afterEach,
3+
beforeEach,
4+
describe,
5+
expect,
6+
it,
7+
jest,
8+
} from '@jest/globals'
29
import fs from 'node:fs/promises'
310
import { simpleGit } from 'simple-git'
411
import { run } from '..'

packages/eslint-config-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"license": "MIT",
1919
"dependencies": {
2020
"@emotion/eslint-plugin": "11.11.0",
21-
"@typescript-eslint/eslint-plugin": "5.62.0",
22-
"@typescript-eslint/parser": "5.62.0",
21+
"@typescript-eslint/eslint-plugin": "6.4.0",
22+
"@typescript-eslint/parser": "6.4.0",
2323
"eslint-config-airbnb": "19.0.4",
2424
"eslint-config-airbnb-typescript": "17.1.0",
2525
"eslint-config-prettier": "9.0.0",

packages/eslint-config-react/typescript.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = {
2929
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
3030
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
3131
'@typescript-eslint/prefer-ts-expect-error': 'error',
32+
'@typescript-eslint/no-floating-promises': 'error',
3233
// https://github.com/typescript-eslint/typescript-eslint/issues/4619
3334
'@typescript-eslint/no-misused-promises': [
3435
'error',
@@ -38,10 +39,12 @@ module.exports = {
3839
},
3940
},
4041
],
42+
'@typescript-eslint/no-explicit-any': 'warn',
4143
'@typescript-eslint/no-unused-vars': 'error',
4244
'@typescript-eslint/consistent-type-imports': 'error',
4345
'@typescript-eslint/consistent-type-exports': 'error',
4446
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
47+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
4548
// We favor object defaults instead of default props in TS
4649
// https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/default_props/#you-may-not-need-defaultprops
4750
// https://twitter.com/dan_abramov/status/1133878326358171650

packages/outdated-browser/src/__tests__/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { afterEach, beforeAll, describe, expect, jest, test } from '@jest/globals'
1+
import {
2+
afterEach,
3+
beforeAll,
4+
describe,
5+
expect,
6+
jest,
7+
test,
8+
} from '@jest/globals'
29

310
/**
411
* @jest-environment jsdom

packages/use-dataloader/src/__tests__/dataloader.test.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ describe('Dataloader class', () => {
5454
notifyChanges,
5555
})
5656
expect(method).toBeCalledTimes(0)
57-
instance.load().catch(undefined)
58-
instance.load().catch(undefined)
59-
await instance.load()
57+
58+
// simulate multiple call in //
59+
await Promise.all([
60+
instance.load().catch(undefined),
61+
instance.load().catch(undefined),
62+
instance.load(),
63+
])
64+
6065
expect(method).toBeCalledTimes(1)
6166
instance.clearData()
6267
})
@@ -71,7 +76,9 @@ describe('Dataloader class', () => {
7176
})
7277
expect(instance.getData()).toBe(undefined)
7378
expect(notify).toBeCalledTimes(0)
74-
instance.load().catch(undefined)
79+
80+
instance.load().catch(() => null)
81+
7582
expect(method).toBeCalledTimes(1)
7683
instance.cancel()
7784
expect(notify).toBeCalledTimes(0)
@@ -145,7 +152,9 @@ describe('Dataloader class', () => {
145152
method,
146153
notifyChanges,
147154
})
155+
148156
instance.load().catch(undefined)
157+
149158
instance.cancel()
150159
await waitForExpect(() => expect(instance.status).toBe(StatusEnum.IDLE))
151160
expect(notifyChanges).toBeCalledTimes(1)
@@ -181,9 +190,11 @@ describe('Dataloader class', () => {
181190
notifyChanges,
182191
}),
183192
)
184-
instances.forEach(instance => {
185-
instance.load().catch(undefined)
186-
})
193+
194+
for await (const instance of instances) {
195+
await instance.load().catch(() => null)
196+
}
197+
187198
await waitForExpect(() => expect(method).toBeCalledTimes(5))
188199
})
189200
})

packages/use-dataloader/src/useDataLoader.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ export const useDataLoader = <ResultType = unknown, ErrorType = Error>(
112112

113113
useEffect(() => {
114114
if (needLoad) {
115-
request.load().then(onSuccessRef.current).catch(onErrorRef.current)
115+
const defaultOnSuccessOrError = () => {}
116+
const onSuccessLoad = onSuccessRef.current ?? defaultOnSuccessOrError
117+
const onFailedLoad = onErrorRef.current ?? defaultOnSuccessOrError
118+
request.load().then(onSuccessLoad).catch(onFailedLoad)
116119
}
117120
optimisticIsLoadingRef.current = false
118121
}, [needLoad, request])
@@ -130,10 +133,11 @@ export const useDataLoader = <ResultType = unknown, ErrorType = Error>(
130133
needPollingRef.current &&
131134
!request.isCalled)
132135
) {
133-
request
134-
.load(true)
135-
.then(onSuccessRef.current)
136-
.catch(onErrorRef.current)
136+
const defaultOnSuccessOrError = () => {}
137+
const onSuccessLoad = onSuccessRef.current ?? defaultOnSuccessOrError
138+
const onFailedLoad = onErrorRef.current ?? defaultOnSuccessOrError
139+
140+
request.load(true).then(onSuccessLoad).catch(onFailedLoad)
137141
}
138142
}, pollingInterval)
139143
}

packages/use-gtm/src/__tests__/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'
1+
import {
2+
afterEach,
3+
beforeEach,
4+
describe,
5+
expect,
6+
it,
7+
jest,
8+
} from '@jest/globals'
29
import { fireEvent, renderHook } from '@testing-library/react'
310
import mockdate from 'mockdate'
411
import type { ReactNode } from 'react'

packages/use-i18n/src/__tests__/usei18n.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'
1+
import {
2+
afterEach,
3+
beforeEach,
4+
describe,
5+
expect,
6+
it,
7+
jest,
8+
} from '@jest/globals'
29
import { act, renderHook, waitFor } from '@testing-library/react'
310
import mockdate from 'mockdate'
411
import type { ReactNode } from 'react'

0 commit comments

Comments
 (0)