Merge pull request #2075 from github/robertbrignull/enable-await-thenable
Enable eslint rule to disallow awaiting a non-thenable type
This commit is contained in:
@@ -29,6 +29,7 @@ const baseConfig = {
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
],
|
||||
rules: {
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/no-use-before-define": 0,
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
|
||||
@@ -28,7 +28,7 @@ async function lintScenarios() {
|
||||
throw new Error(`Invalid schema: ${ajv.errorsText()}`);
|
||||
}
|
||||
|
||||
const validate = await ajv.compile(schema);
|
||||
const validate = ajv.compile(schema);
|
||||
|
||||
let invalidFiles = 0;
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
);
|
||||
}
|
||||
|
||||
return await spawnServer(
|
||||
return spawnServer(
|
||||
codeQlPath,
|
||||
"CodeQL CLI Server",
|
||||
["execute", "cli-server"],
|
||||
@@ -456,7 +456,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
void logStream(child.stderr!, logger);
|
||||
}
|
||||
|
||||
for await (const event of await splitStreamAtSeparators(child.stdout!, [
|
||||
for await (const event of splitStreamAtSeparators(child.stdout!, [
|
||||
"\0",
|
||||
])) {
|
||||
yield event;
|
||||
@@ -488,7 +488,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
cancellationToken?: CancellationToken,
|
||||
logger?: Logger,
|
||||
): AsyncGenerator<EventType, void, unknown> {
|
||||
for await (const event of await this.runAsyncCodeQlCliCommandInternal(
|
||||
for await (const event of this.runAsyncCodeQlCliCommandInternal(
|
||||
command,
|
||||
commandArgs,
|
||||
cancellationToken,
|
||||
@@ -751,7 +751,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
...testPaths,
|
||||
]);
|
||||
|
||||
for await (const event of await this.runAsyncCodeQlCliCommand<TestCompleted>(
|
||||
for await (const event of this.runAsyncCodeQlCliCommand<TestCompleted>(
|
||||
["test", "run"],
|
||||
subcommandArgs,
|
||||
"Run CodeQL Tests",
|
||||
@@ -1561,7 +1561,7 @@ const lineEndings = ["\r\n", "\r", "\n"];
|
||||
* @param logger The logger that will consume the stream output.
|
||||
*/
|
||||
async function logStream(stream: Readable, logger: Logger): Promise<void> {
|
||||
for await (const line of await splitStreamAtSeparators(stream, lineEndings)) {
|
||||
for await (const line of splitStreamAtSeparators(stream, lineEndings)) {
|
||||
// Await the result of log here in order to ensure the logs are written in the correct order.
|
||||
await logger.log(line);
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ export async function activate(
|
||||
) {
|
||||
registerErrorStubs([checkForUpdatesCommand], (command) => async () => {
|
||||
const installActionName = "Install CodeQL CLI";
|
||||
const chosenAction = await void showAndLogErrorMessage(
|
||||
const chosenAction = await showAndLogErrorMessage(
|
||||
`Can't execute ${command}: missing CodeQL CLI.`,
|
||||
{
|
||||
items: [installActionName],
|
||||
|
||||
@@ -96,8 +96,8 @@ export class MockGitHubApiServer extends DisposableObject {
|
||||
}
|
||||
|
||||
public async stopRecording(): Promise<void> {
|
||||
await this.recorder.stop();
|
||||
await this.recorder.clear();
|
||||
this.recorder.stop();
|
||||
this.recorder.clear();
|
||||
}
|
||||
|
||||
public async getScenarioNames(scenariosPath?: string): Promise<string[]> {
|
||||
|
||||
@@ -35,11 +35,11 @@ export class VSCodeMockGitHubApiServer extends DisposableObject {
|
||||
}
|
||||
|
||||
public async startServer(): Promise<void> {
|
||||
await this.server.startServer();
|
||||
this.server.startServer();
|
||||
}
|
||||
|
||||
public async stopServer(): Promise<void> {
|
||||
await this.server.stopServer();
|
||||
this.server.stopServer();
|
||||
|
||||
await commands.executeCommand(
|
||||
"setContext",
|
||||
|
||||
@@ -57,7 +57,7 @@ export class QlPackGenerator {
|
||||
|
||||
const end = (workspace.workspaceFolders || []).length;
|
||||
|
||||
await workspace.updateWorkspaceFolders(end, 0, {
|
||||
workspace.updateWorkspaceFolders(end, 0, {
|
||||
name: this.folderName,
|
||||
uri: this.folderUri,
|
||||
});
|
||||
|
||||
@@ -356,15 +356,11 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
|
||||
tests: string[],
|
||||
cancellationToken: CancellationToken,
|
||||
): Promise<void> {
|
||||
const workspacePaths = await getOnDiskWorkspaceFolders();
|
||||
for await (const event of await this.cliServer.runTests(
|
||||
tests,
|
||||
workspacePaths,
|
||||
{
|
||||
cancellationToken,
|
||||
logger: testLogger,
|
||||
},
|
||||
)) {
|
||||
const workspacePaths = getOnDiskWorkspaceFolders();
|
||||
for await (const event of this.cliServer.runTests(tests, workspacePaths, {
|
||||
cancellationToken,
|
||||
logger: testLogger,
|
||||
})) {
|
||||
const state = event.pass
|
||||
? "passed"
|
||||
: event.messages?.length
|
||||
|
||||
@@ -50,11 +50,11 @@ class Checkpoint<T> {
|
||||
}
|
||||
|
||||
async resolve(): Promise<void> {
|
||||
await this.res();
|
||||
this.res();
|
||||
}
|
||||
|
||||
async reject(e: Error): Promise<void> {
|
||||
await this.rej(e);
|
||||
this.rej(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@ class Checkpoint<T> {
|
||||
}
|
||||
|
||||
async resolve(): Promise<void> {
|
||||
await this.res();
|
||||
this.res();
|
||||
}
|
||||
|
||||
async reject(e: Error): Promise<void> {
|
||||
await this.rej(e);
|
||||
this.rej(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user