Skip to content
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

Override option support for plugins #9

Open
IanVS opened this issue Mar 15, 2024 · 7 comments
Open

Override option support for plugins #9

IanVS opened this issue Mar 15, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@IanVS
Copy link

IanVS commented Mar 15, 2024

This might be related to #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.

@fabiospampinato
Copy link
Collaborator

The new CLI is not fully featured just yet, only a few weeks of work has been put into it.

@IanVS
Copy link
Author

IanVS commented Mar 19, 2024

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!

@fabiospampinato
Copy link
Collaborator

@IanVS do you have some kind of repro about this?

@fabiospampinato
Copy link
Collaborator

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 🤔

@IanVS
Copy link
Author

IanVS commented Apr 24, 2024

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.

@fabiospampinato
Copy link
Collaborator

fabiospampinato commented Apr 27, 2024

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 🤔

@fabiospampinato
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants