Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/eslint-plugin-pf-codemods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const rules = {
"application-launcher-rename-dropdownItems": require('./lib/rules/application-launcher-rename-dropdownItems'),
"aria-props": require('./lib/rules/aria-props'),
"global-background-color": require('./lib/rules/global-background-color'),
"modal-remove-footer-alignment": require('./lib/rules/modal-remove-footer-alignment'),
"modal-remove-props": require('./lib/rules/modal-remove-props'),
"modal-variant": require('./lib/rules/modal-variant'),
"no-experimental-imports": require('./lib/rules/no-experimental-imports'),
"progress-remove-info-variant": require('./lib/rules/progress-remove-info-variant'),
Expand Down

This file was deleted.

16 changes: 16 additions & 0 deletions packages/eslint-plugin-pf-codemods/lib/rules/modal-remove-props.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { renameProps } = require('../helpers');

const renames = {
Modal: {
'hideTitle': '',
'isFooterLeftAligned': ''
},
ModalBoxFooter: {
'isFooterLeftAligned': ''
}
};

// https://github.com/patternfly/patternfly-react/pull/4140
module.exports = {
create: renameProps(renames)
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ const renames = {
'isCompactNav': '',
'inPage': '',
'isFullWidth': '',
'isFullHeight': ''
'isFullHeight': '',
'inPage': ''
}
};

// https://github.com/patternfly/patternfly-react/pull/4142
// https://github.com/patternfly/patternfly-react/pull/4116
// https://github.com/patternfly/patternfly-react/pull/4140
// https://github.com/patternfly/patternfly-react/pull/4142
module.exports = {
create: renameProps(renames)
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const ruleTester = require('./ruletester');
const rule = require('../../lib/rules/modal-remove-props');

ruleTester.run("modal-remove-props", rule, {
valid: [
{
code: `import { Modal } from '@patternfly/react-core'; <Modal />`,
},
{
// No @patternfly/react-core import
code: `<Modal isFooterLeftAligned hideTitle />`,
}
],
invalid: [
{
code: `import { Modal } from '@patternfly/react-core'; <Modal isFooterLeftAligned />`,
output: `import { Modal } from '@patternfly/react-core'; <Modal />`,
errors: [{
message: `isFooterLeftAligned prop for Modal has been removed`,
type: "JSXOpeningElement",
}]
},
{
code: `import { Modal } from '@patternfly/react-core'; <Modal hideTitle />`,
output: `import { Modal } from '@patternfly/react-core'; <Modal />`,
errors: [{
message: `hideTitle prop for Modal has been removed`,
type: "JSXOpeningElement",
}]
},
]
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ ruleTester.run("wizard-remove-props", rule, {
message: `isFullWidth prop for Wizard has been removed`,
type: "JSXOpeningElement",
}]
},
{
code: `import { Wizard } from '@patternfly/react-core'; <Wizard inPage />`,
output: `import { Wizard } from '@patternfly/react-core'; <Wizard />`,
errors: [{
message: `inPage prop for Wizard has been removed`,
type: "JSXOpeningElement",
}]
}
]
});
9 changes: 5 additions & 4 deletions packages/pf-codemods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,18 @@ Out:
<Label >Label</Label>
```

### modal-remove-footer-alignment [(#4017)](https://github.com/patternfly/patternfly-react/pull/4017)
Removed prop `isFooterLeftAligned` from Modal and ModalBoxFooter.
### modal-remove-props [(#4017)](https://github.com/patternfly/patternfly-react/pull/4017)
- Removed props `isFooterLeftAligned` and `isFooterLeftAligned` from Modal and ModalBoxFooter.
- Removed prop `hideTitle` from Modal. To hide the Modal header, do not pass a title prop, a description prop, or a header prop. If there is no title or header passed, please provide an aria-label prop to the Modal component to make it accessible.

#### Examples
In:
```jsx
<Modal isFooterLeftAligned />
<Modal isFooterLeftAligned hideTitle />
```
Out:
```jsx
<Modal />
<Modal />
```

### modal-variant [(#3920)](https://github.com/patternfly/patternfly-react/pull/3920)
Expand Down