Skip to content

Commit 38dab97

Browse files
authored
Merge pull request #259 from sjrd/scalafmt
Enable scalafmt.
2 parents bffc16d + ee0078f commit 38dab97

File tree

7 files changed

+101
-81
lines changed

7 files changed

+101
-81
lines changed

.scalafmt.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project.git = true
2+
style = Scala.js
3+
project.includeFilters = ["src/main/scala/org/scalajs/.*\\.scala"]
4+
bestEffortInDeeplyNestedCode = true

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ sudo: false
22
language: scala
33
script:
44
- sbt ++$TRAVIS_SCALA_VERSION package doc
5+
- sbt scalafmtTest
56
- sbt ++2.11.8 readme/run
67
scala:
78
- 2.10.6

project/build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.14")
22

33
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.2.1")
4+
5+
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.5.1")

src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -107,25 +107,28 @@ object CollatorOptions {
107107
* default is "false". This option can be set through an options
108108
* property or through a Unicode extension key; if both are provided,
109109
* the options property takes precedence. Implementations are not
110-
* required to support this property.
110+
* required to support this property.
111111
*
112112
* MDN
113113
*/
114114
def apply(
115-
localeMatcher: js.UndefOr[String] = js.undefined,
116-
usage: js.UndefOr[String] = js.undefined,
117-
sensivity: js.UndefOr[String] = js.undefined,
115+
localeMatcher: js.UndefOr[String] = js.undefined,
116+
usage: js.UndefOr[String] = js.undefined,
117+
sensivity: js.UndefOr[String] = js.undefined,
118118
ignore­Punctua­tion: js.UndefOr[Boolean] = js.undefined,
119119
numeric: js.UndefOr[Boolean] = js.undefined,
120-
caseFirst: js.UndefOr[String] = js.undefined): CollatorOptions = {
121-
js.Dynamic.literal(
122-
localeMatcher = localeMatcher,
123-
usage = usage,
124-
sensivity = sensivity,
125-
ignore­Punctua­tion = ignore­Punctua­tion,
126-
numeric = numeric,
127-
caseFirst = caseFirst
128-
).asInstanceOf[CollatorOptions]
120+
caseFirst: js.UndefOr[String] = js.undefined
121+
): CollatorOptions = {
122+
js.Dynamic
123+
.literal(
124+
localeMatcher = localeMatcher,
125+
usage = usage,
126+
sensivity = sensivity,
127+
ignore­Punctua­tion = ignore­Punctua­tion,
128+
numeric = numeric,
129+
caseFirst = caseFirst
130+
)
131+
.asInstanceOf[CollatorOptions]
129132
}
130133
}
131134

