Skip to content

Conversation

vinomanick
Copy link
Contributor

@vinomanick vinomanick commented Jul 6, 2020

#88

Copy link
Owner

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

This seems like a good thing to do, thanks for working on it!

Comment on lines 25 to 37
function extractJSCodeShiftOptions(options, codeShiftOptions = jsCodeShiftOptions) {
let cliOptions = Object.assign({}, options);
let jsCodeShiftOptions = [];
codeShiftOptions.forEach(option => {
if (Object.prototype.hasOwnProperty.call(cliOptions, option)) {
let camelCaseOption = option.replace(/-([a-z])/g, (_, up) => up.toUpperCase());
jsCodeShiftOptions.push(`--${option}`, options[option]);
delete cliOptions[option];
delete cliOptions[camelCaseOption];
}
});
return { cliOptions, jsCodeShiftOptions };
}
Copy link
Owner

Choose a reason for hiding this comment

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

I think I'd prefer to do this all in parseTransformArgs, and ahve that essentially return { paths, options, transformerOptions } or something like that.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, this is my first open-source contribution that's why I was little hesitant towards altering the existing function and breaking the existing flow. Anyways, I have incorporated the changes in the parseTransformArgs itself.
Kindly have a look and let me know if this is okay.

@vinomanick vinomanick requested a review from rwjblue July 15, 2020 06:15
@rwjblue
Copy link
Owner

rwjblue commented Jul 15, 2020

I just landed a fairly big refactor from @simonihmig, would you mind rebasing on top of that work? I think it shouldn't dramatically affect what you have done here, but I just want to make sure CI is happy with the two changes together before landing.

Also, we need to probably figure out how to do the parsing a bit better in general (instead of using yargs.parse(), we could provide the explicit options or something), but that is definitely an issue for another time...

@vinomanick
Copy link
Contributor Author

I have rebased with the master and things look good. Will try to create a new PR to address the parsing.

Copy link
Owner

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Thank you!

@rwjblue rwjblue added the enhancement New feature or request label Aug 4, 2020
@rwjblue rwjblue changed the title Added support for jscodeshift ignore options Added support for accepting jscodeshift ignore options (e.g. --ignore-config and --ignore-pattern) Aug 4, 2020
@rwjblue rwjblue merged commit d4ffcf3 into rwjblue:master Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants