Grunt で複数のサブタスク (src、lib、および test) を使用して JSHint をセットアップすると、うまく機能します。ただし、このセットアップを使い始めたばかりなので、多くのソース ファイルに多くのエラーがあります。
$ grunt jshint:src
... lots of errors ...
一度に 1 つのファイルで作業しているときに、その 1 つのファイルを再リントすることはできますか?
$ grunt jshint:src:one.js
... only errors from one.js ...
アップデート
複雑な点の 1 つは、監視タスクにも複数のサブタスクがあり、編集されるファイルの種類に基づいてさまざまなタスクを起動することです。
watch: {
src: {
files: [ SRC_DIR + "hgm*.js" ],
tasks: [ "jshint:src", "test" ]
},
lib: {
files: [ "lib/hgm-test-setup.js", "lib/hgm.loader.js" ],
tasks: [ "jshint:lib", "test" ]
},
test: {
files: [ "tests/**/*.js" ],
tasks: [ "jshint:test", "test" ]
}
}
この理由は、アサーションなどのテストに使用されるすべてのグローバルを指定する別のものを使用しているsrc
間に、 lib
1 つ.jshint
を使用するためです。とtest
を組み合わせることができますが、 の JSHint 構成ファイルをオーバーライドできますか?src
lib
test