diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts index b7b1d1715..5ecff18af 100644 --- a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts @@ -150,5 +150,25 @@ ruleTester.run('chip-replace-with-label', rule, { `, errors: [chipImportError], }, + // with isReadOnly prop + { + code: `import { Chip, ChipGroup } from '@patternfly/react-core/deprecated'; + <> + + + This is a chip + + + `, + output: `import { Label, LabelGroup } from '@patternfly/react-core'; + <> + + + + `, + errors: [chipImportError], + }, ], }); diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts index 10b7bd154..0427de1d9 100644 --- a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts @@ -69,6 +69,12 @@ const renameOnClickAttribute = (node: JSXElement, fixer: Rule.RuleFixer) => { : []; }; +const removeIsReadOnlyProp = (node: JSXElement, fixer: Rule.RuleFixer) => { + const isReadOnlyProp = getAttribute(node, "isReadOnly"); + + return isReadOnlyProp ? [fixer.replaceText(isReadOnlyProp, "")] : []; +}; + // https://github.com/patternfly/patternfly-react/pull/10049 module.exports = { meta: { fixable: 'code' }, @@ -199,6 +205,7 @@ module.exports = { ' variant="outline"' ), ...renameOnClickAttribute(node, fixer), + ...removeIsReadOnlyProp(node, fixer), ...(node.closingElement ? [ ...moveBadgeAttributeToBody(node, fixer, context),