2.0.2 ā€¢ Published 2 years ago

@putout/plugin-apply-top-level-await v2.0.2

Weekly downloads
2,577
License
MIT
Repository
github
Last release
2 years ago

@putout/plugin-apply-top-level-await NPM version

šŸŠ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