Tools: Default project config location

Created on 28 Jul 2020  路  5Comments  路  Source: rome/tools

I'm writing the docs and right now we recommend an .rjson file for the project config. I'm not totally sold on this and want us to consider the following two options, if anything so we can rule them out:

  • Defaulting to package.json
  • Force rome.r?json files to be inside of a .config directory. Many tools support this although I would propose forcing it if we decide to support it. We can pave the cowpath for the JS ecosystem.

Main motivation for this is that the root of projects has become extremely cluttered for most projects. Scanning project structure is difficult since you need to mentally filter out all the dot files.

All 5 comments

Just chiming in with my support for placing config in .config. I did this recently for a personal project of mine (https://www.npmjs.com/package/@boost/config) and I believe it to be a good standard for JS projects going forward. Will help to reduce project root clutter.

As long as the config isn't directory-specific (in which case, a config file directly in the directory makes the most sense), that would work fine. However, it might be nice to have config able to live in two places: either directly in package.json, or, in a path that might default to .config/rome.rjson. That way users get to choose for themselves where they want it to live.

Right now the possible locations are:

  • rome field in package.json
  • rome.json and rome.rjson in the project base

I'm proposing it be changed to only:

  • rome field in package.json
  • .config/rome.json and .config/rome.rjson in the project base

We automatically discover the project config so it has to be in one of these hardcoded locations. Although with extends in package.json you could put the config pretty much anywhere:

package.json

{
  "rome": {
    "extends": "some-other-page/config.json"
  }
}

I like the idea of having .config/rome.json/.config/rome.rjson; the name of the folder tells what's that about.

I would discourage the use of the package.json because some projects would already have a big file (deps, devDeps, other configuration from other libs, etc.) and this would increase the size and lower the readability of the file.

馃帀

You heard it here first I even tagged @babeljs! 馃槈

(I wish I could _actually_ take credit for this being added to Rome, but glad to see it happen. I hope it paves the way for more tools to follow suit!)

Was this page helpful?
0 / 5 - 0 ratings