UNPKG

@putout/plugin-madrun

Version:

🐊Putout plugin adds ability to transform madrun scripts

30 lines (21 loc) 715 B
import {operator} from 'putout'; const { getExportDefault, getProperty, } = operator; export const report = () => `Call 'await cutEnv(script)' instead of 'script'`; export const replace = () => ({ '[__a, __b]': '[__a, cutEnv(__b)]', }); export const match = () => ({ '[__a, __b]': ({__b}, path) => { const exportDefault = getExportDefault(path); if (!exportDefault) return false; if (path.parentPath.isCallExpression()) return false; const declarationPath = exportDefault.get('declaration'); const property = getProperty(declarationPath, __b.value); return Boolean(property); }, });