Skip to content

Show JSLint issues in Play20 browser error display instead of just in console #9

@sqs

Description

@sqs

Here's a code snippet you can add to the README if you want:

  val localSettings = lintSettings ++ inConfig(Compile)(Seq(
    // jslint
    sourceDirectory in jslint <<= (baseDirectory)(_ / "app" / "assets" / "javascripts"),
    flags in jslint := Seq("anon", "sloppy", "nomen", "newcap"),
    indent in jslint := 2,
    predefs in jslint := List("angular", "Showdown", "moment", "_"),
    jslintConsoleOutput in Compile <<= (streams, formatter in (Compile, jslintConsoleOutput)) map { (s, f) =>
      (results: JSLintResults) => {
        results.filter(!_.getIssues.isEmpty).map(f.format).map(s.log.warn(_))
        results.filter(!_.getIssues.isEmpty).flatMap(_.getIssues.asScala).foreach { i =>
          throw new AssetCompilationException(Some(file(i.getSystemId)), "JSLint: " + i.getReason, Some(i.getLine),Some(i.getCharacter))
        }
      }
    }
  ))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions