问个 jslint 和 jshint 的 indent 配置问题

2014-04-16 09:51:58 +08:00
 smilngwang
~/.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缩进是怎么配置的?
3934 次点击
所在节点    Node.js
4 条回复
smilngwang
2014-04-16 11:03:38 +08:00
jshint2.5的问题,换到以前的版本好了。。。
参见https://github.com/jshint/jshint/releases
smilngwang
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
2014-04-16 13:27:08 +08:00
代码格式的话,我用了另外一个 codeFormatter
smilngwang
2014-04-16 13:35:03 +08:00
jshint把检查tab和空格的代码都去掉了。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/108757

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX