diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02d04b56..5c4d399b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,6 +80,10 @@ jobs: - name: Test run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test + - name: Check scalafix lints + if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'scalafixAll --check' + - name: Check binary compatibility if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 00000000..5011d854 --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1,3 @@ +rules = [OrganizeImports] + +OrganizeImports.removeUnused = false diff --git a/build.sbt b/build.sbt index aecd166e..43e71b4a 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,7 @@ ThisBuild / tlSonatypeUseLegacyHost := false ThisBuild / crossScalaVersions := Seq("3.2.1") ThisBuild / scalacOptions ++= Seq("-new-syntax", "-indent", "-source:future") +ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0" ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17")) ThisBuild / tlJdkRelease := Some(8) diff --git a/calico/src/main/scala/calico/html.scala b/calico/src/main/scala/calico/html.scala index 1ac2b540..44f5b55b 100644 --- a/calico/src/main/scala/calico/html.scala +++ b/calico/src/main/scala/calico/html.scala @@ -50,8 +50,8 @@ import org.scalajs.dom import shapeless3.deriving.K0 import scala.collection.mutable -import scala.scalajs.js import scala.collection.mutable.ListBuffer +import scala.scalajs.js object io extends Html[IO] diff --git a/calico/src/main/scala/calico/unsafe/MicrotaskExecutor.scala b/calico/src/main/scala/calico/unsafe/MicrotaskExecutor.scala index d7e0cfe5..ce6e0e25 100644 --- a/calico/src/main/scala/calico/unsafe/MicrotaskExecutor.scala +++ b/calico/src/main/scala/calico/unsafe/MicrotaskExecutor.scala @@ -16,9 +16,9 @@ package calico.unsafe +import scala.concurrent.ExecutionContext import scala.scalajs.js import scala.scalajs.js.annotation.JSGlobal -import scala.concurrent.ExecutionContext private[calico] object MicrotaskExecutor extends ExecutionContext: diff --git a/frp/src/main/scala/calico/frp/SignallingSortedMapRef.scala b/frp/src/main/scala/calico/frp/SignallingSortedMapRef.scala index d70ce637..275d5ea8 100644 --- a/frp/src/main/scala/calico/frp/SignallingSortedMapRef.scala +++ b/frp/src/main/scala/calico/frp/SignallingSortedMapRef.scala @@ -23,8 +23,8 @@ import cats.kernel.Order import cats.syntax.all.* import fs2.Stream import fs2.concurrent.Signal -import fs2.concurrent.SignallingRef import fs2.concurrent.SignallingMapRef +import fs2.concurrent.SignallingRef import scala.collection.immutable.LongMap import scala.collection.immutable.SortedMap diff --git a/project/plugins.sbt b/project/plugins.sbt index 35b9fe71..b64704f8 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,6 @@ val sbtTypelevelVersion = "0.4.18" addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion) +addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % sbtTypelevelVersion) addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion) addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6") diff --git a/todo-mvc/src/main/scala/todomvc/TodoMvc.scala b/todo-mvc/src/main/scala/todomvc/TodoMvc.scala index 647d5cc6..1090f7f7 100644 --- a/todo-mvc/src/main/scala/todomvc/TodoMvc.scala +++ b/todo-mvc/src/main/scala/todomvc/TodoMvc.scala @@ -17,8 +17,10 @@ package todomvc import calico.* -import calico.frp.{*, given} -import calico.html.io.{*, given} +import calico.frp.* +import calico.frp.given +import calico.html.io.* +import calico.html.io.given import calico.router.* import calico.syntax.* import cats.data.*