3

Does anybody know how to check nodejs code to code standards automatically? I'm looking for some features like codesniffer but for node.js (express framework).

4

1 回答 1

6

您可以将JSHint用于节点。全局安装:

sudo npm install jshint -g

基本用法:

jshint foo.js 
  foo.js: line 7, col 23, Missing semicolon.

您可以创建一个名为.jshintrc包含JSON JSHint 选项的自定义配置文件,JSHint 会选择它们。文件示例.jshintrc

{
    "strict": "true",
    "smarttabs": "true"
}

您可以在他们的文档页面上阅读有关如何配置 JSHint 的更多信息。

于 2013-12-05T20:37:32.410 回答