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(support-info): add options
field
#3433
Conversation
* add `showDeprecated` option * add `showUnreleased` option
Thank you for doing this! Looks good to me, but I'd wait for another review :) |
src/cli-constant.js
Outdated
@@ -386,17 +387,12 @@ const minimistOptions = { | |||
) | |||
}; | |||
|
|||
const usageSummary = ` | |||
Usage: prettier [options] [file/glob ...] | |||
const usageSummary = dedent(` |
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.
Isn’t dedent
supposed to be used as a template tag?
If we can get it in 1.9.2, we wouldn't have to wait another release to do #3352 (since the site's playground only uses the released version) |
src/support.js
Outdated
description: "Which parser to use.", | ||
choices: [ | ||
{ value: "flow", description: "Flow" }, | ||
{ value: "babylon", description: "JavaScript" }, |
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.
Can you reorder flow and babylon? Just to keep the same order from the docs and the playground?
(not that it makes that much difference but still...)
I've started working on the playground rewrite and it's looking pretty good, I have it almost done with preact, with no build steps :-) One of the problems I faced now is when in a PR preview, which version should I pass to (Actually the PR preview changes the package.json to I can't simply append Let me know if I wasn't clear! |
|
@ikatyang that would work. I hope that’s not too hackish though |
74b0503
to
e32ac72
Compare
Anyone wants to do another review? I'd like to merge it and send a followed up PR. |
const previousVersion = testVersions[index - 1]; | ||
const previousInfo = getCoreInfo(previousVersion); | ||
test(`with version ${previousVersion} -> ${version}`, () => { | ||
expect(snapshotDiff(previousInfo, info)).toMatchSnapshot(); |
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.
Neat idea with snapshotDiff!
Unless I'm reading this wrong we now have two copies of each option definition ( |
I have a followed up PR for it, see ikatyang/prettier@feat/support-options...ikatyang:refactor/options, or should I add them in this PR? |
We need to split it into multiple files:
And then expose them as |
That's fine, we should re-declare those flags in the printers that use them. |
src/language-js/index.js
Outdated
@@ -132,6 +133,7 @@ const printers = { | |||
}; | |||
|
|||
module.exports = { | |||
options, |
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.
options
should probably be a property of a specific printer rather than a plugin, as a plugin can provide multiple languages/printers. In this case it should be printers.estree.options
@ikatyang is there anything else to tackle on this PR? |
@duailibe No, the CLI option generation will be in another PR. This one should be good to go. |
This will unblock #3352. cc @duailibe
And I'm going to refactor
options.js
/cli-constant.js
usinggetSupportInfo()
in another PR to address #3350 (comment), #3340 (comment), and #3352 (comment).