-
Notifications
You must be signed in to change notification settings - Fork 20
feat(DataList): added event param to callback #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(DataList): added event param to callback #306
Conversation
| })), | ||
| ...onToggleAPIUpdateList.map((component) => ({ | ||
| code: `import { ${component} } from '@patternfly/react-core'; const onToggle = (isOpen) => {}; <${component} onToggle={onToggle} />;`, | ||
| output: `import { ${component} } from '@patternfly/react-core'; const onToggle = (_event, isOpen) => {}; <${component} onToggle={onToggle} />;`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@gitdallas for now I ust copy+pasted the logic from the onToggle codemod to the DataList one. I can do something similar to my other 2 open PRs. Figure we can create a possible helper as a followup. |
gitdallas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall this is awesome, a few comments/nits
packages/eslint-plugin-pf-codemods/lib/rules/v5/dataList-updated-callback.js
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-pf-codemods/lib/rules/v5/dataList-updated-callback.js
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-pf-codemods/lib/rules/v5/onToggle-updated-paramaters.js
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-pf-codemods/lib/rules/v5/dataList-updated-callback.js
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-pf-codemods/test/rules/v5/onToggle-updated-paramaters.js
Outdated
Show resolved
Hide resolved
wise-king-sullyman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is like magic
|
@gitdallas @wise-king-sullyman refactored the logic in both codemods as a (currently very basic, specific) helper function. Should be a lot easier for similar codemods for adding that "event" param (or any param really, as long as its meant to be the first one). Figure this could be a building block for more flexible things down the line |
wise-king-sullyman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 🔥 🔥 🔥 🔥
gitdallas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏆

Closes #289, closes #295
The update made to SelectableRowObject in the linked PR for this codemod shouldn't be needed here, as patternfly/patternfly-react#8423 will require a codemod that will handle that.
Also made an update to the onToggle codemod similar to this.