Skip to content

Commit

Permalink
chore: fix linting warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn committed May 31, 2022
1 parent e947a8e commit c55d328
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/__tests__/wait-for.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {waitFor} from '../'
import {waitFor} from '../index'
import {configure, getConfig} from '../config'
// import {render} from '../pure'

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

// eslint-disable-next-line jest/no-commented-out-tests
// test('timeout logs a pretty DOM', async () => {
// renderIntoDocument(`<div id="pretty">how pretty</div>`)
// const error = await waitFor(
Expand Down
4 changes: 2 additions & 2 deletions src/get-user-code-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ try {
'@babel/code-frame',
).codeFrameColumns
chalk = nodeRequire.call(module, 'chalk')
} catch {
} catch (e) {
// We're in a browser environment
}

Expand All @@ -32,7 +32,7 @@ function getCodeFrame(frame) {
let rawFileContents = ''
try {
rawFileContents = readFileSync(filename, 'utf-8')
} catch {
} catch (e) {
return ''
}

Expand Down
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function jestFakeTimersAreEnabled() {
// legacy timers
setTimeout._isMockFunction === true ||
// modern timers
Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
Object.hasOwn(setTimeout, 'clock')
)
}
// istanbul ignore next
Expand Down Expand Up @@ -48,7 +48,7 @@ function debounce(func, timeout) {
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
// eslint-disable-next-line @babel/no-invalid-this
// eslint-disable-next-line no-invalid-this
func.apply(this, args)
}, timeout)
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {cleanup} from './pure'
// or teardown then we'll automatically run cleanup afterEach test
// this ensures that tests run in isolation from each other
// if you don't like this then set the CTL_SKIP_AUTO_CLEANUP env variable to 'true'.
if (typeof process === 'undefined' || !process.env?.CTL_SKIP_AUTO_CLEANUP) {
if (typeof process === 'undefined' || !(process.env && process.env.CTL_SKIP_AUTO_CLEANUP)) {
// ignore teardown() in code coverage because Jest does not support it
/* istanbul ignore else */
if (typeof afterEach === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/to-be-in-the-console.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @babel/no-invalid-this */
/* eslint-disable no-invalid-this */
import {getDefaultNormalizer} from '../matches'
import {checkCliInstance, getMessage} from './utils'

Expand Down
2 changes: 1 addition & 1 deletion src/matchers/to-have-errormessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @babel/no-invalid-this */
/* eslint-disable no-invalid-this */
import {getDefaultNormalizer} from '../matches'
import {checkCliInstance, getMessage} from './utils'

Expand Down
6 changes: 3 additions & 3 deletions src/matchers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GenericTypeError extends Error {
'',
),
'',
// eslint-disable-next-line @babel/new-cap
// eslint-disable-next-line new-cap
`${context.utils.RECEIVED_COLOR(
'received',
)} value must ${expectedString}.`,
Expand Down Expand Up @@ -65,11 +65,11 @@ function getMessage(
) {
return [
`${matcher}\n`,
// eslint-disable-next-line @babel/new-cap
// eslint-disable-next-line new-cap
`${expectedLabel}:\n${context.utils.EXPECTED_COLOR(
redent(display(context, expectedValue), 2),
)}`,
// eslint-disable-next-line @babel/new-cap
// eslint-disable-next-line new-cap
`${receivedLabel}:\n${context.utils.RECEIVED_COLOR(
redent(display(context, receivedValue), 2),
)}`,
Expand Down
2 changes: 1 addition & 1 deletion src/wait-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function waitFor(
if (promiseStatus === 'pending') return
try {
const result = callback() // runWithExpensiveErrorDiagnosticsDisabled(callback)
if (typeof result?.then === 'function') {
if (typeof (result && result.then) === 'function') {
promiseStatus = 'pending'
result.then(
resolvedValue => {
Expand Down

0 comments on commit c55d328

Please sign in to comment.