Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Test
run: sbt ++${{ matrix.scala }} clean test "scalafixAll --check"
run: sbt ++${{ matrix.scala }} clean test scalafmtCheckAll scalafmtSbtCheck "scalafixAll --check"
146 changes: 146 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
version = 3.3.0

maxColumn = 120

assumeStandardLibraryStripMargin = true

runner.dialect = scala213source3

indent.main = 2
indent.callSite = 2
indent.ctrlSite = 2
indent.defnSite = 2
indent.ctorSite = 2
indent.caseSite = 2
indent.extendSite = 4
indent.withSiteRelativeToExtends = 2
indent.commaSiteRelativeToExtends = 4
indent.extraBeforeOpenParenDefnSite = 2

indentOperator.topLevelOnly = false

align.preset = some
align.tokens = [
{code = "%", owner = "Term.ApplyInfix"},
{code = "%%", owner = "Term.ApplyInfix"},
{code = "%%%", owner = "Term.ApplyInfix"},
{code = "=>", owner = "Case"}
]
align.arrowEnumeratorGenerator = false
align.closeParenSite = false
align.openParenCallSite = false
align.openParenDefnSite = false
align.openParenTupleSite = true
align.stripMargin = true
align.multiline = false

newlines.source = keep
newlines.topLevelStatementBlankLines = [
{
blanks { before = 1, after = 1 }
}
]
newlines.beforeTemplateBodyIfBreakInParentCtors = true
newlines.beforeMultiline = fold
newlines.alwaysBeforeElseAfterCurlyIf = false
newlines.beforeCurlyLambdaParams = never
newlines.afterCurlyLambdaParams = squash
newlines.implicitParamListModifierForce = [after]
newlines.avoidForSimpleOverflow = [punct]
newlines.avoidInResultType = true
newlines.neverBeforeJsNative = true
newlines.sometimesBeforeColonInMethodReturnType = false

danglingParentheses.defnSite = true
danglingParentheses.callSite = true
danglingParentheses.ctrlSite = true
danglingParentheses.tupleSite = true

runner.optimizer.forceConfigStyleOnOffset = 60
runner.optimizer.forceConfigStyleMinArgCount = 1

rewrite.rules = [
AvoidInfix,
RedundantBraces,
RedundantParens,
SortModifiers,
PreferCurlyFors
]
rewrite.neverInfix.excludeFilters."+" = [
# better for play-framework
and, andKeep, andThen,
# For scalatest
in, should, shouldBe, when, must, mustEqual, mustBe, "must_==="
]
rewrite.redundantBraces.stringInterpolation = true
rewrite.redundantBraces.generalExpressions = true
rewrite.redundantBraces.ifElseExpressions = true
rewrite.redundantBraces.methodBodies = true
rewrite.redundantBraces.includeUnitMethods = false
rewrite.redundantBraces.parensForOneLineApply = true
rewrite.trailingCommas.style = never

verticalMultiline.atDefnSite = false
verticalMultiline.newlineAfterOpenParen = true

spaces.beforeContextBoundColon = Never
spaces.inImportCurlyBraces = false
spaces.inInterpolatedStringCurlyBraces = false
spaces.inParentheses = false
spaces.afterKeywordBeforeParen = true
spaces.inByNameTypes = true
spaces.afterSymbolicDefs = false
spaces.neverAroundInfixTypes = ["##"]

literals.long = Upper
literals.float = Upper
literals.double = Upper
literals.hexPrefix = Lower
literals.hexDigits = Lower
literals.scientific = Lower

xmlLiterals.assumeFormatted = true

binPack.literalArgumentLists = true

includeCurlyBraceInSelectChains = true
includeNoParensInSelectChains = true

optIn.annotationNewlines = true
optIn.configStyleArguments = true
optIn.breakChainOnFirstMethodDot = true
optIn.breaksInsideChains = false
optIn.encloseClassicChains = false
optIn.forceBlankLineBeforeDocstring = true

