eslint-codemod-utils
Version:
A collection of AST helper functions for more complex ESLint rule fixes.
20 lines (19 loc) • 488 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeAfterComment = void 0;
/**
* @example
* ```tsx
* // this is the search comment
* const findThisNode = 10
* ^^^^^^^^^^^^^^^^^^^^^^^
* ```
*/
function getNodeAfterComment(source, comment) {
const token = source.getTokenAfter(comment);
if (token) {
return source.getNodeByRangeIndex(token.range[1]);
}
return null;
}
exports.getNodeAfterComment = getNodeAfterComment;