Skip to content

Commit

Permalink
Suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye committed Apr 15, 2024
1 parent 2977e1d commit d127673
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,7 @@ export function getAttributeValue(
if (isExpressionContainer && node.expression.type === "MemberExpression") {
return getMemberExpression(node.expression);
}
if (isExpressionContainer && node.expression.type === "Literal") {
return node.expression.value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
},
],
},
{
code: `import { DrawerContent } from '@patternfly/react-core'; <DrawerContent colorVariant={"no-background"} />`,
output: `import { DrawerContent } from '@patternfly/react-core'; <DrawerContent />`,
errors: [
{
message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`,
type: "JSXOpeningElement",
},
],
},
{
code: `import { DrawerContent } from '@patternfly/react-core'; const color = "no-background"; <DrawerContent colorVariant={color} />`,
output: `import { DrawerContent } from '@patternfly/react-core'; const color = "no-background"; <DrawerContent />`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Rule } from "eslint";
import { JSXOpeningElement, MemberExpression } from "estree-jsx";
import { JSXOpeningElement } from "estree-jsx";
import { getFromPackage, getAttribute, getAttributeValue } from "../../helpers";

// https://github.com/patternfly/patternfly-react/pull/10211
Expand Down Expand Up @@ -78,15 +78,6 @@ module.exports = {
)
);
}

if (!hasNoBackgroundValue && !hasPatternFlyEnum) {
fixes.push(
fixer.replaceText(
colorVariantProp,
`colorVariant="${colorVariantValue}"`
)
);
}
return fixes;
},
});
Expand Down

0 comments on commit d127673

Please sign in to comment.