2012-10-15 91 views

回答

4

(通過@jzsfkzm,誰好心發佈了excellent responsegithub issue,但並沒有選擇在這裏重新發布他的回答這個答案。)

在我們項目的插件在plugins.sbt添加並在Build.scala中配置。下面的例子。

項目/ plugins.sbt

addSbtPlugin("com.github.philcali" % "sbt-jslint" % "0.1.3") 

項目/ Build.scala

import sbtjslint.Plugin._ 
import sbtjslint.Plugin.LintKeys._ 

... 

val localSettings = lintSettings ++ inConfig(Compile)(Seq(
    // jslint 
    sourceDirectory in jslint <<= (baseDirectory)(_/"public"/"javascripts"), 
    excludeFilter in jslint := "generated" || "lib", 
    flags in jslint := Seq("sloppy", "continue", "vars", "nomen") 
)) 

def playProject = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
    localSettings : _* 
) 

,我們用它來運行的JSLint是play jslint任務,它會檢查你的代碼,並創建一個xml文件,target/jslint/results.xml以供進一步使用。例如,您可以在Jenkins Violations插件中使用它。

相關問題