Skip to content

Commit

Permalink
Build: Scalafmt - De-indent extends to get superclass constructor p…
Browse files Browse the repository at this point in the history
…arams at the right indent
  • Loading branch information
raquo committed Nov 18, 2024
1 parent e876868 commit 679a261
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 36 deletions.
3 changes: 2 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ indent.binPackDefnSite = 2
indent.ctorSite = 2
indent.matchSite = 2
indent.caseSite = 2
indent.extendSite = 2
indent.extendSite = 0
indent.withSiteRelativeToExtends = 0
indent.commaSiteRelativeToExtends = 2 # 0 is not allowed
indent.extraBeforeOpenParenDefnSite = 0
Expand Down Expand Up @@ -76,6 +76,7 @@ newlines.afterInfix = keep
newlines.afterInfixBreakOnNested = false # ??? https://scalameta.org/scalafmt/docs/configuration.html#newlinesafterinfixbreakonnested
newlines.avoidForSimpleOverflow = [tooLong, punct, slc]
newlines.avoidInResultType = true
newlines.avoidAfterYield = false
newlines.sometimesBeforeColonInMethodReturnType = false
# newlines.beforeOpenParenDefnSite = keep # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#newlinesbeforeopenparenxxxsite
# newlines.beforeOpenParenCallSite = keep # TODO only supported for Scala 3. Also, not sure... https://scalameta.org/scalafmt/docs/configuration.html#newlinesbeforeopenparenxxxsite
Expand Down
30 changes: 15 additions & 15 deletions src/main/scala/com/raquo/laminar/api/Laminar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ import org.scalajs.dom
// @TODO[Performance] Check if order of traits matters for quicker access (given trait linearization). Not sure how it's encoded in JS.

trait Laminar
extends HtmlTags
with HtmlAttrs
with HtmlProps
with GlobalEventProps
with StyleProps
with ComplexHtmlKeys
with MountHooks // onMountFocus, onMountSet, onMountBind, OnMountCallback, OnUnmountCallback, etc.
with AirstreamAliases
with LaminarAliases
with Implicits {
extends HtmlTags
with HtmlAttrs
with HtmlProps
with GlobalEventProps
with StyleProps
with ComplexHtmlKeys
with MountHooks // onMountFocus, onMountSet, onMountBind, OnMountCallback, OnUnmountCallback, etc.
with AirstreamAliases
with LaminarAliases
with Implicits {

/** Contains Helpers like `style.px(12)` // returns "12px" */
object style
extends StyleUnitsApi
extends StyleUnitsApi

/** Contains ARIA attrs for accessibility */
object aria
extends AriaAttrs
extends AriaAttrs

// @TODO[API] Add GlobalEventProps to SVG as well?
// Regular event props work fine, but they might be hard to import if you also import svg._
/** Contains SVG tags and attrs */
object svg
extends SvgTags
with SvgAttrs
with ComplexSvgKeys
extends SvgTags
with SvgAttrs
with ComplexSvgKeys

//
// Document & window events
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/com/raquo/laminar/api/StyleUnitsApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import com.raquo.laminar.defs.styles.units
import com.raquo.laminar.keys.DerivedStyleBuilder

trait StyleUnitsApi extends DerivedStyleBuilder[String, StyleEncoder]
with units.Color[String, StyleEncoder]
with units.Length[StyleEncoder, Int]
with units.Time[StyleEncoder]
with units.Url[StyleEncoder] {
with units.Color[String, StyleEncoder]
with units.Length[StyleEncoder, Int]
with units.Time[StyleEncoder]
with units.Url[StyleEncoder] {

override protected def styleSetter(value: String): String = value

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/raquo/laminar/nodes/ChildNode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import scala.annotation.tailrec
import scala.scalajs.js

trait ChildNode[+Ref <: dom.Node]
extends ReactiveNode[Ref]
with Modifier[ReactiveElement[dom.Element]] {
extends ReactiveNode[Ref]
with Modifier[ReactiveElement[dom.Element]] {

private var _maybeParent: Option[ParentNode.Base] = None

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/raquo/laminar/nodes/ReactiveElement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import org.scalajs.dom
import scala.scalajs.js

trait ReactiveElement[+Ref <: dom.Element]
extends ChildNode[Ref]
with ParentNode[Ref] {
extends ChildNode[Ref]
with ParentNode[Ref] {

// @Warning[Fragile] deactivate should not need an isActive guard.
// If Laminar starts to cause exceptions here, we need to find the root cause.
Expand Down
8 changes: 4 additions & 4 deletions src/test/scala/com/raquo/laminar/utils/AsyncUnitSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import scala.scalajs.js
import scala.util.Try

class AsyncUnitSpec
extends AsyncFunSpec
with LaminarSpec
with AsyncMountSpec
with Utils {
extends AsyncFunSpec
with LaminarSpec
with AsyncMountSpec
with Utils {

// @TODO[Test] Extract this to a more generic place
def delay[V](value: => V): Future[V] = {
Expand Down
6 changes: 3 additions & 3 deletions src/test/scala/com/raquo/laminar/utils/LaminarSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import com.raquo.laminar.tags.Tag
import org.scalactic

trait LaminarSpec
extends MountOps
with RuleImplicits[Tag.Base, CommentNode, HtmlProp, HtmlAttr, SvgAttr, StyleProp]
with EventSimulator {
extends MountOps
with RuleImplicits[Tag.Base, CommentNode, HtmlProp, HtmlAttr, SvgAttr, StyleProp]
with EventSimulator {
// === On nullable variables ===
// `root` is nullable because if it was an Option it would be too easy to
// forget to handle the `None` case when mapping or foreach-ing over it.
Expand Down
10 changes: 5 additions & 5 deletions src/test/scala/com/raquo/laminar/utils/UnitSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.raquo.domtestutils.scalatest.{Matchers, MountSpec}
import org.scalatest.funspec.AnyFunSpec

class UnitSpec
extends AnyFunSpec
with LaminarSpec
with MountSpec
with Matchers
with Utils
extends AnyFunSpec
with LaminarSpec
with MountSpec
with Matchers
with Utils

0 comments on commit 679a261

Please sign in to comment.