aws-sdk-js-codemod
Version:
Collection of codemod scripts that help update AWS SDK for JavaScript APIs
21 lines (20 loc) • 810 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addPromiseRemovalComments = void 0;
const addPromiseRemovalComments = (j, source) => {
// Add comment for .promise() calls which weren't removed.
source
.find(j.CallExpression, {
callee: {
type: "MemberExpression",
property: { type: "Identifier", name: "promise" },
},
})
.forEach(({ node }) => {
const comments = node.comments || [];
comments.push(j.commentLine(" The `.promise()` call might be on an JS SDK v2 client API."));
comments.push(j.commentLine(" If yes, please remove .promise(). If not, remove this comment."));
node.comments = comments;
});
};
exports.addPromiseRemovalComments = addPromiseRemovalComments;