2020-08-15 06:04:21 +00:00
|
|
|
import sbt.Keys._
|
|
|
|
import sbt._
|
|
|
|
|
|
|
|
object LintingPlugin extends AutoPlugin {
|
|
|
|
override def trigger = allRequirements
|
|
|
|
|
|
|
|
override lazy val globalSettings =
|
2020-08-28 06:18:25 +00:00
|
|
|
addCommandAlias("fmt", "scalafmtAll") ++
|
2020-08-15 06:04:21 +00:00
|
|
|
addCommandAlias("fix", "scalafixAll")
|
|
|
|
|
|
|
|
object autoImport {
|
|
|
|
// this class name should be unique to evade implicit collision with other ops classes
|
|
|
|
implicit class LintingOps(p: Project) {
|
|
|
|
def withOrganizeImports: Project = {
|
|
|
|
import scalafix.sbt.ScalafixPlugin.autoImport._
|
|
|
|
|
|
|
|
p.settings(
|
|
|
|
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.0",
|
|
|
|
semanticdbEnabled := true,
|
|
|
|
semanticdbVersion := scalafixSemanticdb.revision
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|