From d9e69028a7303b85cd13ab67647f7453364c1b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Piaggio?= Date: Mon, 23 Dec 2024 14:10:41 -0300 Subject: [PATCH] scalafix --- .../japgolly/webapputil/binary/BinaryData.scala | 8 +++++--- .../binary/BinaryData_PlatformSpecific.scala | 6 ++++-- .../japgolly/webapputil/binary/BinaryJs.scala | 11 +++++++---- .../webapputil/boopickle/BinaryFormatExt.scala | 7 +++++-- .../webapputil/boopickle/PicklerUtil.scala | 16 ++++++---------- .../webapputil/boopickle/SafePickler.scala | 5 ++++- .../webapputil/boopickle/SafePicklerUtil.scala | 3 ++- .../japgolly/webapputil/general/Version.scala | 1 + .../webapputil/indexeddb/IndexedDb.scala | 13 ++++++++----- .../japgolly/webapputil/indexeddb/KeyCodec.scala | 1 + .../webapputil/indexeddb/ObjectStoreDef.scala | 5 +++-- .../japgolly/webapputil/indexeddb/Txn.scala | 2 +- .../japgolly/webapputil/indexeddb/TxnDsl.scala | 7 ++++--- .../japgolly/webapputil/indexeddb/TxnStep.scala | 4 ++-- .../webapputil/indexeddb/ValueCodec.scala | 8 +++++--- .../src/main/scala/workers/CacheIDBStores.scala | 2 +- 16 files changed, 59 insertions(+), 40 deletions(-) diff --git a/workers/src/main/scala/japgolly/webapputil/binary/BinaryData.scala b/workers/src/main/scala/japgolly/webapputil/binary/BinaryData.scala index 357e09abd..c43871182 100644 --- a/workers/src/main/scala/japgolly/webapputil/binary/BinaryData.scala +++ b/workers/src/main/scala/japgolly/webapputil/binary/BinaryData.scala @@ -3,14 +3,16 @@ package japgolly.webapputil.binary +import cats.Eq import japgolly.webapputil.general.ErrorMsg + import java.io.OutputStream -import java.lang.{StringBuilder => JStringBuilder} +import java.lang.StringBuilder as JStringBuilder import java.nio.ByteBuffer import java.nio.charset.StandardCharsets -import java.util.{Arrays, Base64} +import java.util.Arrays +import java.util.Base64 import scala.collection.immutable.ArraySeq -import cats.Eq object BinaryData extends BinaryData_PlatformSpecific_Object { diff --git a/workers/src/main/scala/japgolly/webapputil/binary/BinaryData_PlatformSpecific.scala b/workers/src/main/scala/japgolly/webapputil/binary/BinaryData_PlatformSpecific.scala index 21792b7f5..f606a99e1 100644 --- a/workers/src/main/scala/japgolly/webapputil/binary/BinaryData_PlatformSpecific.scala +++ b/workers/src/main/scala/japgolly/webapputil/binary/BinaryData_PlatformSpecific.scala @@ -10,9 +10,11 @@ package japgolly.webapputil.binary // ********** import org.scalajs.dom.Blob + import scala.scalajs.js -import scala.scalajs.js.JSConverters._ -import scala.scalajs.js.typedarray.{ArrayBuffer, Uint8Array} +import scala.scalajs.js.JSConverters.* +import scala.scalajs.js.typedarray.ArrayBuffer +import scala.scalajs.js.typedarray.Uint8Array trait BinaryData_PlatformSpecific_Object { self: BinaryData.type => diff --git a/workers/src/main/scala/japgolly/webapputil/binary/BinaryJs.scala b/workers/src/main/scala/japgolly/webapputil/binary/BinaryJs.scala index 92078b13e..ec7a7b062 100644 --- a/workers/src/main/scala/japgolly/webapputil/binary/BinaryJs.scala +++ b/workers/src/main/scala/japgolly/webapputil/binary/BinaryJs.scala @@ -3,12 +3,15 @@ package japgolly.webapputil.binary +import org.scalajs.dom.Blob +import org.scalajs.dom.FileReader +import org.scalajs.dom.window + import java.nio.ByteBuffer -import org.scalajs.dom.{Blob, FileReader, window} import scala.scalajs.js -import scala.scalajs.js.JSConverters._ -import scala.scalajs.js.typedarray.TypedArrayBufferOps._ -import scala.scalajs.js.typedarray._ +import scala.scalajs.js.JSConverters.* +import scala.scalajs.js.typedarray.* +import scala.scalajs.js.typedarray.TypedArrayBufferOps.* object BinaryJs extends BinaryJs diff --git a/workers/src/main/scala/japgolly/webapputil/boopickle/BinaryFormatExt.scala b/workers/src/main/scala/japgolly/webapputil/boopickle/BinaryFormatExt.scala index 21a510f7b..5b0cd95b3 100644 --- a/workers/src/main/scala/japgolly/webapputil/boopickle/BinaryFormatExt.scala +++ b/workers/src/main/scala/japgolly/webapputil/boopickle/BinaryFormatExt.scala @@ -3,9 +3,12 @@ package japgolly.webapputil.boopickle -import boopickle.{PickleImpl, Pickler, UnpickleImpl} +import boopickle.PickleImpl +import boopickle.Pickler +import boopickle.UnpickleImpl import japgolly.scalajs.react.callback.AsyncCallback -import japgolly.webapputil.binary._ +import japgolly.webapputil.binary.* + import java.nio.ByteBuffer import scala.scalajs.js diff --git a/workers/src/main/scala/japgolly/webapputil/boopickle/PicklerUtil.scala b/workers/src/main/scala/japgolly/webapputil/boopickle/PicklerUtil.scala index 182411707..af9296d4d 100644 --- a/workers/src/main/scala/japgolly/webapputil/boopickle/PicklerUtil.scala +++ b/workers/src/main/scala/japgolly/webapputil/boopickle/PicklerUtil.scala @@ -4,23 +4,19 @@ package japgolly.webapputil.boopickle import boopickle.Decoder -import boopickle.DefaultBasic._ +import boopickle.DefaultBasic.* +import cats.Eq import cats.data.Ior -// import japgolly.microlibs.nonempty._ -// import japgolly.microlibs.recursion._ -// import japgolly.microlibs.stdlib_ext.StdlibExt._ -// import japgolly.microlibs.utils.SafeBool -// import japgolly.univeq.UnivEq +import cats.data.NonEmptySet +import cats.data.NonEmptyVector import japgolly.webapputil.binary.BinaryData import japgolly.webapputil.general.ErrorMsg + import java.nio.ByteBuffer import java.time.Instant import scala.collection.immutable.ArraySeq -import scala.reflect.ClassTag -import cats.Eq -import cats.data.NonEmptyVector -import cats.data.NonEmptySet import scala.collection.immutable.SortedSet +import scala.reflect.ClassTag object PicklerUtil { diff --git a/workers/src/main/scala/japgolly/webapputil/boopickle/SafePickler.scala b/workers/src/main/scala/japgolly/webapputil/boopickle/SafePickler.scala index b541391da..c9ee7e4a3 100644 --- a/workers/src/main/scala/japgolly/webapputil/boopickle/SafePickler.scala +++ b/workers/src/main/scala/japgolly/webapputil/boopickle/SafePickler.scala @@ -3,11 +3,14 @@ package japgolly.webapputil.boopickle +import boopickle.PickleState +import boopickle.Pickler +import boopickle.UnpickleState import cats.syntax.eq.* -import boopickle.{PickleState, Pickler, UnpickleState} import japgolly.webapputil.binary.BinaryData import japgolly.webapputil.general.Version import japgolly.webapputil.general.Version.ordering.mkOrderingOps + import scala.annotation.elidable import scala.util.control.NonFatal diff --git a/workers/src/main/scala/japgolly/webapputil/boopickle/SafePicklerUtil.scala b/workers/src/main/scala/japgolly/webapputil/boopickle/SafePicklerUtil.scala index 976893213..01050e220 100644 --- a/workers/src/main/scala/japgolly/webapputil/boopickle/SafePicklerUtil.scala +++ b/workers/src/main/scala/japgolly/webapputil/boopickle/SafePicklerUtil.scala @@ -3,7 +3,8 @@ package japgolly.webapputil.boopickle -import boopickle.{PickleState, UnpickleState} +import boopickle.PickleState +import boopickle.UnpickleState import japgolly.webapputil.general.Version object SafePicklerUtil { diff --git a/workers/src/main/scala/japgolly/webapputil/general/Version.scala b/workers/src/main/scala/japgolly/webapputil/general/Version.scala index 93c1591ed..fda99d1cd 100644 --- a/workers/src/main/scala/japgolly/webapputil/general/Version.scala +++ b/workers/src/main/scala/japgolly/webapputil/general/Version.scala @@ -5,6 +5,7 @@ package japgolly.webapputil.general import cats.Eq import cats.syntax.option.* + import scala.collection.mutable final case class Version(major: Version.Major, minor: Version.Minor) { diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/IndexedDb.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/IndexedDb.scala index e54e4f1ce..4178cc550 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/IndexedDb.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/IndexedDb.scala @@ -4,13 +4,16 @@ package japgolly.webapputil.indexeddb import cats.kernel.Eq -import japgolly.scalajs.react._ -import japgolly.scalajs.react.util.Util.{identity => identityFn} -import japgolly.webapputil.indexeddb.TxnMode._ -import org.scalajs.dom._ +import japgolly.scalajs.react.* +import japgolly.scalajs.react.util.Util.identity as identityFn +import japgolly.webapputil.indexeddb.TxnMode.* +import org.scalajs.dom.* + import scala.annotation.elidable import scala.scalajs.js -import scala.util.{Failure, Success, Try} +import scala.util.Failure +import scala.util.Success +import scala.util.Try final class IndexedDb(raw: IDBFactory) { import IndexedDb._ diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/KeyCodec.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/KeyCodec.scala index 47523b9a0..eedfeea8f 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/KeyCodec.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/KeyCodec.scala @@ -4,6 +4,7 @@ package japgolly.webapputil.indexeddb import japgolly.scalajs.react.CallbackTo + import java.util.UUID import scala.reflect.ClassTag import scala.scalajs.js diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/ObjectStoreDef.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/ObjectStoreDef.scala index bd2dc7eaf..8eef15b93 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/ObjectStoreDef.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/ObjectStoreDef.scala @@ -3,9 +3,10 @@ package japgolly.webapputil.indexeddb -import japgolly.scalajs.react.{AsyncCallback, CallbackTo} -import org.scalajs.dom.IDBValue import cats.Eq +import japgolly.scalajs.react.AsyncCallback +import japgolly.scalajs.react.CallbackTo +import org.scalajs.dom.IDBValue sealed trait ObjectStoreDef[K, V] { val name: String diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/Txn.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/Txn.scala index c93421e66..4202d6bbb 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/Txn.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/Txn.scala @@ -4,7 +4,7 @@ package japgolly.webapputil.indexeddb import cats.Monad -import japgolly.webapputil.indexeddb.TxnMode._ +import japgolly.webapputil.indexeddb.TxnMode.* /** * Embedded language for safely working with(in) an IndexedDB transaction. diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnDsl.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnDsl.scala index f4116bb10..e733e091e 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnDsl.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnDsl.scala @@ -4,10 +4,11 @@ package japgolly.webapputil.indexeddb import cats.Traverse -import japgolly.scalajs.react._ -import japgolly.scalajs.react.util.Util.{identity => identityFn} +import japgolly.scalajs.react.* +import japgolly.scalajs.react.util.Util.identity as identityFn import japgolly.webapputil.indexeddb.IndexedDb.ObjectStore -import japgolly.webapputil.indexeddb.TxnMode._ +import japgolly.webapputil.indexeddb.TxnMode.* + import scala.collection.BuildFrom sealed abstract class TxnDsl[M <: TxnMode] { diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnStep.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnStep.scala index 84a799e96..d1dbb16ff 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnStep.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/TxnStep.scala @@ -3,9 +3,9 @@ package japgolly.webapputil.indexeddb -import japgolly.scalajs.react._ +import japgolly.scalajs.react.* import japgolly.webapputil.indexeddb.IndexedDb.ObjectStore -import org.scalajs.dom._ +import org.scalajs.dom.* /** * Embedded language for safely working with(in) an IndexedDB transaction. diff --git a/workers/src/main/scala/japgolly/webapputil/indexeddb/ValueCodec.scala b/workers/src/main/scala/japgolly/webapputil/indexeddb/ValueCodec.scala index 182401cad..cdd8dbf1e 100644 --- a/workers/src/main/scala/japgolly/webapputil/indexeddb/ValueCodec.scala +++ b/workers/src/main/scala/japgolly/webapputil/indexeddb/ValueCodec.scala @@ -3,10 +3,12 @@ package japgolly.webapputil.indexeddb -import japgolly.scalajs.react.{AsyncCallback, CallbackTo} -import japgolly.webapputil.binary._ -import java.util.UUID +import japgolly.scalajs.react.AsyncCallback +import japgolly.scalajs.react.CallbackTo +import japgolly.webapputil.binary.* import org.scalajs.dom.IDBValue + +import java.util.UUID import scala.reflect.ClassTag import scala.scalajs.js import scala.scalajs.js.typedarray.ArrayBuffer diff --git a/workers/src/main/scala/workers/CacheIDBStores.scala b/workers/src/main/scala/workers/CacheIDBStores.scala index e1a264e28..b85ba5b4b 100644 --- a/workers/src/main/scala/workers/CacheIDBStores.scala +++ b/workers/src/main/scala/workers/CacheIDBStores.scala @@ -9,10 +9,10 @@ import explore.model.boopickle.CatalogPicklers.given import japgolly.scalajs.react.callback.* import japgolly.webapputil.binary.* import japgolly.webapputil.boopickle.* +import japgolly.webapputil.boopickle.BinaryFormatExt.Implicits.* import japgolly.webapputil.indexeddb.* import japgolly.webapputil.indexeddb.IndexedDb.DatabaseName import lucuma.ags.GuideStarCandidate -import japgolly.webapputil.boopickle.BinaryFormatExt.Implicits.* import scala.annotation.nowarn import scala.scalajs.js