cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Use or explicitly ignore all promises

Open bjaspan opened this issue 1 year ago • 5 comments

From Google's internal Typescript conformance checks (I'll look to see if these are open-source somewhere):

"When using async / await, it can be easy to forget to await a promise which can result in async tasks running in an unexpected order. Thus, we require that every promise in an async function is consumed in some way, so that there's a well-defined order in which async tasks are resolved. To fix this check, you can do one of the following:

  • Remove async from the function, and instead use normal promise chaining. await the promise.
  • Assign the promise to a variable and await it later.
  • If you really want to use async and don't want to await a particular Promise, you can use the void operator to signal your intent.
    void returnsPromise();
    
    This explicitly makes your intention to not await the promise clear."
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/actions/Find.ts:50:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

 50       showWarning(
          ~~~~~~~~~~~~
 51         ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~
... 
 53         "Search text is longer than 200 characters; truncating",
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 54       );
    ~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/actions/GenerateSnippet/GenerateSnippet.ts:90:5 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

90     flashTargets(ide(), targets, FlashStyle.referenced);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/actions/ShowParseTree.ts:52:5 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

52     ide().openUntitledTextDocument({
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53       language: "markdown",
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
54       content: results.join("\n\n"),
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55     });
   ~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/actions/Sort.ts:43:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

 43       showWarning(
          ~~~~~~~~~~~~
 44         ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~
... 
 46         'This action works on multiple targets, e.g. "sort every line block" instead of "sort block".',
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 47       );
    ~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/core/Snippets.ts:155:9 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

155         showError(ide().messages, "snippetsDirError", errorMessage);
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/core/Snippets.ts:196:11 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

196           showError(
              ~~~~~~~~~~
197             ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
201             }`,
    ~~~~~~~~~~~~~~~
202           );
    ~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/spokenForms/CustomSpokenForms.ts:117:9 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

117         showError(
            ~~~~~~~~~~
118           ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~~~
... 
122           }}}. Falling back to default spoken forms.`,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123         );
    ~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:111:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

111       showInfo(ide().messages, "recordStop", "Stopped recording test cases");
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:245:5 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

245     showInfo(
        ~~~~~~~~~
246       ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~
... 
248       `Recording test cases for following commands in:\n${this.targetDirectory}`,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249     );
    ~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:384:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

384       showInfo(ide().messages, "testCaseSaved", message, "View", "Delete").then(
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
385         async (action) => {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
398         },
    ~~~~~~~~~~
399       );
    ~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:422:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

422       showError(ide().messages, "promptSubdirectoryError", errorMessage);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/actions/ShowParseTree.ts:52:5 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

52     ide().openUntitledTextDocument({
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53       language: "markdown",
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
54       content: results.join("\n\n"),
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55     });
   ~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/actions/Sort.ts:43:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

 43       showWarning(
          ~~~~~~~~~~~~
 44         ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~
... 
 46         'This action works on multiple targets, e.g. "sort every line block" instead of "sort block".',
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 47       );
    ~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/core/Snippets.ts:155:9 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

155         showError(ide().messages, "snippetsDirError", errorMessage);
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/core/Snippets.ts:196:11 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

196           showError(
              ~~~~~~~~~~
197             ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
201             }`,
    ~~~~~~~~~~~~~~~
202           );
    ~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/spokenForms/CustomSpokenForms.ts:117:9 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

117         showError(
            ~~~~~~~~~~
118           ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~~~~~
... 
122           }}}. Falling back to default spoken forms.`,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123         );
    ~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:111:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

111       showInfo(ide().messages, "recordStop", "Stopped recording test cases");
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:245:5 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

245     showInfo(
        ~~~~~~~~~
246       ide().messages,
    ~~~~~~~~~~~~~~~~~~~~~
... 
248       `Recording test cases for following commands in:\n${this.targetDirectory}`,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249     );
    ~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:384:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

384       showInfo(ide().messages, "testCaseSaved", message, "View", "Delete").then(
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
385         async (action) => {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
398         },
    ~~~~~~~~~~
399       );
    ~~~~~~~
third_party/vscode_ext/cursorless_vscode/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts:422:7 - error TS21225: [tsetse] All Promises in async functions must either be awaited or used in an expression.
	See http://go/ts-conformance#must-use-promises

422       showError(ide().messages, "promptSubdirectoryError", errorMessage);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bjaspan avatar Oct 31 '23 15:10 bjaspan