-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Error on unsupported CLI arguments #2623
Conversation
@mnsn Can I ask why did you close this PR? I was thinking about solving the issue you mentioned. |
The unit tests failed I need to check what I broke |
Sure. Please let me know if I can help - I'd be really happy to fix this issue. |
I fixed the issues, thank you for the offering Chris. |
# Conflicts: # src/reporters/lang/en.js
Hey, @mnsn. However allowing unsupported flags is a feature, this way Yarn achieves forwards compatibility, e.g. a new flag is used in a build system but not whole organization has updated to using the new version. How about we just print a warning when flag is unrecognized? Sorry for a delay in review, the title did was not inviting very much :) |
Closing for now, looking for people to give it another go |
I'd like to take a look at this. I can base myself on the original code from this PR, but change it to warn instead of error? |
@jseminck, yep, give it a try |
I had a look into this issue, and it seems rather hard. First of all, I noticed yarn doesn't use the most recent version of The only way I see to get the array of unknown options from However, yarn has some special logic to deal with an issue in That means that to listen to the correct command event, we'd need to listen to: commander.on('this-arg-will-get-stripped-later', (args, unknown) => {
console.log('unknown', unknown);
)) But listening to a specific command in This all seems to make things rather more complicated inside My suggestion would be to make a PR to Then in WDYT? |
Summary
I fixed issue #2600 , by listening to the commander event emitter and exit with error when unknown flag is been added