rewriteTokens = {
"⇒": "=>"
"→": "->"
"←": "<-"
}

project.includePaths."+" = ["glob:**.md"]

fileOverride {
"glob:**/project/**.scala" {
newlines.source = unfold
}
"glob:**/project/Dependencies.scala" {
maxColumn = 150
align.preset = most
align.multiline = true
danglingParentheses.preset = false
}
"glob:**/project/DependenciesNPM.scala" {
maxColumn = 150
align.preset = more
align.multiline = true
align.tokens."+" = [
{code = "->", owner = "Term.ApplyInfix"}
]
}
"glob:**/build.sbt" {
maxColumn = 80
newlines.source = unfold
}
}
21 changes: 11 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
lazy val root =
if (ProjectSettings.isDemoEnabled)
project.in(file(".")).aggregate(core, icons, lab, bridge, demo).configure(ProjectSettings.rootProfile)
else
project.in(file(".")).aggregate(core, icons, lab, bridge).configure(ProjectSettings.rootProfile)
if (ProjectSettings.isDemoEnabled) project
.in(file("."))
.aggregate(core, icons, lab, bridge, demo)
.configure(ProjectSettings.rootProfile)
else project
.in(file("."))
.aggregate(core, icons, lab, bridge)
.configure(ProjectSettings.rootProfile)

lazy val core = project
.in(file("core"))
Expand Down Expand Up @@ -51,9 +55,6 @@ inThisBuild(
)
// format: on

onLoad in Global := (
"project bridge" ::
"bridgeImplicitsGenerator" ::
"project root" ::
(_: State)
) compose (onLoad in Global).value
onLoad in Global :=
("project bridge" :: "bridgeImplicitsGenerator" :: "project root" :: (_: State))
.compose((onLoad in Global).value)
7 changes: 6 additions & 1 deletion commands.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
addCommandAlias("fix", "+scalafixAll")
addCommandAlias("fmt", "+scalafmtAll; +demo/scalafmt; +scalafmtSbt;")
addCommandAlias("format", "fix;fmt;")

addCommandAlias("dev", "; demo/fastOptJS::stopWebpackDevServer; ~demo/fastOptJS::startWebpackDevServer")
addCommandAlias(
"dev",
"; demo/fastOptJS::stopWebpackDevServer; ~demo/fastOptJS::startWebpackDevServer"
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ object MuiAppBar extends ReactBridgeComponent with MuiAppBarExtensions {
elevation: js.UndefOr[Int] = js.undefined,
square: js.UndefOr[Boolean] = js.undefined
): WithProps = auto

}

