Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

why oh why does npm create cloudflare create a wrangler.jsonc file?! #3549

Closed
samuelcolvin opened this issue Feb 14, 2025 · 1 comment
Closed

Comments

@samuelcolvin
Copy link

I'm really struggling to understand why npm create cloudflare@latest creates a wrangler.jsonc file, not wrangler.toml?

  • cloudflare workers have been promoting wrangler.toml for years
  • it's the default in your docs
  • it's much the most common on github (24k files called wrangler.toml, 1.4k called wrangler.json, 98 called wrangler.jsonc)
  • JSON with comments is a non-standard format - where's the spec, where's the parser for every language
  • (subjectively) it's much uglier and harder to read or edit

Surely just do the obvious thing and create a wrangler.toml file?

Also while I'm at it:

  • seems a bit odd to create a .editorconfig, they're pretty uncommon in repos these days
  • surely it would be cleaner to put the prettier config in package.json, not a separate file

@mikenomitch I'll keep pointing out these DX footguns until you block me 😉 .

@Cherry
Copy link
Contributor

Cherry commented Feb 15, 2025

I tend to agree re: wrangler.jsonc. While I applaud wrangler supporting more config formats, toml has been the standard for such a long time across blogs, third-party tutorials, video series, etc. going back until wrangler v1 in 2019, including Cloudflare's own videos like their popular "Workers 101" course: https://youtu.be/H7Qe96fqg1M?t=1532.

re: .editorconfig though, this is a very useful file. Not only can you define end_of_line and many editors will follow it (as well as it Github's UI), which is really nice in teams that work across Windows + Linux, but more importantly you can define indent_style. Lots of Cloudflare repos use tabs for indentation because they're objectively the right choice, so it's nice to be able to configure this easily across the board, but then also override yaml or other files that use inaccessible whitespace back to spaces. A common .editorconfig might look like this:

# https://editorconfig.org
root = true

[*]
end_of_line = lf
indent_style = tab

[*.{yml,yaml}]
indent_style = space
indent_size = 2

PS. This would probably make more sense in the workers-sdk repo: https://github.com/cloudflare/workers-sdk

@cloudflare cloudflare locked and limited conversation to collaborators Feb 15, 2025
@jasnell jasnell converted this issue into discussion #3559 Feb 15, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants