Skip to content

Commit e5efaa8

Browse files
committed
Fix lint issues
1 parent a3a9cd5 commit e5efaa8

File tree

8 files changed

+21
-8
lines changed

8 files changed

+21
-8
lines changed

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
"./node_modules/kcd-scripts/eslint.js",
8484
"plugin:import/typescript"
8585
],
86+
"parserOptions": {
87+
"ecmaVersion": 2020
88+
},
8689
"rules": {
8790
"@typescript-eslint/prefer-optional-chain": "off",
8891
"@typescript-eslint/no-explicit-any": "off",

src/__tests__/config.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ describe('configuration API', () => {
1111
return {}
1212
})
1313
})
14-
afterEach(() => {
15-
configure(originalConfig)
16-
})
1714

1815
beforeEach(() => {
1916
configure({other: 123})
2017
})
2118

19+
afterEach(() => {
20+
configure(originalConfig)
21+
})
22+
2223
describe('getConfig', () => {
2324
test('returns existing configuration', () => {
2425
const conf = getConfig()

src/__tests__/fake-timers.js

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ test('recursive timers do not cause issues', async () => {
7070
let recurse = true
7171
function startTimer() {
7272
setTimeout(() => {
73+
// eslint-disable-next-line jest/no-conditional-in-test -- false-positive
7374
if (recurse) startTimer()
7475
}, 1)
7576
}

src/__tests__/role.js

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ test('accessible name filter implements TextMatch', () => {
274274
expect(
275275
getByRole('heading', {
276276
name: (name, element) => {
277+
// eslint-disable-next-line jest/no-conditional-in-test -- false-positive
277278
return element.nodeName === 'H2' && name === 'Your Signature'
278279
},
279280
}),

src/__tests__/wait-for-element-to-be-removed.js

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ test('rethrows non-testing-lib errors', () => {
9898
const error = new Error('my own error')
9999
return expect(
100100
waitForElementToBeRemoved(() => {
101+
// eslint-disable-next-line jest/no-conditional-in-test -- false-positive
101102
if (throwIt) {
102103
throw error
103104
}

src/__tests__/wait-for.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ test('does not work after it resolves', async () => {
275275
context = 'act'
276276
try {
277277
const result = callback()
278-
// eslint-disable-next-line jest/no-if
278+
// eslint-disable-next-line jest/no-if, jest/no-conditional-in-test -- false-positive
279279
if (typeof result?.then === 'function') {
280280
const thenable = result
281281
return {
@@ -319,6 +319,7 @@ test('does not work after it resolves', async () => {
319319

320320
await waitFor(
321321
() => {
322+
// eslint-disable-next-line jest/no-conditional-in-test -- false-positive
322323
if (data === null) {
323324
throw new Error('not found')
324325
}

src/helpers.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function jestFakeTimersAreEnabled() {
1010
// legacy timers
1111
(setTimeout as any)._isMockFunction === true ||
1212
// modern timers
13+
// eslint-disable-next-line prefer-object-has-own -- not supported by our support matrix
1314
Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
1415
)
1516
}

src/queries/label-text.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,23 @@ const queryAllByLabelText: AllByText = (
7171
if (
7272
matcher(label.content, label.formControl, text, matchNormalizer) &&
7373
label.formControl
74-
)
74+
) {
7575
labelledElements.push(label.formControl)
76+
}
7677
})
7778
const labelsValue = labelList
7879
.filter(label => Boolean(label.content))
7980
.map(label => label.content)
8081
if (
8182
matcher(labelsValue.join(' '), labelledElement, text, matchNormalizer)
82-
)
83+
) {
8384
labelledElements.push(labelledElement)
85+
}
8486
if (labelsValue.length > 1) {
8587
labelsValue.forEach((labelValue, index) => {
86-
if (matcher(labelValue, labelledElement, text, matchNormalizer))
88+
if (matcher(labelValue, labelledElement, text, matchNormalizer)) {
8789
labelledElements.push(labelledElement)
90+
}
8891

8992
const labelsFiltered = [...labelsValue]
9093
labelsFiltered.splice(index, 1)
@@ -97,8 +100,9 @@ const queryAllByLabelText: AllByText = (
97100
text,
98101
matchNormalizer,
99102
)
100-
)
103+
) {
101104
labelledElements.push(labelledElement)
105+
}
102106
}
103107
})
104108
}

0 commit comments

Comments
 (0)