UNPKG

@mui/codemod

Version:
21 lines (20 loc) 695 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = transformer; /** * @param {import('jscodeshift').FileInfo} file * @param {import('jscodeshift').API} api */ function transformer(file, api, options) { const j = api.jscodeshift; const printOptions = options.printOptions; return j(file.source).findJSXElements('InputLabel').forEach(path => { path.node.openingElement.attributes.forEach(node => { if (node.type === 'JSXAttribute' && node.name.name === 'size' && (node.value.value === 'normal' || node.value.expression?.value === 'normal')) { node.value = j.literal('medium'); } }); }).toSource(printOptions); }