From ceeacfb53909c98e2dfa0d5bfd218e3407d143d1 Mon Sep 17 00:00:00 2001 From: Mark Canlas Date: Fri, 4 Sep 2020 01:18:34 -0400 Subject: [PATCH] scalafix --- build.sbt | 3 +-- project/LintingPlugin.scala | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/build.sbt b/build.sbt index b69d759..4e3594e 100644 --- a/build.sbt +++ b/build.sbt @@ -7,8 +7,7 @@ lazy val root = ) .withCats .withTesting - .withOrganizeImports .aggregate(nescant) lazy val nescant = - project.withCats.withTesting.withOrganizeImports + project.withCats.withTesting diff --git a/project/LintingPlugin.scala b/project/LintingPlugin.scala index 54ffbec..b2748e3 100644 --- a/project/LintingPlugin.scala +++ b/project/LintingPlugin.scala @@ -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 + ) }