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

"fmt" should be more standard #3246

Open
tlimoncelli opened this issue Dec 13, 2024 · 4 comments
Open

"fmt" should be more standard #3246

tlimoncelli opened this issue Dec 13, 2024 · 4 comments

Comments

@tlimoncelli
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The default formatting for JavaScript that popular code editors use is very different than what dnscontrol fmt generates.

Describe the solution you'd like

fmt should format code like other systems. Our format lost the format wars. Let's accept defeat and be like them.

Also.... I'm sick of sending PRs back to my co-workers who use such editors.

Describe alternatives you've considered
Get new coworkers. (turns out... I like them for other reasons)

Additional context
n/a

@KaiSchwarz-cnic
Copy link
Contributor

KaiSchwarz-cnic commented Dec 13, 2024

prettier is probably the most often used tool for reformatting code and it supports plenty of programming languages.
Still, it is sometimes interesting to identify how to get it peforming nicely side-by-side with the respective linter. There are usually plugins for that purpose.

e.g. prettier + eslint for javascript. Here an guide about the prettier / eslint / vscode combination.

working with git hooks to trigger a pre-commit format check, might be an idea as well (vs. format check on ci level, or having both things in place).

Not sure if that input helps...

@tlimoncelli
Copy link
Contributor Author

I wonder how users would feel if "dnscontrol fmt" just called prettier :-(

@tlimoncelli
Copy link
Contributor Author

CC @jpbede who wrote the original "fmt" command.

@jpbede
Copy link
Contributor

jpbede commented Dec 13, 2024

I'm more than happy to go down the prettier route, considering that jsbeautifier-go isn't maintained since a long time. We just need to think about how we handle the prettier dependency.

Edit: Or we drop the fmt support at all and describe how a user could do it on their own with prettier and pre-commit hooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants