ESLint:如何对 VSCode 折叠区域注释进行间隔注释异常

nam*_*old 4 eslint

spaced-comment我的配置中有ESLint强制注释中的间距,但无法确定如何将 VSCode 的折叠区域注释添加到exceptions数组中。

ESLint 配置:

"spaced-comment": [ "error", "always", {
    "line": {
        "exceptions": ["#region", "#endregion", "region", "endregion"]
    }
}]
Run Code Online (Sandbox Code Playgroud)

源代码

//#region My region
//#endregion My region
or
//region My region
//endregion My region
Run Code Online (Sandbox Code Playgroud)

来自 ESLint 的消息:

Expected exception block, space or tab after '//' in comment.
Run Code Online (Sandbox Code Playgroud)

期望:ESLint 应该允许我使用带注释的 VSCode 折叠区域,而不必强迫我在//和之间添加空格#region

h0b*_*0b0 7

您可以通过使用markers而不是解决此问题exceptions

"spaced-comment": [ "error", "always", {
    "line": {
        "markers": ["#region", "#endregion", "region", "endregion"]
    }
}]
Run Code Online (Sandbox Code Playgroud)