Skip to content

Commit c55d328

Browse files
committed
chore: fix linting warnings
1 parent e947a8e commit c55d328

File tree

8 files changed

+13
-12
lines changed

8 files changed

+13
-12
lines changed

src/__tests__/wait-for.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {waitFor} from '../'
1+
import {waitFor} from '../index'
22
import {configure, getConfig} from '../config'
33
// import {render} from '../pure'
44

@@ -109,6 +109,7 @@ test('throws nice error if provided callback is not a function', () => {
109109
)
110110
})
111111

112+
// eslint-disable-next-line jest/no-commented-out-tests
112113
// test('timeout logs a pretty DOM', async () => {
113114
// renderIntoDocument(`<div id="pretty">how pretty</div>`)
114115
// const error = await waitFor(

src/get-user-code-frame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ try {
1212
'@babel/code-frame',
1313
).codeFrameColumns
1414
chalk = nodeRequire.call(module, 'chalk')
15-
} catch {
15+
} catch (e) {
1616
// We're in a browser environment
1717
}
1818

@@ -32,7 +32,7 @@ function getCodeFrame(frame) {
3232
let rawFileContents = ''
3333
try {
3434
rawFileContents = readFileSync(filename, 'utf-8')
35-
} catch {
35+
} catch (e) {
3636
return ''
3737
}
3838

src/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function jestFakeTimersAreEnabled() {
55
// legacy timers
66
setTimeout._isMockFunction === true ||
77
// modern timers
8-
Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
8+
Object.hasOwn(setTimeout, 'clock')
99
)
1010
}
1111
// istanbul ignore next
@@ -48,7 +48,7 @@ function debounce(func, timeout) {
4848
return (...args) => {
4949
clearTimeout(timer)
5050
timer = setTimeout(() => {
51-
// eslint-disable-next-line @babel/no-invalid-this
51+
// eslint-disable-next-line no-invalid-this
5252
func.apply(this, args)
5353
}, timeout)
5454
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {cleanup} from './pure'
44
// or teardown then we'll automatically run cleanup afterEach test
55
// this ensures that tests run in isolation from each other
66
// if you don't like this then set the CTL_SKIP_AUTO_CLEANUP env variable to 'true'.
7-
if (typeof process === 'undefined' || !process.env?.CTL_SKIP_AUTO_CLEANUP) {
7+
if (typeof process === 'undefined' || !(process.env && process.env.CTL_SKIP_AUTO_CLEANUP)) {
88
// ignore teardown() in code coverage because Jest does not support it
99
/* istanbul ignore else */
1010
if (typeof afterEach === 'function') {

src/matchers/to-be-in-the-console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @babel/no-invalid-this */
1+
/* eslint-disable no-invalid-this */
22
import {getDefaultNormalizer} from '../matches'
33
import {checkCliInstance, getMessage} from './utils'
44

src/matchers/to-have-errormessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @babel/no-invalid-this */
1+
/* eslint-disable no-invalid-this */
22
import {getDefaultNormalizer} from '../matches'
33
import {checkCliInstance, getMessage} from './utils'
44

src/matchers/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class GenericTypeError extends Error {
2626
'',
2727
),
2828
'',
29-
// eslint-disable-next-line @babel/new-cap
29+
// eslint-disable-next-line new-cap
3030
`${context.utils.RECEIVED_COLOR(
3131
'received',
3232
)} value must ${expectedString}.`,
@@ -65,11 +65,11 @@ function getMessage(
6565
) {
6666
return [
6767
`${matcher}\n`,
68-
// eslint-disable-next-line @babel/new-cap
68+
// eslint-disable-next-line new-cap
6969
`${expectedLabel}:\n${context.utils.EXPECTED_COLOR(
7070
redent(display(context, expectedValue), 2),
7171
)}`,
72-
// eslint-disable-next-line @babel/new-cap
72+
// eslint-disable-next-line new-cap
7373
`${receivedLabel}:\n${context.utils.RECEIVED_COLOR(
7474
redent(display(context, receivedValue), 2),
7575
)}`,

src/wait-for.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function waitFor(
122122
if (promiseStatus === 'pending') return
123123
try {
124124
const result = callback() // runWithExpensiveErrorDiagnosticsDisabled(callback)
125-
if (typeof result?.then === 'function') {
125+
if (typeof (result && result.then) === 'function') {
126126
promiseStatus = 'pending'
127127
result.then(
128128
resolvedValue => {

0 commit comments

Comments
 (0)