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

Pass Dprint options directly from deno.json during deno fmt #26874

Open
Stokestack opened this issue Nov 14, 2024 · 2 comments
Open

Pass Dprint options directly from deno.json during deno fmt #26874

Stokestack opened this issue Nov 14, 2024 · 2 comments
Labels
deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed)

Comments

@Stokestack
Copy link

Stokestack commented Nov 14, 2024

The Deno doc here says,

The formatter can be configured in a deno.json file. You can specify custom rules, plugins, and settings to tailor the formatting process to your needs.

but never says how. But it says the underlying formatter is Dprint, so presumably the above can be accomplished with the Dprint options documented here.

But if you add any of those to deno.json, deno fmt complains.

This needlessly precludes the use of deno fmt for anyone who doesn't like the options it hard-codes outside the tiny subset that's allowed. For example, I can't prevent the formatter from messing up my braces and flow-control statements. But Dprint offers the exact options I want:

"bracePosition": "nextLine",
"nextControlFlowPosition": "nextLine"
@bartlomieju bartlomieju added suggestion suggestions for new features (yet to be agreed) deno fmt Related to the "deno fmt" subcommand or dprint labels Nov 22, 2024
@bartlomieju
Copy link
Member

Full config example can be found here: https://docs.deno.com/runtime/fundamentals/configuration/#formatting.

@Stokestack
Copy link
Author

Thanks, but those are the same options listed in the document I linked to above (although they use camel case instead of hyphens). They are only a tiny subset of the options that Dprint offers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

2 participants