Skip to content

Conversation

@wise-king-sullyman
Copy link
Collaborator

Closes #313

const rule = require('../../../lib/rules/v5/applicationLauncher-updated-params');
const propNames = ['onFavorite', 'onSearch'];

const ruleRunner = (prop) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just do propNames.forEach( (prop) => { directly? so I don't have to wonder what's going on until i scroll to the bottom 😆

Copy link
Collaborator Author

@wise-king-sullyman wise-king-sullyman Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with having some adventure every now and then? 😂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, given the temporary nature of codemods I wonder a bit about extracting these event param tests into a reusable helper function.

I'd typically be against that sort of thing since it decreases test readability, but that tradeoff would probably be worth doing for codemods since we won't be maintaining them long term and it would speed up development.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's set up right and we trust the helpers, it shouldn't reduce readability.. might make sense to have another helper in the tests dir, up to you if you wanna take a shot at that

Copy link
Contributor

@gitdallas gitdallas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-request if you plan to create a test helper, but otherwise lgtm

@wise-king-sullyman
Copy link
Collaborator Author

First swing at a helper added, not my proudest work.... but it gets the job done. WDYT @gitdallas ?

@gitdallas
Copy link
Contributor

gitdallas commented Mar 8, 2023

@wise-king-sullyman - it's very specific, down to the "_event" being hard coded in.. but does the job for reducing a lot of duplicate code in v4-v5 codemods i think. i don't think we need to export the get..Tests functions.

should we then use this for where it can be so far?

@wise-king-sullyman
Copy link
Collaborator Author

Yeah my idea was for it to be a counterpart specifically for the addCallbackParam helper Eric made, which also has the message hardcoded with _event and such. If you think this is too niche though I can see how I can open it up.

@gitdallas
Copy link
Contributor

maybe we'll deal with opening it up if we run into another case down the road. but should we use this where it can be now?

@wise-king-sullyman
Copy link
Collaborator Author

Reverted the helper in this PR and created #334 for the test helper. Once either of these are merged I'll update the other as needed.

@wise-king-sullyman wise-king-sullyman force-pushed the application-launcher-callbacks-updated branch from 186c091 to a0cec06 Compare March 16, 2023 19:32
Copy link
Collaborator

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add to the test.tsx file as well?

@thatblindgeye thatblindgeye requested a review from gitdallas March 17, 2023 12:07
@gitdallas gitdallas merged commit 2617249 into patternfly:main Mar 17, 2023
@wise-king-sullyman wise-king-sullyman deleted the application-launcher-callbacks-updated branch March 17, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Application launcher - warn that an event param has been added to callbacks

3 participants