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 :) |
|
|
||
| const usageSummary = ` | ||
| Usage: prettier [options] [file/glob ...] | ||
| const usageSummary = dedent(` |
There was a problem hiding this comment.
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) |
| description: "Which parser to use.", | ||
| choices: [ | ||
| { value: "flow", description: "Flow" }, | ||
| { value: "babylon", description: "JavaScript" }, |
There was a problem hiding this comment.
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(); |
|
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. |
| }; | ||
|
|
||
| module.exports = { | ||
| options, |
There was a problem hiding this comment.
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.jsusinggetSupportInfo()in another PR to address #3350 (comment), #3340 (comment), and #3352 (comment).