Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (tree: Tree) => {
visitTSSourceFiles(tree, sourceFile => {
let changes: ReplaceChange[] = [];
ts.forEachChild(sourceFile, function findDecorator(node) {
if (!ts.isDecorator(node)) {
ts.forEachChild(node, findDecorator);
return;
}
ts.forEachChild(node, function findImports(node) {
if (
ts.isPropertyAssignment(node) &&
ts.isArrayLiteralExpression(node.initializer) &&
ts.isIdentifier(node.name) &&
node.name.text === 'imports'
) {
node.initializer.elements
.filter(ts.isIdentifier)