fantomas
fantomas copied to clipboard
Move editor config to library rather than tool
In consumers such as Myriad, it would be nice if we could automatically read the editorconfig appropriate to the files we want to write out, and use that directly, rather than writing out with no config and then forcing the user to reformat with a manual invocation of fantomas
.
This would be pretty easy to do, I'd say: we just need to move the EditorConfig
files to Fantomas.Core, so that consumers can use them.
Definition of done: a user can call EditorConfig.readConfiguration
, after having automatically located the correct .editorconfig
file using the same mechanism that Fantomas uses.
I'd be happy to implement this if we think it's desirable.
Pros and Cons
The advantages of making this adjustment to Fantomas are:
- the user doesn't have to manually run
fantomas
after a Myriad invocation.
The disadvantages of making this adjustment to Fantomas are:
- more chance for the embedded Fantomas in the downstream tool (like Myriad) to be backward-incompatible with the Fantomas expected in the workspace;
- bloat of the Fantomas library, including a reference to the
editorconfig
NuGet package.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): XS
Affidavit (please submit!)
Please tick this by placing a cross in the box:
- [x] I have read the Contribution Guidelines.
- [x] I have searched both open and closed suggestions on this site and believe this is not a duplicate
Please tick all that apply:
- [x] This is not a breaking change to Fantomas
- [x] I or my company would be willing to help implement and/or test this
Hi there,
First reaction: I'm against this. I don't think it is worth it.
Why would you want to format the generated code? I would just ignore it via .fantomasignore
file.
Or course, since Fantomas.Client
, having the extra dependency might not be the end of the world.
I'm gonna let @dawedawe and @josh-degraw decide on this one! No pressure lads.
Fair enough - it's just an aesthetic preference, nothing more! Happy to close if you like.
Yeah I'm inclined to agree with Florian at least about the case where generated files should be ignored. But I can totally see value in having the editorconfig parser available outside the tool fwiw. But right now I'd say without a stronger use case I'd prefer to leave things as they are.
Hey, sorry for the late reply, I took a few days off from GitHub. The cons are stronger for me, too.
Alright, let's leave this one open for a while. Maybe some other real-world use-cases show up.
Happy to close it as won't-fix!