Skip to content

Commit 2afd123

Browse files
authored
Merge pull request #98 from kinoplan/maintenance/add_scalafmt
Add scalafmt
2 parents 66b032f + 043356c commit 2afd123

File tree

524 files changed

+5138
-2862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

524 files changed

+5138
-2862
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
3434

3535
- name: Test
36-
run: sbt ++${{ matrix.scala }} clean test "scalafixAll --check"
36+
run: sbt ++${{ matrix.scala }} clean test scalafmtCheckAll scalafmtSbtCheck "scalafixAll --check"

.scalafmt.conf

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
version = 3.3.0
2+
3+
maxColumn = 120
4+
5+
assumeStandardLibraryStripMargin = true
6+
7+
runner.dialect = scala213source3
8+
9+
indent.main = 2
10+
indent.callSite = 2
11+
indent.ctrlSite = 2
12+
indent.defnSite = 2
13+
indent.ctorSite = 2
14+
indent.caseSite = 2
15+
indent.extendSite = 4
16+
indent.withSiteRelativeToExtends = 2
17+
indent.commaSiteRelativeToExtends = 4
18+
indent.extraBeforeOpenParenDefnSite = 2
19+
20+
indentOperator.topLevelOnly = false
21+
22+
align.preset = some
23+
align.tokens = [
24+
{code = "%", owner = "Term.ApplyInfix"},
25+
{code = "%%", owner = "Term.ApplyInfix"},
26+
{code = "%%%", owner = "Term.ApplyInfix"},
27+
{code = "=>", owner = "Case"}
28+
]
29+
align.arrowEnumeratorGenerator = false
30+
align.closeParenSite = false
31+
align.openParenCallSite = false
32+
align.openParenDefnSite = false
33+
align.openParenTupleSite = true
34+
align.stripMargin = true
35+
align.multiline = false
36+
37+
newlines.source = keep
38+
newlines.topLevelStatementBlankLines = [
39+
{
40+
blanks { before = 1, after = 1 }
41+
}
42+
]
43+
newlines.beforeTemplateBodyIfBreakInParentCtors = true
44+
newlines.beforeMultiline = fold
45+
newlines.alwaysBeforeElseAfterCurlyIf = false
46+
newlines.beforeCurlyLambdaParams = never
47+
newlines.afterCurlyLambdaParams = squash
48+
newlines.implicitParamListModifierForce = [after]
49+
newlines.avoidForSimpleOverflow = [punct]
50+
newlines.avoidInResultType = true
51+
newlines.neverBeforeJsNative = true
52+
newlines.sometimesBeforeColonInMethodReturnType = false
53+
54+
danglingParentheses.defnSite = true
55+
danglingParentheses.callSite = true
56+
danglingParentheses.ctrlSite = true
57+
danglingParentheses.tupleSite = true
58+
59+
runner.optimizer.forceConfigStyleOnOffset = 60
60+
runner.optimizer.forceConfigStyleMinArgCount = 1
61+
62+
rewrite.rules = [
63+
AvoidInfix,
64+
RedundantBraces,
65+
RedundantParens,
66+
SortModifiers,
67+
PreferCurlyFors
68+
]
69+
rewrite.neverInfix.excludeFilters."+" = [
70+
# better for play-framework
71+
and, andKeep, andThen,
72+
# For scalatest
73+
in, should, shouldBe, when, must, mustEqual, mustBe, "must_==="
74+
]
75+
rewrite.redundantBraces.stringInterpolation = true
76+
rewrite.redundantBraces.generalExpressions = true
77+
rewrite.redundantBraces.ifElseExpressions = true
78+
rewrite.redundantBraces.methodBodies = true
79+
rewrite.redundantBraces.includeUnitMethods = false
80+
rewrite.redundantBraces.parensForOneLineApply = true
81+
rewrite.trailingCommas.style = never
82+
83+
verticalMultiline.atDefnSite = false
84+
verticalMultiline.newlineAfterOpenParen = true
85+
86+
spaces.beforeContextBoundColon = Never
87+
spaces.inImportCurlyBraces = false
88+
spaces.inInterpolatedStringCurlyBraces = false
89+
spaces.inParentheses = false
90+
spaces.afterKeywordBeforeParen = true
91+
spaces.inByNameTypes = true
92+
spaces.afterSymbolicDefs = false
93+
spaces.neverAroundInfixTypes = ["##"]
94+
95+
literals.long = Upper
96+
literals.float = Upper
97+
literals.double = Upper
98+
literals.hexPrefix = Lower
99+
literals.hexDigits = Lower
100+
literals.scientific = Lower
101+
102+
xmlLiterals.assumeFormatted = true
103+
104+
binPack.literalArgumentLists = true
105+
106+
includeCurlyBraceInSelectChains = true
107+
includeNoParensInSelectChains = true
108+
109+
optIn.annotationNewlines = true
110+
optIn.configStyleArguments = true
111+
optIn.breakChainOnFirstMethodDot = true
112+
optIn.breaksInsideChains = false
113+
optIn.encloseClassicChains = false
114+
optIn.forceBlankLineBeforeDocstring = true
115+
116+
rewriteTokens = {
117+
"⇒": "=>"
118+
"→": "->"
119+
"←": "<-"
120+
}
121+
122+
project.includePaths."+" = ["glob:**.md"]
123+
124+
fileOverride {
125+
"glob:**/project/**.scala" {
126+
newlines.source = unfold
127+
}
128+
"glob:**/project/Dependencies.scala" {
129+
maxColumn = 150
130+
align.preset = most
131+
align.multiline = true
132+
danglingParentheses.preset = false
133+
}
134+
"glob:**/project/DependenciesNPM.scala" {
135+
maxColumn = 150
136+
align.preset = more
137+
align.multiline = true
138+
align.tokens."+" = [
139+
{code = "->", owner = "Term.ApplyInfix"}
140+
]
141+
}
142+
"glob:**/build.sbt" {
143+
maxColumn = 80
144+
newlines.source = unfold
145+
}
146+
}

