diff --git a/.scalafmt.conf b/.scalafmt.conf index eeda3ba5..6c9d8265 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version=3.7.17 +version = 3.8.4-RC3 runner.dialect = "scala213" fileOverride { "glob:**/scala-3/**" { diff --git a/build.sbt b/build.sbt index d92ea3d4..208bd9ac 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,4 @@ import org.scalajs.linker.interface.ESVersion - import org.openqa.selenium.WebDriver import org.openqa.selenium.chrome.ChromeDriver import org.openqa.selenium.chrome.ChromeOptions @@ -8,13 +7,16 @@ import org.openqa.selenium.firefox.FirefoxProfile import org.openqa.selenium.remote.server.DriverFactory import org.openqa.selenium.remote.server.DriverProvider +import scala.Ordering.Implicits.* import org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv import org.scalajs.jsenv.selenium.SeleniumJSEnv import java.util.concurrent.TimeUnit - import org.commonmark.parser.Parser import org.commonmark.renderer.html.HtmlRenderer +import org.typelevel.scalacoptions.ScalaVersion.V3_0_0 +import org.typelevel.scalacoptions.ScalacOption +import org.typelevel.scalacoptions.ScalacOptions val disableWebsiteOnCI = true @@ -124,9 +126,8 @@ inThisBuild( ), ) -lazy val commonSettings = Seq.concat( - ScalaOptions.fixOptions, - scalacOptions ++= { +lazy val commonSettings = Seq( + tpolecatScalacOptions ++= { val sourcesGithubUrl = s"https://raw.githubusercontent.com/tulz-app/laminext/${git.gitHeadCommit.value.get}/" val sourcesOptionName = CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, _)) => "-P:scalajs:mapSourceURI" @@ -134,10 +135,23 @@ lazy val commonSettings = Seq.concat( case _ => throw new RuntimeException(s"unexpected scalaVersion: ${scalaVersion.value}") } val moduleSourceRoot = file("").toURI.toString - Seq( - s"$sourcesOptionName:$moduleSourceRoot->$sourcesGithubUrl" + Set( + ScalacOption(s"$sourcesOptionName:$moduleSourceRoot->$sourcesGithubUrl", _ => true) ) - } + }, + tpolecatExcludeOptions ++= Set( + ScalacOptions.warnDeadCode, + ScalacOptions.warnUnusedImports, + ), + Test / tpolecatExcludeOptions ++= Set( + ScalacOptions.warnValueDiscard, + ScalacOptions.warnUnusedImports, + ScalacOptions.warnUnusedLocals, + ScalacOptions.warnUnusedImplicits, + ScalacOptions.warnUnusedPatVars, + ScalacOptions.warnDeadCode, + ScalacOptions.warnNonUnitStatement + ), ) lazy val baseDependencies = Seq( diff --git a/modules/fsm/src/main/scala/io/laminext/fsm/AirFSM.scala b/modules/fsm/src/main/scala/io/laminext/fsm/AirFSM.scala index 6309c759..1f1f2fe4 100644 --- a/modules/fsm/src/main/scala/io/laminext/fsm/AirFSM.scala +++ b/modules/fsm/src/main/scala/io/laminext/fsm/AirFSM.scala @@ -15,7 +15,7 @@ class AirFSM[State](initialState: State, initialStateRequests: EventStream[State var currentSubscription: Subscription = null ReactiveElement.bindSubscriptionUnsafe(element) { ctx => currentSubscription = stateChangeRequests.writer.addSource(initialStateRequests)(ctx.owner) - stateChangeRequests.events.foreach { nextState => + val _ = stateChangeRequests.events.foreach { nextState => if (control.isDefinedAt((currentState, nextState))) { val nextStateChangeRequests = control((currentState, nextState)) if (currentSubscription != null) { diff --git a/modules/tailwind/src/main/scala/io/laminext/tailwind/modal/Modal.scala b/modules/tailwind/src/main/scala/io/laminext/tailwind/modal/Modal.scala index 7db43adf..f832354d 100644 --- a/modules/tailwind/src/main/scala/io/laminext/tailwind/modal/Modal.scala +++ b/modules/tailwind/src/main/scala/io/laminext/tailwind/modal/Modal.scala @@ -50,13 +50,13 @@ object Modal { private def calculateScrollbarWidth(): Double = { val outer = div(styleAttr("visibility: hidden; width: 100px; msOverflowStyle: scrollbar")).ref - dom.document.body.appendChild(outer) + val _ = dom.document.body.appendChild(outer) val widthNoScroll = outer.offsetWidth outer.style.overflow = "scroll" val inner = div(width := "100%").ref - outer.appendChild(inner) + val _ = outer.appendChild(inner) val widthWithScroll = inner.offsetWidth - outer.parentNode.removeChild(outer) + val _ = outer.parentNode.removeChild(outer) widthNoScroll - widthWithScroll } diff --git a/modules/videojs/src/main/scala/io/laminext/videojs/api/VideoJSOptions.scala b/modules/videojs/src/main/scala/io/laminext/videojs/api/VideoJSOptions.scala index 23790d2b..1de28cdf 100644 --- a/modules/videojs/src/main/scala/io/laminext/videojs/api/VideoJSOptions.scala +++ b/modules/videojs/src/main/scala/io/laminext/videojs/api/VideoJSOptions.scala @@ -45,6 +45,7 @@ object VideoJSOptions { if (sources.nonEmpty) obj.sources = sources.toJSArray if (techOrder.nonEmpty) obj.techOrder = techOrder.toJSArray aspectRatio.foreach(obj.aspectRatio = _) + bigPlayButton.foreach(obj.bigPlayButton = _) controlBar.foreach(obj.controlBar = _) defaultVolume.foreach(obj.defaultVolume = _) html5.foreach(obj.html5 = _) diff --git a/modules/videojs/src/main/scala/io/laminext/videojs/api/components/Slider.scala b/modules/videojs/src/main/scala/io/laminext/videojs/api/components/Slider.scala index 257894c1..9a4ea9fe 100644 --- a/modules/videojs/src/main/scala/io/laminext/videojs/api/components/Slider.scala +++ b/modules/videojs/src/main/scala/io/laminext/videojs/api/components/Slider.scala @@ -30,7 +30,7 @@ trait Slider extends Component { def disable(): Unit /** - * Create the `Slider`s DOM element. + * Create the `Slider` s DOM element. * * @param type * Type of element to create. @@ -93,8 +93,8 @@ trait Slider extends Component { * * @return * The current position of the Slider. - * - position.x for vertical `Slider`s - * - position.y for horizontal `Slider`s + * - position.x for vertical `Slider` s + * - position.y for horizontal `Slider` s */ def calculateDistance(event: EventTarget.Event): Double diff --git a/modules/websocket/src/main/scala/io/laminext/websocket/WebSocket.scala b/modules/websocket/src/main/scala/io/laminext/websocket/WebSocket.scala index b7c637c4..dffe746d 100644 --- a/modules/websocket/src/main/scala/io/laminext/websocket/WebSocket.scala +++ b/modules/websocket/src/main/scala/io/laminext/websocket/WebSocket.scala @@ -126,7 +126,7 @@ class WebSocket[Receive, Send]( if (!bufferWhenDisconnected) { sendBuffer.clear() } else if (sendBuffer.size > bufferSize) { - sendBuffer.drop(sendBuffer.size - bufferSize) + val _ = sendBuffer.drop(sendBuffer.size - bufferSize) } } connectedWS.foreach { ws => diff --git a/project/DependencyVersions.scala b/project/DependencyVersions.scala index ed77dd57..4a37f950 100644 --- a/project/DependencyVersions.scala +++ b/project/DependencyVersions.scala @@ -1,13 +1,13 @@ object DependencyVersions { val jsdom = "16.4.0" - val laminar = "17.0.0" + val laminar = "17.2.0" val `scala-test` = "3.2.9" val stringdiff = "0.3.4" val domtestutils = "18.0.1" - val cats = "2.10.0" + val cats = "2.12.0" val upickle = "3.2.0" - val circe = "0.14.6" + val circe = "0.14.9" // -- website diff --git a/project/ScalaVersions.scala b/project/ScalaVersions.scala index 4c0786c1..1b900677 100644 --- a/project/ScalaVersions.scala +++ b/project/ScalaVersions.scala @@ -1,4 +1,4 @@ object ScalaVersions { - val v213 = "2.13.12" - val v3 = "3.3.1" + val v213 = "2.13.15" + val v3 = "3.3.4" } diff --git a/project/build.properties b/project/build.properties index 04267b14..e88a0d81 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.10.6 diff --git a/project/plugins.sbt b/project/plugins.sbt index 04c98850..ecc26c7b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ logLevel := Level.Warn -libraryDependencies += "org.commonmark" % "commonmark" % "0.21.0" +libraryDependencies += "org.commonmark" % "commonmark" % "0.24.0" libraryDependencies += "org.scala-js" %% "scalajs-env-nodejs" % "1.4.0" libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.1" libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0" @@ -9,16 +9,16 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2") -//addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.3.1") +addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.2") addSbtPlugin("com.yurique" % "sbt-embedded-files" % "0.4.0") -addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.19.0") +addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.24.0") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1") diff --git a/website/src/main/scala/io/laminext/site/examples/websocket/WebSocketCirceExample.scala b/website/src/main/scala/io/laminext/site/examples/websocket/WebSocketCirceExample.scala index 9c9633b2..6bf29da7 100644 --- a/website/src/main/scala/io/laminext/site/examples/websocket/WebSocketCirceExample.scala +++ b/website/src/main/scala/io/laminext/site/examples/websocket/WebSocketCirceExample.scala @@ -10,9 +10,6 @@ object WebSocketCirceExample description = FileAsString("description.md") )(() => { import com.raquo.laminar.api.L._ - div( - "temporarily commenting this out – circe's not ready for scala 3-RC2" - ) import com.raquo.laminar.api.L._ import com.raquo.laminar.api.L.CollectionCommand diff --git a/website/src/main/scala/io/laminext/site/layout/PageHeader.scala b/website/src/main/scala/io/laminext/site/layout/PageHeader.scala index 0de5f661..127864e4 100644 --- a/website/src/main/scala/io/laminext/site/layout/PageHeader.scala +++ b/website/src/main/scala/io/laminext/site/layout/PageHeader.scala @@ -156,7 +156,7 @@ object PageHeader { private def moduleLink( currentPage: Signal[Option[(SiteModule, Page)]] - )(module: SiteModule) = + )(module: SiteModule) = a( cls := "border-b-2 px-2 border-transparent flex font-display tracking-wide", currentPage