Reputation: 2698
I'd like to integrate sbt-jslint into an existing Play Framework 2.0.x project using Scala.
Has anyone done this before? What are the configuration steps that will integrate jslint into the play test
run, and present the failures as an integrated part of the output?
Upvotes: 4
Views: 889
Reputation: 2698
(this answer via @jzsfkzm, who kindly posted an excellent response to the github issue, but did not choose to repost his answer here.)
On our projects the plugin is added in the plugins.sbt and configured in the Build.scala. Examples below.
project/plugins.sbt
addSbtPlugin("com.github.philcali" % "sbt-jslint" % "0.1.3")
project/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 : _*
)
The task we use to run jslint is play jslint
, it'll check your code and create an xml file, target/jslint/results.xml for further usage. You can use it in the Jenkins Violations plugin for example.
Upvotes: 4