visual-studio-code - FSharpLint,如何在 SuppressMessageAttribute 中使用规则“InterfaceNamesMustBeginWithI”?
问题描述
[<SuppressMessage("NameConventions","InterfaceNamesMustBeginWithI")>] //No effect
[<SuppressMessage("NameConventions","InterfaceNames")>] //It's working
module Test=
type [<AllowNullLiteral>] MutationEvent =
abstract attrChange: float with get, set
...
此外,未能搜索有关“InterfaceNamesMustBeginWithI”的源代码。
解决方案
规则的名称是InterfaceNames
,因此您可以这样抑制它:
[<SuppressMessage("","InterfaceNames")>]
module Test =
...
另请注意,第一个参数 toSuppressMessage
不被 fsharplint 使用,所以它可以是任何东西(虽然不是null
,但很奇怪!)
文档中有指向的指针InterfaceNamesMustBeginWithI
,但这是不正确的。