-
Notifications
You must be signed in to change notification settings - Fork 485
Fix args regression: readme --shallow --format (Invalid second argument) #968
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
Fix args regression: readme --shallow --format (Invalid second argument) #968
Conversation
Fingers crossed this get traction soon! 😁 |
src/commands/readme.js
Outdated
alias: 'q', | ||
describe: 'Quiet mode: do not print messages or README diff to stdout.', | ||
default: false | ||
module.exports.builder = _.assign( |
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.
Why lodash and not Object.assign?
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.
To be consistent with how sharedOptions
were applied in serve.js
.
Thanks for pointing it out!
I checked http://node.green/#ES2015-built-in-extensions-Object-static-methods-Object-assign and can see that it is indeed supported since node@4
(which this project already requires), so I added a commit now to replace all _.assign()
with Object.assign()
.
package.json
Outdated
@@ -101,7 +101,7 @@ | |||
"scripts": { | |||
"build": "rm -rf lib && babel -D src -d lib && npm run doc", | |||
"release": "standard-version", | |||
"precommit": "lint-staged --verbose", | |||
"precommit": "DEBUG=lint-staged* lint-staged", |
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.
It is doesn't work for me. I agree that --verbose option is deprecated but in version 6.
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.
Yes, and to me it seems to possibly have happened even earlier :) Good thing you updated the dependency now! I'll leave your change to the precommit
run-script.
remove superfluous usage string. yargs@>=7 throws exceptions on incorrectly structured builder objects.
This makes --shallow and --format work again.
a5f0b05
to
1d33435
Compare
@anthony-redFox I get this flow error now in
It seems it's because flow can't be sure documentation/src/infer/params.js Line 104 in 37d188a
I'm hesitant to override the error message, because I don't know enough about the program to understand if it's a genuine possible bug. Do you know if it could ever return an Array in that case? Should I simply cast like this? case 'ObjectProperty': {
return Object.assign(
((paramToDoc(
param.value,
prefix + '.' + param.key.name || param.key.value
): any): CommentTag),
{
name: prefix + '.' + param.key.name || param.key.value
}
);
} |
Added the flow override for the time being. Merge only if you agree. (It doesn't change how the code works. Only keeps hiding it like lodash used to do.) |
I'm fine with the Flow override in this case. Really wish I hadn't allowed some of these methods to return such different values, makes working with Flow lamer. Something to fix up in the future. |
Thanks, @tmcw |
@hugojosefson Thanks. |
There was a regression regarding arguments, introduced in
[email protected]
(227db1c) when theyargs
dependency was upgraded inpackage.json
from^6.0.1
to^9.0.1
.yargs@7
is more strict on correctness of how it's used, which is what caused the errorYError: Invalid second argument. Expected object but received string.
This PR fixes that, and updates
yarn.lock
based onpackage.json
because that hadn't been done in a while.Now
documentation readme --shallow --format=....
works again.Fixes #959.
Similar to PR #953.