Skip to content

Enable scalafmt. #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2016
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project.git = true
style = Scala.js
project.includeFilters = ["src/main/scala/org/scalajs/.*\\.scala"]
bestEffortInDeeplyNestedCode = true
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ sudo: false
language: scala
script:
- sbt ++$TRAVIS_SCALA_VERSION package doc
- sbt scalafmtTest
- sbt ++2.11.8 readme/run
scala:
- 2.10.6
Expand Down
2 changes: 2 additions & 0 deletions project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.14")

addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.2.1")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.5.1")
138 changes: 72 additions & 66 deletions src/main/scala/org/scalajs/dom/experimental/intl/Intl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,28 @@ object CollatorOptions {
* default is "false". This option can be set through an options
* property or through a Unicode extension key; if both are provided,
* the options property takes precedence. Implementations are not
* required to support this property.
* required to support this property.
*
* MDN
*/
def apply(
localeMatcher: js.UndefOr[String] = js.undefined,
usage: js.UndefOr[String] = js.undefined,
sensivity: js.UndefOr[String] = js.undefined,
localeMatcher: js.UndefOr[String] = js.undefined,
usage: js.UndefOr[String] = js.undefined,
sensivity: js.UndefOr[String] = js.undefined,
ignore­Punctua­tion: js.UndefOr[Boolean] = js.undefined,
numeric: js.UndefOr[Boolean] = js.undefined,
caseFirst: js.UndefOr[String] = js.undefined): CollatorOptions = {
js.Dynamic.literal(
localeMatcher = localeMatcher,
usage = usage,
sensivity = sensivity,
ignore­Punctua­tion = ignore­Punctua­tion,
numeric = numeric,
caseFirst = caseFirst
).asInstanceOf[CollatorOptions]
caseFirst: js.UndefOr[String] = js.undefined
): CollatorOptions = {
js.Dynamic
.literal(
localeMatcher = localeMatcher,
usage = usage,
sensivity = sensivity,
ignore­Punctua­tion = ignore­Punctua­tion,
numeric = numeric,
caseFirst = caseFirst
)
.asInstanceOf[CollatorOptions]
}
}

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

object DateTimeFormatOptions {

/**
/**
* @param localeMatcher The locale matching algorithm to use. Possible values are "lookup" and
* "best fit"; the default is "best fit".
* For information about this option, see the Intl page.
Expand Down Expand Up @@ -178,35 +181,37 @@ object DateTimeFormatOptions {
* MDN
*/
def apply(
localeMatcher: js.UndefOr[String] = js.undefined,
timeZone: js.UndefOr[String] = js.undefined,
localeMatcher: js.UndefOr[String] = js.undefined,
timeZone: js.UndefOr[String] = js.undefined,
hour12: js.UndefOr[Boolean] = js.undefined,
formatMatcher: js.UndefOr[String] = js.undefined,

weekday: js.UndefOr[String] = js.undefined,
era: js.UndefOr[String] = js.undefined,
year: js.UndefOr[String] = js.undefined,
month: js.UndefOr[String] = js.undefined,
day: js.UndefOr[String] = js.undefined,
hour: js.UndefOr[String] = js.undefined,
minute: js.UndefOr[String] = js.undefined,
second: js.UndefOr[String] = js.undefined,
timeZoneName: js.UndefOr[String] = js.undefined): DateTimeFormatOptions = {
js.Dynamic.literal(
localeMatcher = localeMatcher,
timeZone = timeZone,
hour12 = hour12,
formatMatcher = formatMatcher,
weekday = weekday,
era = era,
year = year,
month = month,
day = day,
hour = hour,
minute = minute,
second = second,
timeZoneName = timeZoneName
).asInstanceOf[DateTimeFormatOptions]
formatMatcher: js.UndefOr[String] = js.undefined,
weekday: js.UndefOr[String] = js.undefined,
era: js.UndefOr[String] = js.undefined,
year: js.UndefOr[String] = js.undefined,
month: js.UndefOr[String] = js.undefined,
day: js.UndefOr[String] = js.undefined,
hour: js.UndefOr[String] = js.undefined,
minute: js.UndefOr[String] = js.undefined,
second: js.UndefOr[String] = js.undefined,
timeZoneName: js.UndefOr[String] = js.undefined
): DateTimeFormatOptions = {
js.Dynamic
.literal(
localeMatcher = localeMatcher,
timeZone = timeZone,
hour12 = hour12,
formatMatcher = formatMatcher,
weekday = weekday,
era = era,
year = year,
month = month,
day = day,
hour = hour,
minute = minute,
second = second,
timeZoneName = timeZoneName
)
.asInstanceOf[DateTimeFormatOptions]
}
}

