ESLint:如何在VSCode折叠区域上注释注释异常

时间:2020-06-19 11:43:15

标签: eslint

我在spaced-comment中有此ESLint配置,可以在注释中添加空格,但不能在VSCode folding regions注释上exception

ESLint配置:

"spaced-comment": [ "error", "always", {
    "line": {
        "exceptions": ["#region", "#endregion", "region", "endregion"]
    }
}]

源代码

//#region My region
//#endregion My region
or
//region My region
//endregion My region

来自ESLint的消息:

Expected exception block, space or tab after '//' in comment.

我的期望:ESLint允许我注释VSCode折叠区域,并停止迫使我在//#region之间添加空格。

1 个答案:

答案 0 :(得分:1)

您可以使用markers代替exceptions来解决此问题:

"spaced-comment": [ "error", "always", {
    "line": {
        "markers": ["#region", "#endregion", "region", "endregion"]
    }
}]