Skip to content

Commit baef409

Browse files
authored
feat(ExpandableSection): Remove isActive prop (#822)
* feat(ExpandableSection): remove isActive prop * mimic output and test other imports
1 parent 78f08a8 commit baef409

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### expandableSection-remove-isActive-prop [(#9881)](https://github.com/patternfly/patternfly-react/pull/9881)
2+
3+
The `isActive` prop has been removed from ExpandableSection.
4+
5+
#### Examples
6+
7+
In:
8+
9+
```jsx
10+
%inputExample%
11+
```
12+
13+
Out:
14+
15+
```jsx
16+
%outputExample%
17+
```
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const ruleTester = require("../../ruletester");
2+
import * as rule from "./expandableSection-remove-isActive-prop";
3+
4+
ruleTester.run("expandableSection-remove-isActive-prop", rule, {
5+
valid: [
6+
{
7+
code: `<ExpandableSection isActive />`,
8+
},
9+
{
10+
code: `import { ExpandableSection } from '@patternfly/react-core'; <ExpandableSection someOtherProp />`,
11+
},
12+
],
13+
invalid: [
14+
// importing from react-core
15+
{
16+
code: `import { ExpandableSection } from '@patternfly/react-core'; <ExpandableSection isActive />`,
17+
output: `import { ExpandableSection } from '@patternfly/react-core'; <ExpandableSection />`,
18+
errors: [
19+
{
20+
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
21+
type: "JSXOpeningElement",
22+
},
23+
],
24+
},
25+
// importing from dist/dynamic
26+
{
27+
code: `import { ExpandableSection } from '@patternfly/react-core/dist/dynamic/components/ExpandableSection'; <ExpandableSection isActive />`,
28+
output: `import { ExpandableSection } from '@patternfly/react-core/dist/dynamic/components/ExpandableSection'; <ExpandableSection />`,
29+
errors: [
30+
{
31+
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
32+
type: "JSXOpeningElement",
33+
},
34+
],
35+
},
36+
// importing from dist/esm
37+
{
38+
code: `import { ExpandableSection } from '@patternfly/react-core/dist/esm/components/ExpandableSection'; <ExpandableSection isActive />`,
39+
output: `import { ExpandableSection } from '@patternfly/react-core/dist/esm/components/ExpandableSection'; <ExpandableSection />`,
40+
errors: [
41+
{
42+
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
43+
type: "JSXOpeningElement",
44+
},
45+
],
46+
},
47+
// importing from dist/js
48+
{
49+
code: `import { ExpandableSection } from '@patternfly/react-core/dist/js/components/ExpandableSection'; <ExpandableSection isActive />`,
50+
output: `import { ExpandableSection } from '@patternfly/react-core/dist/js/components/ExpandableSection'; <ExpandableSection />`,
51+
errors: [
52+
{
53+
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
54+
type: "JSXOpeningElement",
55+
},
56+
],
57+
},
58+
],
59+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { renameProps } from "../../helpers";
2+
3+
// https://github.com/patternfly/patternfly-react/pull/9881
4+
module.exports = {
5+
meta: { fixable: "code" },
6+
create: renameProps({
7+
ExpandableSection: {
8+
isActive: {
9+
newName: "",
10+
message: "The `isActive` prop has been removed from ExpandableSection.",
11+
},
12+
},
13+
}),
14+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ExpandableSection } from "@patternfly/react-core";
2+
3+
export const ExpandableSectionRemoveIsActivePropInput = () => <ExpandableSection isActive />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { ExpandableSection } from "@patternfly/react-core";
2+
3+
export const ExpandableSectionRemoveIsActivePropInput = () => (
4+
<ExpandableSection />
5+
);

0 commit comments

Comments
 (0)