@@ -149,7 +152,7 @@ trait DateTimeFormatOptions extends js.Object {
149152

150153
object DateTimeFormatOptions {
151154

152-
/**
155+
/**
153156
* @param localeMatcher The locale matching algorithm to use. Possible values are "lookup" and
154157
* "best fit"; the default is "best fit".
155158
* For information about this option, see the Intl page.
@@ -178,35 +181,37 @@ object DateTimeFormatOptions {
178181
* MDN
179182
*/
180183
def apply(
181-
localeMatcher: js.UndefOr[String] = js.undefined,
182-
timeZone: js.UndefOr[String] = js.undefined,
184+
localeMatcher: js.UndefOr[String] = js.undefined,
185+
timeZone: js.UndefOr[String] = js.undefined,
183186
hour12: js.UndefOr[Boolean] = js.undefined,
184-
formatMatcher: js.UndefOr[String] = js.undefined,
185-
186-
weekday: js.UndefOr[String] = js.undefined,
187-
era: js.UndefOr[String] = js.undefined,
188-
year: js.UndefOr[String] = js.undefined,
189-
month: js.UndefOr[String] = js.undefined,
190-
day: js.UndefOr[String] = js.undefined,
191-
hour: js.UndefOr[String] = js.undefined,
192-
minute: js.UndefOr[String] = js.undefined,
193-
second: js.UndefOr[String] = js.undefined,
194-
timeZoneName: js.UndefOr[String] = js.undefined): DateTimeFormatOptions = {
195-
js.Dynamic.literal(
196-
localeMatcher = localeMatcher,
197-
timeZone = timeZone,
198-
hour12 = hour12,
199-
formatMatcher = formatMatcher,
200-
weekday = weekday,
201-
era = era,
202-
year = year,
203-
month = month,
204-
day = day,
205-
hour = hour,
206-
minute = minute,
207-
second = second,
208-
timeZoneName = timeZoneName
209-
).asInstanceOf[DateTimeFormatOptions]
187+
formatMatcher: js.UndefOr[String] = js.undefined,
188+
weekday: js.UndefOr[String] = js.undefined,
189+
era: js.UndefOr[String] = js.undefined,
190+
year: js.UndefOr[String] = js.undefined,
191+
month: js.UndefOr[String] = js.undefined,
192+
day: js.UndefOr[String] = js.undefined,
193+
hour: js.UndefOr[String] = js.undefined,
194+
minute: js.UndefOr[String] = js.undefined,
195+
second: js.UndefOr[String] = js.undefined,
196+
timeZoneName: js.UndefOr[String] = js.undefined
197+
): DateTimeFormatOptions = {
198+
js.Dynamic
199+
.literal(
200+
localeMatcher = localeMatcher,
201+
timeZone = timeZone,
202+
hour12 = hour12,
203+
formatMatcher = formatMatcher,
204+
weekday = weekday,
205+
era = era,
206+
year = year,
207+
month = month,
208+
day = day,
209+
hour = hour,
210+
minute = minute,
211+
second = second,
212+
timeZoneName = timeZoneName
213+
)
214+
.asInstanceOf[DateTimeFormatOptions]
210215
}
211216
}
212217

@@ -273,34 +278,35 @@ object NumberFormatOptions {
273278
* @param minimumSignificantDigits The minimum number of significant digits to use. Possible
274279
* values are from 1 to 21; the default is 1.
275280
* @param maximumSignificantDigits The maximum number of significant digits to use. Possible
276-
* values are from 1 to 21; the default is minimumSignificantDigits.
281+
* values are from 1 to 21; the default is minimumSignificantDigits.
277282
*
278283
* MDN
279284
*/
280285
def apply(
281-
localeMatcher: js.UndefOr[String] = js.undefined,
282-
style: js.UndefOr[String] = js.undefined,
283-
currency: js.UndefOr[String] = js.undefined,
284-
currencyDisplay: js.UndefOr[String] = js.undefined,
286+
localeMatcher: js.UndefOr[String] = js.undefined,
287+
style: js.UndefOr[String] = js.undefined,
288+
currency: js.UndefOr[String] = js.undefined,
289+
currencyDisplay: js.UndefOr[String] = js.undefined,
285290
useGrouping: js.UndefOr[Boolean] = js.undefined,
286-
287-
minimumIntegerDigits: js.UndefOr[Double] = js.undefined,
288-
minimumFractionDigits: js.UndefOr[Double] = js.undefined,
289-
maximumFractionDigits: js.UndefOr[Double] = js.undefined,
290-
291-
minimumSignificantDigits: js.UndefOr[Double] = js.undefined,
292-
maximumSignificantDigits: js.UndefOr[Double] = js.undefined): NumberFormatOptions = {
293-
js.Dynamic.literal(
294-
localeMatcher = localeMatcher,
295-
style = style,
296-
currency = currency,
297-
currencyDisplay = currencyDisplay,
298-
useGrouping = useGrouping,
299-
minimumIntegerDigits = minimumIntegerDigits,
300-
minimumFractionDigits = minimumFractionDigits,
301-
maximumFractionDigits = maximumFractionDigits,
302-
minimumSignificantDigits = minimumSignificantDigits,
303-
maximumSignificantDigits = maximumSignificantDigits
304-
).asInstanceOf[NumberFormatOptions]
291+
minimumIntegerDigits: js.UndefOr[Double] = js.undefined,
292+
minimumFractionDigits: js.UndefOr[Double] = js.undefined,
293+
maximumFractionDigits: js.UndefOr[Double] = js.undefined,
294+
minimumSignificantDigits: js.UndefOr[Double] = js.undefined,
295+
maximumSignificantDigits: js.UndefOr[Double] = js.undefined
296+
): NumberFormatOptions = {
297+
js.Dynamic
298+
.literal(
299+
localeMatcher = localeMatcher,
300+
style = style,
301+
currency = currency,
302+
currencyDisplay = currencyDisplay,
303+
useGrouping = useGrouping,
304+
minimumIntegerDigits = minimumIntegerDigits,
305+
minimumFractionDigits = minimumFractionDigits,
306+
maximumFractionDigits = maximumFractionDigits,
307+
minimumSignificantDigits = minimumSignificantDigits,
308+
maximumSignificantDigits = maximumSignificantDigits
309+
)
310+
.asInstanceOf[NumberFormatOptions]
305311
}
306312
}

src/main/scala/org/scalajs/dom/experimental/serviceworkers/ServiceWorkers.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ trait Clients extends js.Object {
584584
def get(id: String): js.Promise[js.UndefOr[Client]] = js.native
585585

586586
def matchAll(
587-
options: js.UndefOr[ClientQueryOptions] = js.native): js.Promise[js.Array[Client]] = js.native
587+
options: js.UndefOr[
588+
ClientQueryOptions] = js.native): js.Promise[js.Array[Client]] = js.native
588589

589590
def openWindow(url: String): js.Promise[WindowClient] = js.native
590591

@@ -598,10 +599,12 @@ trait Clients extends js.Object {
598599
@js.native
599600
abstract class Cache extends js.Object {
600601
def `match`(request: RequestInfo,
601-
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[js.UndefOr[Response]] = js.native
602+
options: js.UndefOr[
603+
CacheQueryOptions] = js.native): js.Promise[js.UndefOr[Response]] = js.native
602604

603605
def matchAll(request: RequestInfo = js.native,
604-
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[js.Array[Response]] = js.native
606+
options: js.UndefOr[
607+
CacheQueryOptions] = js.native): js.Promise[js.Array[Response]] = js.native
605608

606609
def add(request: RequestInfo): js.Promise[Unit] = js.native
607610

@@ -611,10 +614,12 @@ abstract class Cache extends js.Object {
611614
response: Response): js.Promise[Unit] = js.native
612615

613616
def delete(request: RequestInfo,
614-
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[Boolean] = js.native
617+
options: js.UndefOr[
618+
CacheQueryOptions] = js.native): js.Promise[Boolean] = js.native
615619

616620
def keys(request: js.UndefOr[RequestInfo] = js.native,
617-
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[js.Array[Request]]
621+
options: js.UndefOr[
622+
CacheQueryOptions] = js.native): js.Promise[js.Array[Request]]
618623
}
619624

620625
/**

src/main/scala/org/scalajs/dom/experimental/webrtc/WebRTC.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,8 @@ class RTCPeerConnection(
10551055
* view - it's probably around as bad as access to a canvas :-)
10561056
*
10571057
*/
1058-
def createOffer(options: RTCOfferOptions = js.native): js.Promise[
1059-
RTCSessionDescription] = js.native
1058+
def createOffer(
1059+
options: RTCOfferOptions = js.native): js.Promise[RTCSessionDescription] = js.native
10601060

10611061
/**
10621062
* The createAnswer method generates an [SDP] answer with the supported

src/main/scala/org/scalajs/dom/raw/lib.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4346,14 +4346,16 @@ object MutationObserverInit {
43464346
characterDataOldValue: Boolean = false,
43474347
attributeFilter: js.UndefOr[js.Array[String]] = js.undefined
43484348
): MutationObserverInit = {
4349-
val res = js.Dynamic.literal(
4350-
"childList" -> childList,
4351-
"attributes" -> attributes,
4352-
"characterData" -> characterData,
4353-
"subtree" -> subtree,
4354-
"attributeOldValue" -> attributeOldValue,
4355-
"characterDataOldValue" -> characterDataOldValue
4356-
).asInstanceOf[MutationObserverInit]
4349+
val res = js.Dynamic
4350+
.literal(
4351+
"childList" -> childList,
4352+
"attributes" -> attributes,
4353+
"characterData" -> characterData,
4354+
"subtree" -> subtree,
4355+
"attributeOldValue" -> attributeOldValue,
4356+
"characterDataOldValue" -> characterDataOldValue
4357+
)
4358+
.asInstanceOf[MutationObserverInit]
43574359
attributeFilter.foreach(res.attributeFilter = _)
43584360
res
43594361
}

0 commit comments

Comments
 (0)