build.sbt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
lazy val root =
2-
if (ProjectSettings.isDemoEnabled)
3-
project.in(file(".")).aggregate(core, icons, lab, bridge, demo).configure(ProjectSettings.rootProfile)
4-
else
5-
project.in(file(".")).aggregate(core, icons, lab, bridge).configure(ProjectSettings.rootProfile)
2+
if (ProjectSettings.isDemoEnabled) project
3+
.in(file("."))
4+
.aggregate(core, icons, lab, bridge, demo)
5+
.configure(ProjectSettings.rootProfile)
6+
else project
7+
.in(file("."))
8+
.aggregate(core, icons, lab, bridge)
9+
.configure(ProjectSettings.rootProfile)
610

711
lazy val core = project
812
.in(file("core"))
@@ -51,9 +55,6 @@ inThisBuild(
5155
)
5256
// format: on
5357

54-
onLoad in Global := (
55-
"project bridge" ::
56-
"bridgeImplicitsGenerator" ::
57-
"project root" ::
58-
(_: State)
59-
) compose (onLoad in Global).value
58+
onLoad in Global :=
59+
("project bridge" :: "bridgeImplicitsGenerator" :: "project root" :: (_: State))
60+
.compose((onLoad in Global).value)

commands.sbt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
addCommandAlias("fix", "+scalafixAll")
2+
addCommandAlias("fmt", "+scalafmtAll; +demo/scalafmt; +scalafmtSbt;")
3+
addCommandAlias("format", "fix;fmt;")
24

3-
addCommandAlias("dev", "; demo/fastOptJS::stopWebpackDevServer; ~demo/fastOptJS::startWebpackDevServer")
5+
addCommandAlias(
6+
"dev",
7+
"; demo/fastOptJS::stopWebpackDevServer; ~demo/fastOptJS::startWebpackDevServer"
8+
)

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiAppBar.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ object MuiAppBar extends ReactBridgeComponent with MuiAppBarExtensions {
2121
elevation: js.UndefOr[Int] = js.undefined,
2222
square: js.UndefOr[Boolean] = js.undefined
2323
): WithProps = auto
24+
2425
}
2526

