@yandex/ui
Version:
Yandex UI components
17 lines (16 loc) • 679 B
JavaScript
module.exports.findDeprecatedImport = (root, j, library, valueImport, message) => {
root.find(j.ImportDeclaration)
// Find only library NodePaths
.filter((nodePath) => {
return nodePath.value.source.value.startsWith(library);
})
.forEach((nodePath) => {
const specifiers = nodePath.value.specifiers || [];
const cleanedImports = specifiers.filter((s) => {
return s.imported.name.includes(valueImport);
});
if (cleanedImports.length) {
console.warn(`Найден импорт ${valueImport} из ${library}.\n${message}`);
}
});
};