Closed Mersho closed 9 months ago
Make sure favourStaticEmptyFields is enabled in fsharplint.json.
FSharpLint suggests using List.Empty, which is wrong since it's not a List. Instead, it should suggest using Array.empty.
List.Empty
Array.empty
dotnet fsharplint lint ..\ConsoleApp\ConsoleApp\ConsoleApp.fsproj
ConsoleApp.fsproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net5.0</TargetFramework> <WarnOn>3390;$(WarnOn)</WarnOn> </PropertyGroup> <ItemGroup> <Compile Include="Program.fs" /> </ItemGroup> </Project>
Program.fs
open System printfn "%A" [| 1; 2; 3 |] printfn "%A" [||]
========== Linting C:\Users\PC\source\repos\ConsoleApp\ConsoleApp\obj\Debug\net5.0\ConsoleApp.AssemblyInfo.fs ========== ========== Finished: 0 warnings ========== ========== Linting C:\Users\PC\source\repos\ConsoleApp\ConsoleApp\Program.fs ========== Consider using 'List.Empty' instead. Error on line 4 starting at column 13 printfn "%A" [||] ^ -------------------------------------------------------------------------------- ========== Finished: 1 warnings ========== ========== Summary: 1 warnings ==========
FsharpLint is expected to suggest to use Array.empty.
Description
Make sure favourStaticEmptyFields is enabled in fsharplint.json.
FSharpLint suggests using
List.Empty
, which is wrong since it's not a List. Instead, it should suggest usingArray.empty
.Steps To Reproduce
dotnet fsharplint lint ..\ConsoleApp\ConsoleApp\ConsoleApp.fsproj
ConsoleApp.fsproj
Program.fs
Current Results
Expected behavior
FsharpLint is expected to suggest to use Array.empty.
Related information