rome / tools

Unified developer tools for JavaScript, TypeScript, and the web
https://docs.rome.tools/
MIT License
23.83k stars 666 forks source link

📎 Running `rome check` or `rome format` should default to project root as the directory #3326

Open sebmck opened 1 year ago

sebmck commented 1 year ago

Description

Right now you need to be explicit about the directory you want to operate on. I think this should either use the project root (where rome.json is) and failing that use the closest directory with a package.json.

ematipico commented 1 year ago

I think we have to carefully study the different cases.

While this suggestion makes sense, there are other cases that we need to take into consideration and subtle details that usually the user doesn't care, but we have to.

An example is our repository, where we have scattered package.json across the repository, but we have one rome.json at the root of the repository. Also, each package.json have different scripts that format they own folders. To note that our repository is not a monorepo.

Another use case to take into consideration is that our CLI might use the daemon, which means that we have to tell the daemon where's the project root, because the project root of the daemon is certainly not the one where the CLI command was executed.

We already had in mind to change how the resolution of the configuration would work: interrogate its ancestors until it find one. This would cover the majority of the cases, including the one we have in our repository. Another thing we had in mind is to change our FileSystem behaviour and increase its awesomeness of the project root, but this would require some refactor.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 14 days with no activity.