Skip to content

Commit 5a48893

Browse files
committed
Update XO and fix problems
1 parent a7737cd commit 5a48893

File tree

17 files changed

+1325
-906
lines changed

17 files changed

+1325
-906
lines changed

lib/assert.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export class Assertions {
464464
retval = fn();
465465
if (isPromise(retval)) {
466466
// Here isPromise() checks if something is "promise like". Cast to an actual promise.
467-
Promise.resolve(retval).catch(noop); // eslint-disable-line promise/prefer-await-to-then
467+
Promise.resolve(retval).catch(noop);
468468
fail(new AssertionError({
469469
assertion: 'throws',
470470
message,
@@ -528,7 +528,7 @@ export class Assertions {
528528
// Create an error object to record the stack before it gets lost in the promise chain.
529529
const savedError = getErrorWithLongStackTrace();
530530
// Handle "promise like" objects by casting to a real Promise.
531-
const intermediate = Promise.resolve(promise).then(value => { // eslint-disable-line promise/prefer-await-to-then
531+
const intermediate = Promise.resolve(promise).then(value => {
532532
throw new AssertionError({
533533
assertion: 'throwsAsync',
534534
message,
@@ -637,7 +637,7 @@ export class Assertions {
637637
// Create an error object to record the stack before it gets lost in the promise chain.
638638
const savedError = getErrorWithLongStackTrace();
639639
// Handle "promise like" objects by casting to a real Promise.
640-
const intermediate = Promise.resolve(promise).then(noop, error => { // eslint-disable-line promise/prefer-await-to-then
640+
const intermediate = Promise.resolve(promise).then(noop, error => {
641641
throw new AssertionError({
642642
assertion: 'notThrowsAsync',
643643
message,

lib/eslint-plugin-helper-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const buildGlobs = ({conf, providers, projectDir, overrideExtensions, overrideFi
4141

4242
const resolveGlobs = async (projectDir, overrideExtensions, overrideFiles) => {
4343
if (!configCache.has(projectDir)) {
44-
configCache.set(projectDir, loadConfig({resolveFrom: projectDir}).then(async conf => { // eslint-disable-line promise/prefer-await-to-then
44+
configCache.set(projectDir, loadConfig({resolveFrom: projectDir}).then(async conf => {
4545
const providers = await collectProviders({conf, projectDir});
4646
return {conf, providers};
4747
}));

lib/plugin-support/shared-workers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function launchWorker(filename, initialData) {
3838
const launched = {
3939
statePromises: {
4040
available: waitForAvailable(worker),
41-
error: events.once(worker, 'error').then(([error]) => error), // eslint-disable-line promise/prefer-await-to-then
41+
error: events.once(worker, 'error').then(([error]) => error),
4242
},
4343
exited: false,
4444
worker,
@@ -59,7 +59,7 @@ export async function observeWorkerProcess(fork, runStatus) {
5959
signalDeregistered = resolve;
6060
});
6161

62-
fork.promise.finally(() => { // eslint-disable-line promise/prefer-await-to-then
62+
fork.promise.finally(() => {
6363
if (registrationCount === 0) {
6464
signalDeregistered();
6565
}
@@ -79,7 +79,7 @@ export async function observeWorkerProcess(fork, runStatus) {
7979
}
8080
};
8181

82-
launched.statePromises.error.then(error => { // eslint-disable-line promise/prefer-await-to-then
82+
launched.statePromises.error.then(error => {
8383
signalDeregistered();
8484
launched.worker.off('message', handleWorkerMessage);
8585
runStatus.emitStateChange({type: 'shared-worker-error', err: serializeError('Shared worker error', true, error)});
@@ -100,7 +100,7 @@ export async function observeWorkerProcess(fork, runStatus) {
100100
port,
101101
}, [port]);
102102

103-
fork.promise.finally(() => { // eslint-disable-line promise/prefer-await-to-then
103+
fork.promise.finally(() => {
104104
launched.worker.postMessage({
105105
type: 'deregister-test-worker',
106106
id: fork.forkId,

lib/runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ export default class Runner extends Emittery {
487487

488488
// Note that the hooks and tests always begin running asynchronously.
489489
const beforePromise = this.runHooks(this.tasks.before, contextRef);
490-
const serialPromise = beforePromise.then(beforeHooksOk => { // eslint-disable-line promise/prefer-await-to-then
490+
const serialPromise = beforePromise.then(beforeHooksOk => {
491491
// Don't run tests if a `before` hook failed.
492492
if (!beforeHooksOk) {
493493
return false;
@@ -509,7 +509,7 @@ export default class Runner extends Emittery {
509509
return this.runTest(task, contextRef.copy());
510510
}, true);
511511
});
512-
const concurrentPromise = Promise.all([beforePromise, serialPromise]).then(async ([beforeHooksOk, serialOk]) => { // eslint-disable-line promise/prefer-await-to-then
512+
const concurrentPromise = Promise.all([beforePromise, serialPromise]).then(async ([beforeHooksOk, serialOk]) => {
513513
// Don't run tests if a `before` hook failed, or if `failFast` is enabled
514514
// and a previous serial test failed.
515515
if (!beforeHooksOk || (!serialOk && this.failFast)) {

lib/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ export default class Test {
314314
this.refreshTimeout();
315315

316316
promise
317-
.catch(error => this.saveFirstError(error)) // eslint-disable-line promise/prefer-await-to-then
318-
.then(() => { // eslint-disable-line promise/prefer-await-to-then
317+
.catch(error => this.saveFirstError(error))
318+
.then(() => {
319319
this.pendingAssertionCount--;
320320
this.refreshTimeout();
321321
});
@@ -563,14 +563,14 @@ export default class Test {
563563
};
564564

565565
promise
566-
.catch(error => { // eslint-disable-line promise/prefer-await-to-then
566+
.catch(error => {
567567
this.saveFirstError(new AssertionError({
568568
message: 'Rejected promise returned by test',
569569
savedError: error instanceof Error && error,
570570
values: [formatErrorValue('Rejected promise returned by test. Reason:', error)],
571571
}));
572572
})
573-
.then(() => resolve(this.finish())); // eslint-disable-line promise/prefer-await-to-then
573+
.then(() => resolve(this.finish()));
574574
});
575575
}
576576

lib/watcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default class Watcher {
142142
updateSnapshots: updateSnapshots === true,
143143
},
144144
})
145-
.then(runStatus => { // eslint-disable-line promise/prefer-await-to-then
145+
.then(runStatus => {
146146
reporter.endRun();
147147
reporter.lineWriter.writeLine(END_MESSAGE);
148148

@@ -158,7 +158,7 @@ export default class Watcher {
158158
this.clearLogOnNextRun = false;
159159
}
160160
})
161-
.catch(rethrowAsync); // eslint-disable-line promise/prefer-await-to-then
161+
.catch(rethrowAsync);
162162
};
163163

164164
this.testDependencies = [];

lib/worker/base.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const run = async options => {
6969

7070
refs.runnerChain = runner.chain;
7171

72-
channel.peerFailed.then(() => { // eslint-disable-line promise/prefer-await-to-then
72+
channel.peerFailed.then(() => {
7373
runner.interrupt();
7474
});
7575

@@ -202,8 +202,8 @@ if (isRunningInThread) {
202202
channel.send({type: 'starting'}); // AVA won't terminate the worker thread until it's seen this message.
203203
const {options} = workerData;
204204
delete workerData.options; // Don't allow user code access.
205-
run(options).catch(onError); // eslint-disable-line promise/prefer-await-to-then
205+
run(options).catch(onError);
206206
} else if (isRunningInChildProcess) {
207207
channel.send({type: 'ready-for-options'});
208-
channel.options.then(run).catch(onError); // eslint-disable-line promise/prefer-await-to-then
208+
channel.options.then(run).catch(onError);
209209
}

lib/worker/channel.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ exports.unref = handle.unref.bind(handle);
110110
let pendingPings = Promise.resolve();
111111
async function flush() {
112112
handle.ref();
113-
const promise = pendingPings.then(async () => { // eslint-disable-line promise/prefer-await-to-then
113+
const promise = pendingPings.then(async () => {
114114
handle.send({type: 'ping'});
115115
await pEvent(handle.channel, 'message', selectAvaMessage('pong'));
116116
if (promise === pendingPings) {
@@ -172,9 +172,9 @@ function registerSharedWorker(filename, initialData) {
172172
// The attaching of message listeners will cause the port to be referenced by
173173
// Node.js. In order to keep track, explicitly reference before attaching.
174174
sharedWorkerHandle.ref();
175-
const ready = pEvent(ourPort, 'message', ({type}) => type === 'ready').then(() => { // eslint-disable-line promise/prefer-await-to-then
175+
const ready = pEvent(ourPort, 'message', ({type}) => type === 'ready').then(() => {
176176
currentlyAvailable = error === null;
177-
}).finally(() => { // eslint-disable-line promise/prefer-await-to-then
177+
}).finally(() => {
178178
// Once ready, it's up to user code to subscribe to messages, which (see
179179
// below) causes us to reference the port.
180180
sharedWorkerHandle.unref();
@@ -184,7 +184,7 @@ function registerSharedWorker(filename, initialData) {
184184

185185
// Errors are received over the test worker channel, not the message port
186186
// dedicated to the shared worker.
187-
pEvent(channelEmitter, 'shared-worker-error').then(() => { // eslint-disable-line promise/prefer-await-to-then
187+
pEvent(channelEmitter, 'shared-worker-error').then(() => {
188188
unsubscribe();
189189
sharedWorkerHandle.forceUnref();
190190
error = new Error('The shared worker is no longer available');

0 commit comments

Comments
 (0)