diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts index 745e49bca..e7c114f94 100644 --- a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts @@ -145,5 +145,44 @@ ruleTester.run("emptyState-nonExported-components", rule, { }, ], }, + // We want to ensure the rule only gets thrown for the applicable components + { + code: `import { EmptyStateHeader, SomeOtherThing } from '@patternfly/react-core';`, + output: `import { EmptyStateHeader, SomeOtherThing } from '@patternfly/react-core';`, + errors: [ + { + message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`, + type: "ImportSpecifier", + }, + ], + }, + { + code: `import { EmptyStateHeader } from '@patternfly/react-core';export default EmptyStateHeader;`, + output: `import { EmptyStateHeader } from '@patternfly/react-core';`, + errors: [ + { + message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`, + type: "ImportSpecifier", + }, + { + message: `EmptyStateHeader is no longer exported by PatternFly.`, + type: "ExportDefaultDeclaration", + }, + ], + }, + { + code: `import { EmptyStateHeader, SomeOtherThing } from '@patternfly/react-core';export { EmptyStateHeader, SomeOtherThing };`, + output: `import { EmptyStateHeader, SomeOtherThing } from '@patternfly/react-core';export { SomeOtherThing };`, + errors: [ + { + message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`, + type: "ImportSpecifier", + }, + { + message: `EmptyStateHeader is no longer exported by PatternFly.`, + type: "ExportNamedDeclaration", + }, + ], + }, ], }); diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts index 8a197ac84..a49ee15d9 100644 --- a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts @@ -28,7 +28,12 @@ module.exports = { return { ImportSpecifier(node: ImportSpecifier) { - if (!emptyStateImports.length) { + if ( + !emptyStateImports.length || + !emptyStateImports + ?.map((imp) => imp.imported.name) + .includes(node.imported.name) + ) { return; } diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemWarnUpdateMarkup/toolbarItem-warn-update-markup.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemWarnUpdateMarkup/toolbarItem-warn-update-markup.ts index 12d834165..192c4057e 100644 --- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemWarnUpdateMarkup/toolbarItem-warn-update-markup.ts +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemWarnUpdateMarkup/toolbarItem-warn-update-markup.ts @@ -30,7 +30,6 @@ module.exports = { const variantValue = getAttributeValue(context, variant.value); - console.log(variantValue); if ( (variant.value.type === "Literal" && variantValue === "chip-group") ||