Override option support for plugins
This might be related to https://github.com/prettier/prettier-cli/issues/5, but I found that while my plugin does work with the latest version of this CLI, override plugin options do not. It seems that normalizeFormatOptions has a strict allowlist of option names, so any that my plugin adds are stripped out. Is that intentional? FWIW, it seems to be working fine in prettier 3.x.
The new CLI is not fully featured just yet, only a few weeks of work has been put into it.
No judgement! Just wasn't sure if it was intentional or not, so I knew how to proceed with some of my plugin work.
Thanks!
@IanVS do you have some kind of repro about this?
Slightly unrelated, but apparently if plugins are not listed via the --plugin flag their flags won't be not picked up by the cli, which seems tricky to fix well, in general, as there could be .prettierrc files anywhere in the repo, crawling potentially a huge directory just to build up the help page seems excessive 🤔
I was traveling but am back now, do you still need a repro? And I think it's probably fine not to show plugin options in help, personally. It's not something I would really expect to find in a cli help.
I was traveling but am back now, do you still need a repro?
If you have one it would be good as I could check if I actually fixed your issue.
And I think it's probably fine not to show plugin options in help, personally. It's not something I would really expect to find in a cli help.
Today if the plugin is specified via the --plugin flag the help page is correctly populated with its options, which is nice but more importantly the CLI has an internal mechanism for detecting unsupported flags. If some plugins options are not in the help page then the CLI just sees them as unknown and probably errors, that's the bigger concern 🤔
I think this commit should fix the problem. Let's wait until -beta.0 is released and then it'd be useful if you could check if the problem is fixed for you.
Hi, has a beta been released that I can try this out in, yet?
@IanVS sorry for the delay, this was released as v4.0.0-alpha.9 ~2 months ago. Could you double check that it fixes the problem for you please?
I tested out the latest 4.0.0-alpha.10, and it does indeed now work as I'd expect, thanks!