Check for unawaited (floating) async function calls
npm install unawaitedjs
// someFile.js
const getWeather = async function() {...}
const weather = getWeather();
^ ^ ^
missing await
$ unawaited -g "someFile.js"
1 problem(s) found!
Function getWeather at someFile.js:1:6 called at someFile.js:3:16
`
Install
`
$ npm install --global unawaited
`
Usage
`
$ unawaited --help
Usage: unawaited [options]
Check for unawaited async function calls
Options:
-V, --version output the version number
-g, --glob Glob patterns to search for files. Only JS files supported.
-q, --quiet Supress output.
-i, --ignorePath Path to file to use for ignoring problems.
-h, --help display help for command
Examples
$ unawaited -g "src/*/.js"
$ unawaited -g "src/*/.js" "index.js" -i .unawaitedignore
`
Ignore false positives
Provide path to a file with --ignorePath which contains parts of strings to ignore function declarations.
Eg. to ignore all warnings in src/someFile.js, and for calls to function fooBar at src/otherFile.js:
`
src/someFile.js
fooBar at src/otherFile.js
``