Fantomas rejuvenated

Introduction

As part of the F# mentorship program my mentor Anthony Lloyd and I have been working on the Fantomas project.
Fantomas is like prettier or elm-format but for F#.
It was originally created by Anh-Dung Phan and people have suggested that it could be a part of the
F# Compiler Service.

Fantomas is like prettier or elm-format but for F#.

.NET Core

The source code of Fantomas is quite advanced so our approach is to focus first on improving the project in general. We noticed it was a bit old in terms of Visual Studio version and dependencies, so we organized the move to .NET Core.

The port had its challenges but in the end, we were able to release dotnet-fantomas.

Test drive

NuGet

Added the following code to your fsproj

<ItemGroup>  
    <DotNetCliToolReference Include="dotnet-fantomas" Version="2.7.1" />
</ItemGroup>  

Execute dotnet restore and you should be able to run dotnet fantomas YourFile.fs.
Check out dotnet fantomas --help for more options.

Paket

Add clitool dotnet-fantomas 2.7.1 to your paket.dependencies.
Add dotnet-fantomas to your paket.references.

Execute .paket\paket.exe install and dotnet fantomas YourFile.fs should work as well.

We need your help

Fantomas still has room for improvement. If we each format one source file and raise an issue on github if things go south, we'd have all the usage coverage we need.

There are still scenarios were the formatting will fail or introduce compile errors. The more concrete examples we have, the easier it is to fix bugs.

Please dear community, give it a spin and write a detailed issue if necessary. Tell us what went wrong, what you'd expected, what framework version you used, why it should format differently, ...

If we each format one source file and raise an issue on github if things go south, we'd have all the usage coverage we need.

Ping us on the F# Slack, any feedback is most welcome.

Final words

I hope you enjoyed this NuGet package and can use it in your F# workflow.

Yours truly,
nojaf

unsplash-logoPhoto by Annie Spratt

Florian Verdonck
Florian Verdonck

Florian Verdonck is web & .NET developer. He is passionate about clean code and is eager to learn new technologies.