V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
smilngwang
V2EX  ›  Node.js

问个 jslint 和 jshint 的 indent 配置问题

  •  
  •   smilngwang · 2014-04-16 09:51:58 +08:00 · 3906 次点击
    这是一个创建于 3635 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ~/.jshintrc中配置了indent为4
    {..., "indent":4, "white":false, ...}

    然后在比如这个测试代码test.js

    /jshint indent:4/
    var condition, doSth;
    if (condition)
    doSth(); // expected to be invalid


    jshint test.js 并没有检查缩进。

    同样的代码 使用jslint --indent 4 test.js 可以检查出来缩进问题。
    大家jshint缩进是怎么配置的?
    4 条回复    1970-01-01 08:00:00 +08:00
    smilngwang
        1
    smilngwang  
    OP
       2014-04-16 11:03:38 +08:00
    jshint2.5的问题,换到以前的版本好了。。。
    参见https://github.com/jshint/jshint/releases
    smilngwang
        2
    smilngwang  
    OP
       2014-04-16 11:07:59 +08:00
    The following options were removed: nomen, onevar, passfail, white, gcl, smarttabs, trailing. In addition to that, indent no longer provides warnings about indentation levels. You can still use it to set your tab-width but it will be used only for character locations in other warnings. JSHint won't error if you have these options in your config or your files; it will simply ignore them.
    lijinma
        3
    lijinma  
       2014-04-16 13:27:08 +08:00
    代码格式的话,我用了另外一个 codeFormatter
    smilngwang
        4
    smilngwang  
    OP
       2014-04-16 13:35:03 +08:00
    jshint把检查tab和空格的代码都去掉了。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2451 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:55 · PVG 23:55 · LAX 08:55 · JFK 11:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.