Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye committed May 23, 2024
1 parent 4c32f47 commit 8f72511
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,33 @@ ruleTester.run("emptyState-nonExported-components", rule, {
},
],
},
{
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 as CustomHeader } from '@patternfly/react-core';export default CustomHeader;`,
output: `import { EmptyStateHeader as CustomHeader } 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: `CustomHeader is no longer exported by PatternFly.`,
type: "ExportDefaultDeclaration",
},
],
},
],
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Rule } from "eslint";
import {
ImportSpecifier,
ExportSpecifier,
ExportNamedDeclaration,
ExportDefaultDeclaration,
} from "estree-jsx";
Expand Down Expand Up @@ -97,9 +96,7 @@ module.exports = {
const exportName =
node.declaration.type === "Identifier" && node.declaration.name;
const isEmptyStateDefaultExport = emptyStateImports.some(
(imp) =>
node.declaration.type === "Identifier" &&
imp.local.name === exportName
(imp) => imp.local.name === exportName
);

if (isEmptyStateDefaultExport) {
Expand Down

0 comments on commit 8f72511

Please sign in to comment.