@putout/plugin-promises
Version:
🐊Putout plugin improves Promise-related code
22 lines (15 loc) • 404 B
JavaScript
;
module.exports.report = () => `Add missing 'async'`;
module.exports.fix = (path) => {
path.node.async = true;
};
module.exports.traverse = ({push}) => ({
AwaitExpression(path) {
const fnPath = path.getFunctionParent();
if (!fnPath)
return;
if (fnPath.node.async)
return;
push(fnPath);
},
});