How to use sbt-jslint in Play Framework 2.0.x scala?

I would like to integrate sbt-jslint into an existing Play Framework 2.0.x project using Scala.

Has anyone done this before? What are the setup steps that will integrate jslint into the play test run and present the failures as an integrated part of the output?

+4
source share
1 answer

(this answer is via @jzsfkzm, which kindly posted a great answer on github but didn’t decide to cancel the answer here.)

In our projects, the plugin is added to plugins.sbt and configured in Build.scala. Examples are 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 will check your code and create an xml file, target / jslint / results.xml for future use. You can use it in the Jenkins Violations plugin, for example.

+4
source

Source: https://habr.com/ru/post/1439878/


All Articles