Skip to content

Commit e4b7d7f

Browse files
committed
format: fix linter issues
1 parent f8b466e commit e4b7d7f

File tree

9 files changed

+24
-22
lines changed

9 files changed

+24
-22
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"rules": {
44
"max-lines-per-function": "off",
55
"no-constant-condition": "off",
6-
"no-await-in-loop": "off"
6+
"no-await-in-loop": "off",
7+
"react-hooks/rules-of-hooks": "off",
8+
"no-console": "off"
79
}
810
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"validate": "kcd-scripts validate",
2828
"prepare": "npm run build",
2929
"build": "kcd-scripts build",
30-
"format": "prettier-eslint --write \"**/*.{js,ts,json,yml,md,mdx}\"",
30+
"lint": "kcd-scripts lint",
3131
"coverage": "codecov",
3232
"test": "kcd-scripts test",
3333
"test:update": "npm test -- --updateSnapshot --coverage",

src/__tests__/asyncHook.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('async hook tests', () => {
1717
return () => {
1818
clearInterval(interval)
1919
}
20-
}, [...values])
20+
}, [otherValues])
2121

2222
return value
2323
}
@@ -83,7 +83,7 @@ describe('async hook tests', () => {
8383
const { waitFor } = renderHook(() => null)
8484

8585
let actual = 0
86-
let expected = 1
86+
const expected = 1
8787

8888
setTimeout(() => {
8989
actual = expected
@@ -165,7 +165,7 @@ describe('async hook tests', () => {
165165
const { waitFor } = renderHook(() => null)
166166

167167
let actual = 0
168-
let expected = 1
168+
const expected = 1
169169

170170
setTimeout(() => {
171171
actual = expected
@@ -207,7 +207,7 @@ describe('async hook tests', () => {
207207
const { waitForValueToChange } = renderHook(() => null)
208208

209209
let actual = 0
210-
let expected = 1
210+
const expected = 1
211211

212212
setTimeout(() => {
213213
actual = expected

src/__tests__/autoCleanup.noAfterEach.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ describe('skip auto cleanup (no afterEach) tests', () => {
77
let renderHook
88

99
beforeAll(() => {
10+
// eslint-disable-next-line no-global-assign
1011
afterEach = false
11-
renderHook = require('src').renderHook
12+
renderHook = require('../').renderHook
1213
})
1314

1415
test('first', () => {

src/__tests__/cleanup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('cleanup tests', () => {
2121
})
2222

2323
test('should cleanup all rendered hooks', async () => {
24-
let cleanupCalled = []
24+
const cleanupCalled = []
2525
const hookWithCleanup = (id) => {
2626
useEffect(() => {
2727
return () => {
@@ -40,7 +40,7 @@ describe('cleanup tests', () => {
4040
})
4141

4242
test('should call cleanups in reverse order', async () => {
43-
let callSequence = []
43+
const callSequence = []
4444
addCleanup(() => {
4545
callSequence.push('cleanup')
4646
})
@@ -62,7 +62,7 @@ describe('cleanup tests', () => {
6262
})
6363

6464
test('should wait for async cleanup', async () => {
65-
let callSequence = []
65+
const callSequence = []
6666
addCleanup(() => {
6767
callSequence.push('cleanup')
6868
})
@@ -85,7 +85,7 @@ describe('cleanup tests', () => {
8585
})
8686

8787
test('should remove cleanup using removeCleanup', async () => {
88-
let callSequence = []
88+
const callSequence = []
8989
addCleanup(() => {
9090
callSequence.push('cleanup')
9191
})
@@ -110,7 +110,7 @@ describe('cleanup tests', () => {
110110
})
111111

112112
test('should remove cleanup using returned handler', async () => {
113-
let callSequence = []
113+
const callSequence = []
114114
addCleanup(() => {
115115
callSequence.push('cleanup')
116116
})

src/__tests__/errorHook.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('error hook tests', () => {
2121
function useEffectError(throwError) {
2222
useEffect(() => {
2323
useError(throwError)
24-
}, [])
24+
}, [throwError])
2525
return true
2626
}
2727

@@ -115,6 +115,7 @@ describe('error hook tests', () => {
115115
Refer to https://github.com/testing-library/react-hooks-testing-library/issues/308
116116
for more details.
117117
*/
118+
// eslint-disable-next-line jest/no-disabled-tests
118119
describe.skip('effect', () => {
119120
test('should raise effect error', () => {
120121
const { result } = renderHook(() => useEffectError(true))
@@ -137,12 +138,9 @@ describe('error hook tests', () => {
137138
})
138139

139140
test('should reset effect error', () => {
140-
const { result, waitForNextUpdate, rerender } = renderHook(
141-
(throwError) => useEffectError(throwError),
142-
{
143-
initialProps: true
144-
}
145-
)
141+
const { result, rerender } = renderHook((throwError) => useEffectError(throwError), {
142+
initialProps: true
143+
})
146144

147145
expect(result.error).not.toBe(undefined)
148146

src/__tests__/useEffect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { renderHook } from '../'
33

44
describe('useEffect tests', () => {
55
test('should handle useEffect hook', () => {
6-
const sideEffect = { [1]: false, [2]: false }
6+
const sideEffect = { 1: false, 2: false }
77

88
const { rerender, unmount } = renderHook(
99
({ id }) => {
@@ -32,7 +32,7 @@ describe('useEffect tests', () => {
3232
})
3333

3434
test('should handle useLayoutEffect hook', () => {
35-
const sideEffect = { [1]: false, [2]: false }
35+
const sideEffect = { 1: false, 2: false }
3636

3737
const { rerender, unmount } = renderHook(
3838
({ id }) => {

src/__tests__/useState.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('useState tests', () => {
1313
test('should update setState value using setter', () => {
1414
const { result } = renderHook(() => useState('foo'))
1515

16-
const [_, setValue] = result.current
16+
const [ignoredValue, setValue] = result.current
1717

1818
act(() => setValue('bar'))
1919

src/asyncUtils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function asyncUtils(addResolver) {
3939
}
4040

4141
const waitFor = async (callback, { interval, timeout, suppressErrors = true } = {}) => {
42+
// eslint-disable-next-line consistent-return
4243
const checkResult = () => {
4344
try {
4445
const callbackResult = callback()

0 commit comments

Comments
 (0)