@putout/plugin-apply-top-level-await
v2.0.2
Published
putout plugin adds ability to apply top level await
Downloads
25,023
Maintainers
Readme
@putout/plugin-apply-top-level-await
🐊Putout
plugin applies top-level-await. Part of @putout/promises.
Install
npm i @putout/plugin-apply-top-level-await
Rule
{
"rules": {
"apply-top-level-await": "on"
}
}
❌ Incorrect code example
import fs from 'fs';
(async () => {
const data = await fs.promises.readFile('hello.txt');
})();
✅ Correct code Example
import fs from 'fs';
const data = await fs.promises.readFile('hello.txt');
License
MIT