【问题标题】:Allow multiple spaces after comma in ESLint在 ESLint 中允许逗号后有多个空格
【发布时间】:2016-11-26 02:26:34
【问题描述】:

我的 ESLint 配置有问题。我喜欢在变量前用逗号换行,但是 ESLint 不接受三个空格(在这种情况下只有一个空格是正确的)。

我应该在我的 ESLint 配置文件中添加什么以允许在逗号后面使用三个空格而不是一个?

【问题讨论】:

  • 也许no-multi-spaces 提供了一个提示。

标签: javascript webstorm eslint


【解决方案1】:

正如the document 提到的,我们可以通过 ESTree 节点类型指定异常。逗号属于VariableDeclaration 节点。

"no-multi-spaces": [
    "error", 
    {"exceptions": {"VariableDeclaration": true}}
]

【讨论】:

    猜你喜欢
    • 2019-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-12
    • 1970-01-01
    • 2017-03-20
    • 2011-09-08
    • 1970-01-01
    相关资源
    最近更新 更多