@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