2627
trait MuiAppBarExtensions {
28+
2729
object Color extends Enumeration {
2830
type Value = String
2931

@@ -56,4 +58,5 @@ trait MuiAppBarExtensions {
5658
val colorPrimary = "colorPrimary"
5759
val colorSecondary = "colorSecondary"
5860
}
61+
5962
}

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiAvatar.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ object MuiAvatar extends ReactBridgeComponent with MuiAvatarExtensions {
1717
component: js.UndefOr[ComponentPropType] = js.undefined,
1818
imgProps: js.UndefOr[js.Object] = js.undefined
1919
): WithProps = auto
20+
2021
}
2122

2223
trait MuiAvatarExtensions {
24+
2325
object ClassKey extends Enumeration {
2426
type Value = String
2527

2628
val root = "root"
2729
val colorDefault = "colorDefault"
2830
val img = "img"
2931
}
32+
3033
}

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiBackdrop.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@ object MuiBackdrop extends ReactBridgeComponent with MuiBackdropExtensions {
1414
object RawComponent extends js.Function
1515

1616
def apply(
17-
classes:js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
17+
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
1818
invisible: js.UndefOr[Boolean] = js.undefined,
1919
open: Boolean,
2020
transitionDuration: js.UndefOr[Int | js.Object] = js.undefined
2121
): WithPropsNoChildren = autoNoChildren
22+
2223
}
2324

2425
trait MuiBackdropExtensions {
26+
2527
object ClassKey extends Enumeration {
2628
type Value = String
2729

2830
val root = "root"
2931
val invisible = "invisible"
3032
}
33+
3134
}

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiBadge.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ object MuiBadge extends ReactBridgeComponent with MuiBadgeExtensions {
1616

1717
def apply(
1818
badgeContent: js.UndefOr[VdomNode] = js.undefined,
19-
classes: js.UndefOr[Map[ClassKey.Value, String]] =js.undefined,
19+
classes: js.UndefOr[Map[ClassKey.Value, String]] = js.undefined,
2020
color: js.UndefOr[Color.Value] = js.undefined,
2121
component: js.UndefOr[ComponentPropType] = js.undefined,
2222
invisible: js.UndefOr[Boolean] = js.undefined,
2323
max: js.UndefOr[Int] = js.undefined,
2424
showZero: js.UndefOr[Boolean] = js.undefined,
2525
variant: js.UndefOr[Variant.Value] = js.undefined
2626
): WithProps = auto
27+
2728
}
2829

2930
trait MuiBadgeExtensions {
31+
3032
object Color extends Enumeration {
3133
type Value = String
3234

@@ -54,4 +56,5 @@ trait MuiBadgeExtensions {
5456
val invisible = "invisible"
5557
val dot = "dot"
5658
}
59+
5760
}

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiBottomNavigation.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ object MuiBottomNavigation extends ReactBridgeComponent with MuiBottomNavigation
2020
onChange: js.UndefOr[ReactHandler2[ReactEvent, js.Any]] = js.undefined,
2121
showLabels: js.UndefOr[Boolean] = js.undefined
2222
): WithProps = auto
23+
2324
}
2425

2526
trait MuiBottomNavigationExtensions {
27+
2628
object ClassKey extends Enumeration {
2729
type Value = String
2830

2931
val root = "root"
3032
}
33+
3134
}

core/src/main/scala/io/kinoplan/scalajs/react/material/ui/core/MuiBottomNavigationAction.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ object MuiBottomNavigationAction extends ReactBridgeComponent with MuiBottomNavi
3030
onFocusVisible: js.UndefOr[js.Function] = js.undefined,
3131
TouchRippleProps: js.UndefOr[js.Object] = js.undefined
3232
): WithProps = auto
33+
3334
}
3435

3536
trait MuiBottomNavigationActionExtensions {
37+
3638
object ClassKey extends Enumeration {
3739
type Value = String
3840

@@ -44,4 +46,5 @@ trait MuiBottomNavigationActionExtensions {
4446
val disabled = "disabled"
4547
val focusVisible = "focusVisible"
4648
}
49+
4750
}

0 commit comments

Comments
 (0)