This commit is contained in:
Mark Canlas 2020-09-04 01:18:34 -04:00
parent 2384fd462e
commit ceeacfb539
2 changed files with 9 additions and 17 deletions

View File

@ -7,8 +7,7 @@ lazy val root =
) )
.withCats .withCats
.withTesting .withTesting
.withOrganizeImports
.aggregate(nescant) .aggregate(nescant)
lazy val nescant = lazy val nescant =
project.withCats.withTesting.withOrganizeImports project.withCats.withTesting

View File

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