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
.withTesting
.withOrganizeImports
.aggregate(nescant)
lazy val nescant =
project.withCats.withTesting.withOrganizeImports
project.withCats.withTesting

View File

@ -1,25 +1,18 @@
import sbt.Keys._
import sbt._
import scalafix.sbt.ScalafixPlugin.autoImport._
object LintingPlugin extends AutoPlugin {
override def trigger = allRequirements
override lazy val globalSettings =
override val globalSettings =
addCommandAlias("fmt", "scalafmtAll") ++
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
)
}
}
}
override val projectSettings =
Seq(
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.0",
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
}