Expand Down Expand Up @@ -273,34 +278,35 @@ object NumberFormatOptions {
* @param minimumSignificantDigits The minimum number of significant digits to use. Possible
* values are from 1 to 21; the default is 1.
* @param maximumSignificantDigits The maximum number of significant digits to use. Possible
* values are from 1 to 21; the default is minimumSignificantDigits.
* values are from 1 to 21; the default is minimumSignificantDigits.
*
* MDN
*/
def apply(
localeMatcher: js.UndefOr[String] = js.undefined,
style: js.UndefOr[String] = js.undefined,
currency: js.UndefOr[String] = js.undefined,
currencyDisplay: js.UndefOr[String] = js.undefined,
localeMatcher: js.UndefOr[String] = js.undefined,
style: js.UndefOr[String] = js.undefined,
currency: js.UndefOr[String] = js.undefined,
currencyDisplay: js.UndefOr[String] = js.undefined,
useGrouping: js.UndefOr[Boolean] = js.undefined,

minimumIntegerDigits: js.UndefOr[Double] = js.undefined,
minimumFractionDigits: js.UndefOr[Double] = js.undefined,
maximumFractionDigits: js.UndefOr[Double] = js.undefined,

minimumSignificantDigits: js.UndefOr[Double] = js.undefined,
maximumSignificantDigits: js.UndefOr[Double] = js.undefined): NumberFormatOptions = {
js.Dynamic.literal(
localeMatcher = localeMatcher,
style = style,
currency = currency,
currencyDisplay = currencyDisplay,
useGrouping = useGrouping,
minimumIntegerDigits = minimumIntegerDigits,
minimumFractionDigits = minimumFractionDigits,
maximumFractionDigits = maximumFractionDigits,
minimumSignificantDigits = minimumSignificantDigits,
maximumSignificantDigits = maximumSignificantDigits
).asInstanceOf[NumberFormatOptions]
minimumIntegerDigits: js.UndefOr[Double] = js.undefined,
minimumFractionDigits: js.UndefOr[Double] = js.undefined,
maximumFractionDigits: js.UndefOr[Double] = js.undefined,
minimumSignificantDigits: js.UndefOr[Double] = js.undefined,
maximumSignificantDigits: js.UndefOr[Double] = js.undefined
): NumberFormatOptions = {
js.Dynamic
.literal(
localeMatcher = localeMatcher,
style = style,
currency = currency,
currencyDisplay = currencyDisplay,
useGrouping = useGrouping,
minimumIntegerDigits = minimumIntegerDigits,
minimumFractionDigits = minimumFractionDigits,
maximumFractionDigits = maximumFractionDigits,
minimumSignificantDigits = minimumSignificantDigits,
maximumSignificantDigits = maximumSignificantDigits
)
.asInstanceOf[NumberFormatOptions]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ trait Clients extends js.Object {
def get(id: String): js.Promise[js.UndefOr[Client]] = js.native

def matchAll(
options: js.UndefOr[ClientQueryOptions] = js.native): js.Promise[js.Array[Client]] = js.native
options: js.UndefOr[
ClientQueryOptions] = js.native): js.Promise[js.Array[Client]] = js.native

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

Expand All @@ -598,10 +599,12 @@ trait Clients extends js.Object {
@js.native
abstract class Cache extends js.Object {
def `match`(request: RequestInfo,
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[js.UndefOr[Response]] = js.native
options: js.UndefOr[
CacheQueryOptions] = js.native): js.Promise[js.UndefOr[Response]] = js.native

def matchAll(request: RequestInfo = js.native,
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[js.Array[Response]] = js.native
options: js.UndefOr[
CacheQueryOptions] = js.native): js.Promise[js.Array[Response]] = js.native

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

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

def delete(request: RequestInfo,
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[Boolean] = js.native
options: js.UndefOr[
CacheQueryOptions] = js.native): js.Promise[Boolean] = js.native

def keys(request: js.UndefOr[RequestInfo] = js.native,
options: js.UndefOr[CacheQueryOptions] = js.native): js.Promise[js.Array[Request]]
options: js.UndefOr[
CacheQueryOptions] = js.native): js.Promise[js.Array[Request]]
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,8 @@ class RTCPeerConnection(
* view - it's probably around as bad as access to a canvas :-)
*
*/
def createOffer(options: RTCOfferOptions = js.native): js.Promise[
RTCSessionDescription] = js.native
def createOffer(
options: RTCOfferOptions = js.native): js.Promise[RTCSessionDescription] = js.native

/**
* The createAnswer method generates an [SDP] answer with the supported
Expand Down
18 changes: 10 additions & 8 deletions src/main/scala/org/scalajs/dom/raw/lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4346,14 +4346,16 @@ object MutationObserverInit {
characterDataOldValue: Boolean = false,
attributeFilter: js.UndefOr[js.Array[String]] = js.undefined
): MutationObserverInit = {
val res = js.Dynamic.literal(
"childList" -> childList,
"attributes" -> attributes,
"characterData" -> characterData,
"subtree" -> subtree,
"attributeOldValue" -> attributeOldValue,
"characterDataOldValue" -> characterDataOldValue
).asInstanceOf[MutationObserverInit]
val res = js.Dynamic
.literal(
"childList" -> childList,
"attributes" -> attributes,
"characterData" -> characterData,
"subtree" -> subtree,
"attributeOldValue" -> attributeOldValue,
"characterDataOldValue" -> characterDataOldValue
)
.asInstanceOf[MutationObserverInit]
attributeFilter.foreach(res.attributeFilter = _)
res
}
Expand Down