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

Change bunfig.toml to bun.json #1805

Open
Tracked by #2450
Jarred-Sumner opened this issue Jan 16, 2023 · 10 comments
Open
Tracked by #2450

Change bunfig.toml to bun.json #1805

Jarred-Sumner opened this issue Jan 16, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@Jarred-Sumner
Copy link
Collaborator

No description provided.

@Electroid Electroid added the enhancement New feature or request label Jan 16, 2023
@Electroid Electroid changed the title Change bunfig.toml to bunfig.json Change bunfig.toml to bun.json Jan 31, 2023
@Zeko369
Copy link
Contributor

Zeko369 commented Apr 26, 2023

I'm really interested in the reasoning here (any tweet threads / notes on why)?

Or is it just familiarity in the JS ecosystem + easier schema/autocomplete? (not sure if there is a JSON-schema TOML equivalent)

@b-fett
Copy link

b-fett commented Oct 9, 2023

Actually, when i installed bun extension in vscode, i also expected autocompletions for configuration file.

And for json it's made quite simple: https://code.visualstudio.com/api/references/contribution-points#contributes.jsonValidation

@00dani
Copy link

00dani commented Oct 21, 2023

The JSON Schema format can actually be used to specify TOML (and YAML) configuration files as well with no major issues, since the data structures being described are close enough to being the same.

For example, Starship's TOML configuration file comes with an associated schema, and that schema can be used to validate and autocomplete your configuration with the appropriate tooling in your editor. Similarly there are a range of schemata available for YAML configuration files such as kustomization.yaml and yamllint.yaml.

Providing a suitable JSON Schema for bunfig.toml should enable the autocompletion @b-fett was hoping for, without needing to actually change the configuration format to JSON if TOML is still preferred for its human-friendliness. 🐱

@mnpenner
Copy link

Does this schema exist yet? (Came here from Google looking for one)

@silverwind
Copy link

How about a code config file? bun.config.ts / bun.config.js. Very flexible but it could present a chicken-and-egg problem 😆.

@Electroid
Copy link
Contributor

How about a code config file? bun.config.ts / bun.config.js. Very flexible but it could present a chicken-and-egg problem 😆.

We generally want to avoid any config which has to be interpreted/executed (for instance, JavaScript). That's because it will increase startup time.

@mnpenner
Copy link

mnpenner commented Mar 14, 2024 via email

@jasongitmail
Copy link

jasongitmail commented Mar 14, 2024

Looks like they have a good reason to stick with what they have.

But to disagree with the comment above, more and more JS tooling now allows for js/ts configs (e.g. eslint & prettier enabled it recently, Playwright, Jest, framework configs, etc). The benefit of JS/TS is easier reuse of a common config among multiple projects, to provide consistency across projects within an organization, bc they can be exported and imported easily. As opposed to needing to copy & paste and then having them eventually become inconsistent across repos. This is a big benefit.

@silverwind
Copy link

silverwind commented Mar 14, 2024

Another benefit of TS/JS config is that it enables easily shareable configs via npm package.

@silverwind
Copy link

silverwind commented Mar 16, 2024

Let me also give a concrete example why bun.config.ts is needed: In Vitest, I like to configure the snapshot directory path via resolveSnapshotPath function. While bun does not have this option yet, it would never be possible to do with a non-code config format.

.config.ts files are already a quasi-standard among modern JS/TS tooling, and I definitely think bun should follow too.

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

No branches or pull requests

8 participants