trait MuiAppBarExtensions {

object Color extends Enumeration {
type Value = String

Expand Down Expand Up @@ -56,4 +58,5 @@ trait MuiAppBarExtensions {
val colorPrimary = "colorPrimary"
val colorSecondary = "colorSecondary"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ object MuiAvatar extends ReactBridgeComponent with MuiAvatarExtensions {
component: js.UndefOr[ComponentPropType] = js.undefined,
imgProps: js.UndefOr[js.Object] = js.undefined
): WithProps = auto

}

trait MuiAvatarExtensions {

object ClassKey extends Enumeration {
type Value = String

val root = "root"
val colorDefault = "colorDefault"
val img = "img"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ object MuiBackdrop extends ReactBridgeComponent with MuiBackdropExtensions {
object RawComponent extends js.Function

def apply(
classes:js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
invisible: js.UndefOr[Boolean] = js.undefined,
open: Boolean,
transitionDuration: js.UndefOr[Int | js.Object] = js.undefined
): WithPropsNoChildren = autoNoChildren

}

trait MuiBackdropExtensions {

object ClassKey extends Enumeration {
type Value = String

val root = "root"
val invisible = "invisible"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ object MuiBadge extends ReactBridgeComponent with MuiBadgeExtensions {

def apply(
badgeContent: js.UndefOr[VdomNode] = js.undefined,
classes: js.UndefOr[Map[ClassKey.Value, String]] =js.undefined,
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
color: js.UndefOr[Color.Value] = js.undefined,
component: js.UndefOr[ComponentPropType] = js.undefined,
invisible: js.UndefOr[Boolean] = js.undefined,
max: js.UndefOr[Int] = js.undefined,
showZero: js.UndefOr[Boolean] = js.undefined,
variant: js.UndefOr[Variant.Value] = js.undefined
): WithProps = auto

}

trait MuiBadgeExtensions {

object Color extends Enumeration {
type Value = String

Expand Down Expand Up @@ -54,4 +56,5 @@ trait MuiBadgeExtensions {
val invisible = "invisible"
val dot = "dot"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ object MuiBottomNavigation extends ReactBridgeComponent with MuiBottomNavigation
onChange: js.UndefOr[ReactHandler2[ReactEvent, js.Any]] = js.undefined,
showLabels: js.UndefOr[Boolean] = js.undefined
): WithProps = auto

}

trait MuiBottomNavigationExtensions {

object ClassKey extends Enumeration {
type Value = String

val root = "root"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ object MuiBottomNavigationAction extends ReactBridgeComponent with MuiBottomNavi
onFocusVisible: js.UndefOr[js.Function] = js.undefined,
TouchRippleProps: js.UndefOr[js.Object] = js.undefined
): WithProps = auto

}

trait MuiBottomNavigationActionExtensions {

object ClassKey extends Enumeration {
type Value = String

Expand All @@ -44,4 +46,5 @@ trait MuiBottomNavigationActionExtensions {
val disabled = "disabled"
val focusVisible = "focusVisible"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ object MuiButton extends ReactBridgeComponent with MuiButtonExtensions {
onFocusVisible: js.UndefOr[js.Function] = js.undefined,
TouchRippleProps: js.UndefOr[js.Object] = js.undefined
): WithProps = auto

}

trait MuiButtonExtensions {

object Color extends Enumeration {
type Value = String

Expand Down Expand Up @@ -93,4 +95,5 @@ trait MuiButtonExtensions {
val sizeLarge = "sizeLarge"
val fullWidth = "fullWidth"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ object MuiButtonBase extends ReactBridgeComponent with MuiButtonBaseExtensions {
onFocusVisible: js.UndefOr[js.Function] = js.undefined,
TouchRippleProps: js.UndefOr[js.Object] = js.undefined
): WithProps = auto

}

trait MuiButtonBaseExtensions {

object ClassKey extends Enumeration {
type Value = String

val root = "root"
val disabled = "disabled"
val focusVisible = "focusVisible"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ object MuiCard extends ReactBridgeComponent with MuiCardExtensions {
elevation: js.UndefOr[Int] = js.undefined,
square: js.UndefOr[Boolean] = js.undefined
): WithPropsNoChildren = autoNoChildren

}

trait MuiCardExtensions {

object ClassKey extends Enumeration with PaperClassKey {
type Value = String
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ object MuiCardActionArea extends ReactBridgeComponent with MuiCardActionAreaExte
onFocusVisible: js.UndefOr[js.Function] = js.undefined,
TouchRippleProps: js.UndefOr[js.Object] = js.undefined
): WithProps = auto

}

trait MuiCardActionAreaExtensions {

object ClassKey extends Enumeration {
type Value = String

Expand All @@ -36,4 +38,5 @@ trait MuiCardActionAreaExtensions {
val focusHighlight = "focusHighlight"
val disabled = "disabled"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ object MuiCardActions extends ReactBridgeComponent with MuiCardActionsExtensions
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
disableActionSpacing: js.UndefOr[Boolean] = js.undefined
): WithProps = auto

}

trait MuiCardActionsExtensions {

object ClassKey extends Enumeration {
type Value = String

val root = "root"
val disableActionSpacing = "disableActionSpacing"
val action = "action"
}

}
Loading