【问题标题】:Coffeelint indentation in Web Essentials 2013Web Essentials 2013 中的 Coffeelint 缩进
【发布时间】:2014-05-22 10:09:07
【问题描述】:

我的咖啡文件中有 4 个空格缩进,当我编译这些文件时出现错误:

CoffeeLint:YourFile.coffee 编译失败:CoffeeLint:行包含不一致的缩进;上下文:预期 2 得到 4

我发现http://www.coffeelint.org/ 实际上提供了配置缩进的选项,并且在 Web Essentials 菜单中有编辑 Global CofeeLint 设置的选项。所以我将该选项更改为:

"indentation": {
    "name": "indentation",
    "value": 4,
    "level": "error"
}

(将值从 2 更改为 4)

但是我什至尝试将levelerror 更改为ignore 仍然没有成功。我什至尝试重新启动VS和Windows,我做错了什么?

更新 1。

根据 cmets 的要求,这是我拥有的代码:

if 1
    0

还有打开查看空白的屏幕截图:

【问题讨论】:

  • @SLaks 我已经更新了我的问题。此外,我的 PC 上只有一个 coffeelint.json(它没有被覆盖),我试图重新启动我的 PC =)

标签: visual-studio-2013 coffeescript web-essentials coffeelint


【解决方案1】:

如果您使用的是 coffeelint,并且您想将缩进值更改为 2 个空格,那么您必须编辑 coffeelint/lib/coffeelint.js 文件并将“值”的值更改为 2,如下所示:

module.exports = Indentation = (function() {
  Indentation.prototype.rule = {
    name: 'indentation',
    value: 2,
    level: 'error',
    message: 'Line contains inconsistent indentation',
    description: "This rule imposes a standard number of spaces to be used for\nindentation. Since whitespace is significant in CoffeeScript, it's\ncritical that a project chooses a standard indentation format and\nstays consistent. Other roads lead to darkness. <pre> <code>#\nEnabling this option will prevent this ugly\n# but otherwise valid CoffeeScript.\ntwoSpaces = () ->\n  fourSpaces = () ->\n      eightSpaces = () ->\n            'this is valid CoffeeScript'\n\n</code>\n</pre>\nTwo space indentation is enabled by default."
  };

您编辑的文件可能是生成的文件,没有任何意义。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-11
    • 1970-01-01
    • 2014-08-21
    • 2014-04-17
    • 1970-01-01
    相关资源
    最近更新 更多