Skip to content

Commit ea4884d

Browse files
committed
Enable ExplicitResultTypes
1 parent 25d2ace commit ea4884d

File tree

15 files changed

+267
-266
lines changed

15 files changed

+267
-266
lines changed

.scalafix.conf

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
rules = [
2+
ExplicitResultTypes,
23
OrganizeImports,
34
RemoveUnused,
45
GenerateApiReport,

api-reports/2_13.txt

+136-136
Large diffs are not rendered by default.

prePR.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ThisBuild / prePR_nonCross := Def.sequential(
2121

2222
dom / Compile / scalafmt,
2323
Def.taskDyn {
24-
if (scalaVersion.value.startsWith("2."))
24+
if (scalaVersion.value.startsWith("2.13."))
2525
(dom / Compile / scalafix).toTask("")
2626
else
2727
Def.task[Unit]((dom / Compile / compile).value)

src/main/scala/org/scalajs/dom/Fetch.scala

+38-38
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class Headers(map: HeadersInit = js.Array[js.Array[String]]()) extends js.Iterab
280280
sealed trait ReferrerPolicy extends js.Any
281281

282282
object ReferrerPolicy {
283-
val empty = "".asInstanceOf[ReferrerPolicy]
283+
val empty: ReferrerPolicy = "".asInstanceOf[ReferrerPolicy]
284284
val `no-referrer` = "no-referrer".asInstanceOf[ReferrerPolicy]
285285

286286
val `no-referrer-when-downgrade` =
@@ -298,14 +298,14 @@ object ReferrerPolicy {
298298
trait HttpMethod extends js.Any
299299

300300
object HttpMethod {
301-
val GET = "GET".asInstanceOf[HttpMethod]
302-
val POST = "POST".asInstanceOf[HttpMethod]
303-
val PUT = "PUT".asInstanceOf[HttpMethod]
304-
val PATCH = "PATCH".asInstanceOf[HttpMethod]
305-
val DELETE = "DELETE".asInstanceOf[HttpMethod]
306-
val QUERY = "QUERY".asInstanceOf[HttpMethod]
307-
val HEAD = "HEAD".asInstanceOf[HttpMethod]
308-
val OPTIONS = "OPTIONS".asInstanceOf[HttpMethod]
301+
val GET: HttpMethod = "GET".asInstanceOf[HttpMethod]
302+
val POST: HttpMethod = "POST".asInstanceOf[HttpMethod]
303+
val PUT: HttpMethod = "PUT".asInstanceOf[HttpMethod]
304+
val PATCH: HttpMethod = "PATCH".asInstanceOf[HttpMethod]
305+
val DELETE: HttpMethod = "DELETE".asInstanceOf[HttpMethod]
306+
val QUERY: HttpMethod = "QUERY".asInstanceOf[HttpMethod]
307+
val HEAD: HttpMethod = "HEAD".asInstanceOf[HttpMethod]
308+
val OPTIONS: HttpMethod = "OPTIONS".asInstanceOf[HttpMethod]
309309
}
310310

311311
/** Fetch APIs [[https://fetch.spec.whatwg.org/#requesttype RequestType enum]]
@@ -314,14 +314,14 @@ object HttpMethod {
314314
sealed trait RequestType extends js.Any
315315

316316
object RequestType {
317-
val empty = "".asInstanceOf[RequestType]
318-
val audio = "audio".asInstanceOf[RequestType]
319-
val font = "font".asInstanceOf[RequestType]
320-
val image = "image".asInstanceOf[RequestType]
321-
val script = "script".asInstanceOf[RequestType]
322-
val style = "style".asInstanceOf[RequestType]
323-
val track = "track".asInstanceOf[RequestType]
324-
val video = "video".asInstanceOf[RequestType]
317+
val empty: RequestType = "".asInstanceOf[RequestType]
318+
val audio: RequestType = "audio".asInstanceOf[RequestType]
319+
val font: RequestType = "font".asInstanceOf[RequestType]
320+
val image: RequestType = "image".asInstanceOf[RequestType]
321+
val script: RequestType = "script".asInstanceOf[RequestType]
322+
val style: RequestType = "style".asInstanceOf[RequestType]
323+
val track: RequestType = "track".asInstanceOf[RequestType]
324+
val video: RequestType = "video".asInstanceOf[RequestType]
325325
}
326326

327327
/** Fetch APIs [[https://fetch.spec.whatwg.org/#requestdestination RequestDestination enum]]
@@ -330,12 +330,12 @@ object RequestType {
330330
sealed trait RequestDestination extends js.Any
331331

332332
object RequestDestination {
333-
val empty = "".asInstanceOf[RequestDestination]
334-
val document = "document".asInstanceOf[RequestDestination]
335-
val sharedworker = "sharedworker".asInstanceOf[RequestDestination]
336-
val subresource = "subresource".asInstanceOf[RequestDestination]
337-
val unknown = "unknown".asInstanceOf[RequestDestination]
338-
val worker = "worker".asInstanceOf[RequestDestination]
333+
val empty: RequestDestination = "".asInstanceOf[RequestDestination]
334+
val document: RequestDestination = "document".asInstanceOf[RequestDestination]
335+
val sharedworker: RequestDestination = "sharedworker".asInstanceOf[RequestDestination]
336+
val subresource: RequestDestination = "subresource".asInstanceOf[RequestDestination]
337+
val unknown: RequestDestination = "unknown".asInstanceOf[RequestDestination]
338+
val worker: RequestDestination = "worker".asInstanceOf[RequestDestination]
339339
}
340340

341341
/** Fetch API's [[https://fetch.spec.whatwg.org/#requestmode RequestMode enum]]
@@ -344,10 +344,10 @@ object RequestDestination {
344344
sealed trait RequestMode extends js.Any
345345

346346
object RequestMode {
347-
val navigate = "navigate".asInstanceOf[RequestMode]
347+
val navigate: RequestMode = "navigate".asInstanceOf[RequestMode]
348348
val `same-origin` = "same-origin".asInstanceOf[RequestMode]
349349
val `no-cors` = "no-cors".asInstanceOf[RequestMode]
350-
val cors = "cors".asInstanceOf[RequestMode]
350+
val cors: RequestMode = "cors".asInstanceOf[RequestMode]
351351
}
352352

353353
/** Fetch APIs [[https://fetch.spec.whatwg.org/#requestcredentials RequestCredentials enum]]
@@ -356,9 +356,9 @@ object RequestMode {
356356
sealed trait RequestCredentials extends js.Any
357357

358358
object RequestCredentials {
359-
val omit = "omit".asInstanceOf[RequestCredentials]
359+
val omit: RequestCredentials = "omit".asInstanceOf[RequestCredentials]
360360
val `same-origin` = "same-origin".asInstanceOf[RequestCredentials]
361-
val include = "include".asInstanceOf[RequestCredentials]
361+
val include: RequestCredentials = "include".asInstanceOf[RequestCredentials]
362362
}
363363

364364
/** Fetch APIs [[https://fetch.spec.whatwg.org/#requestcache RequestCache enum]]
@@ -367,9 +367,9 @@ object RequestCredentials {
367367
sealed trait RequestCache extends js.Any
368368

369369
object RequestCache {
370-
val default = "default".asInstanceOf[RequestCache]
370+
val default: RequestCache = "default".asInstanceOf[RequestCache]
371371
val `no-store` = "no-store".asInstanceOf[RequestCache]
372-
val reload = "reload".asInstanceOf[RequestCache]
372+
val reload: RequestCache = "reload".asInstanceOf[RequestCache]
373373
val `no-cache` = "no-cache".asInstanceOf[RequestCache]
374374
val `force-cache` = "force-cache".asInstanceOf[RequestCache]
375375
val `only-if-cached` = "only-if-cached".asInstanceOf[RequestCache]
@@ -381,9 +381,9 @@ object RequestCache {
381381
sealed trait RequestRedirect extends js.Any
382382

383383
object RequestRedirect {
384-
val follow = "follow".asInstanceOf[RequestRedirect]
385-
val error = "error".asInstanceOf[RequestRedirect]
386-
val manual = "manual".asInstanceOf[RequestRedirect]
384+
val follow: RequestRedirect = "follow".asInstanceOf[RequestRedirect]
385+
val error: RequestRedirect = "error".asInstanceOf[RequestRedirect]
386+
val manual: RequestRedirect = "manual".asInstanceOf[RequestRedirect]
387387
}
388388

389389
@js.native
@@ -392,10 +392,10 @@ sealed trait ResponseType extends js.Any
392392
/** see [[https://fetch.spec.whatwg.org/#responsetype]] of whatwg Fetch spec
393393
*/
394394
object ResponseType {
395-
val basic = "basic".asInstanceOf[ResponseType]
396-
val cors = "cors".asInstanceOf[ResponseType]
397-
val default = "default".asInstanceOf[ResponseType]
398-
val error = "error".asInstanceOf[ResponseType]
399-
val opaque = "opaque".asInstanceOf[ResponseType]
400-
val opaqueredirect = "opaqueredirect".asInstanceOf[ResponseType]
395+
val basic: ResponseType = "basic".asInstanceOf[ResponseType]
396+
val cors: ResponseType = "cors".asInstanceOf[ResponseType]
397+
val default: ResponseType = "default".asInstanceOf[ResponseType]
398+
val error: ResponseType = "error".asInstanceOf[ResponseType]
399+
val opaque: ResponseType = "opaque".asInstanceOf[ResponseType]
400+
val opaqueredirect: ResponseType = "opaqueredirect".asInstanceOf[ResponseType]
401401
}

src/main/scala/org/scalajs/dom/IDBTypes.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ object IDBTransactionMode {
2222
*
2323
* MDN
2424
*/
25-
val READ_ONLY = "readonly".asInstanceOf[IDBTransactionMode]
25+
val READ_ONLY: IDBTransactionMode = "readonly".asInstanceOf[IDBTransactionMode]
2626

2727
/** Allows any operation to be performed, including ones that delete and create object stores and indexes. This mode
2828
* is for updating the version number of transactions that were started using the setVersion() method of IDBDatabase
2929
* objects. Transactions of this mode cannot run concurrently with other transactions.
3030
*
3131
* MDN
3232
*/
33-
val VERSION_CHANGE = "versionchange".asInstanceOf[IDBTransactionMode]
33+
val VERSION_CHANGE: IDBTransactionMode = "versionchange".asInstanceOf[IDBTransactionMode]
3434

3535
/** Allows reading and writing of data in existing data stores to be changed.
3636
*
3737
* MDN
3838
*/
39-
val READ_WRITE = "readwrite".asInstanceOf[IDBTransactionMode]
39+
val READ_WRITE: IDBTransactionMode = "readwrite".asInstanceOf[IDBTransactionMode]
4040

4141
}
4242

@@ -355,28 +355,28 @@ object IDBCursorDirection {
355355
*
356356
* MDN
357357
*/
358-
val PREV = "prev".asInstanceOf[IDBCursorDirection]
358+
val PREV: IDBCursorDirection = "prev".asInstanceOf[IDBCursorDirection]
359359

360360
/** The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first
361361
* one iterated is retrieved. It starts at the upper bound of the key range and moves downwards.
362362
*
363363
* MDN
364364
*/
365-
val PREV_UNIQUE = "prevunique".asInstanceOf[IDBCursorDirection]
365+
val PREV_UNIQUE: IDBCursorDirection = "prevunique".asInstanceOf[IDBCursorDirection]
366366

367367
/** The cursor shows all records, including duplicates. It starts at the lower bound of the key range and moves
368368
* upwards (monotonically increasing in the order of keys).
369369
*
370370
* MDN
371371
*/
372-
val NEXT = "next".asInstanceOf[IDBCursorDirection]
372+
val NEXT: IDBCursorDirection = "next".asInstanceOf[IDBCursorDirection]
373373

374374
/** The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first
375375
* one iterated is retrieved. It starts at the lower bound of the key range and moves upwards.
376376
*
377377
* MDN
378378
*/
379-
val NEXT_UNIQUE = "nextunique".asInstanceOf[IDBCursorDirection]
379+
val NEXT_UNIQUE: IDBCursorDirection = "nextunique".asInstanceOf[IDBCursorDirection]
380380
}
381381

382382
/** Same as IDBCursor with the value property.

src/main/scala/org/scalajs/dom/Stream.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ object WriteableState {
1515
/** The stream’s internal queue is full; that is, the stream is exerting backpressure. Use .ready to be notified of
1616
* when the pressure subsides.
1717
*/
18-
val waiting = "waiting".asInstanceOf[WriteableState]
18+
val waiting: WriteableState = "waiting".asInstanceOf[WriteableState]
1919

2020
/** The stream’s internal queue is not full; call .write() until backpressure is exerted.
2121
*/
22-
val writable = "writable".asInstanceOf[WriteableState]
22+
val writable: WriteableState = "writable".asInstanceOf[WriteableState]
2323

2424
/** The stream’s .close() method has been called, and a command to close is in the queue or being processed by the
2525
* underlying sink; attempts to write will now fail.
2626
*/
27-
val closing = "closing".asInstanceOf[WriteableState]
27+
val closing: WriteableState = "closing".asInstanceOf[WriteableState]
2828

2929
/** The underlying sink has been closed; writing is no longer possible. */
30-
val closed = "closed".asInstanceOf[WriteableState]
30+
val closed: WriteableState = "closed".asInstanceOf[WriteableState]
3131

3232
/** An error occurred interacting with the underlying sink or the stream has been aborted, so the stream is now dead.
3333
*/
34-
val errored = "errored".asInstanceOf[WriteableState]
34+
val errored: WriteableState = "errored".asInstanceOf[WriteableState]
3535
}
3636

3737
/** [[https://streams.spec.whatwg.org/#ws-class ¶4.2. Class WritableStream]] of whatwg Stream spec

src/main/scala/org/scalajs/dom/crypto/Crypto.scala

+15-15
Original file line numberDiff line numberDiff line change
@@ -827,14 +827,14 @@ object Pbkdf2Params {
827827
trait KeyUsage extends js.Any
828828

829829
object KeyUsage {
830-
val encrypt = "encrypt".asInstanceOf[KeyUsage]
831-
val decrypt = "decrypt".asInstanceOf[KeyUsage]
832-
val sign = "sign".asInstanceOf[KeyUsage]
833-
val verify = "verify".asInstanceOf[KeyUsage]
834-
val deriveKey = "deriveKey".asInstanceOf[KeyUsage]
835-
val deriveBits = "deriveBits".asInstanceOf[KeyUsage]
836-
val wrapKey = "wrapKey".asInstanceOf[KeyUsage]
837-
val unwrapKey = "unwrapKey".asInstanceOf[KeyUsage]
830+
val encrypt: KeyUsage = "encrypt".asInstanceOf[KeyUsage]
831+
val decrypt: KeyUsage = "decrypt".asInstanceOf[KeyUsage]
832+
val sign: KeyUsage = "sign".asInstanceOf[KeyUsage]
833+
val verify: KeyUsage = "verify".asInstanceOf[KeyUsage]
834+
val deriveKey: KeyUsage = "deriveKey".asInstanceOf[KeyUsage]
835+
val deriveBits: KeyUsage = "deriveBits".asInstanceOf[KeyUsage]
836+
val wrapKey: KeyUsage = "wrapKey".asInstanceOf[KeyUsage]
837+
val unwrapKey: KeyUsage = "unwrapKey".asInstanceOf[KeyUsage]
838838
}
839839

840840
/** see [[http://www.w3.org/TR/WebCryptoAPI/#cryptokey-interface ¶13 CryptoKey interface]] in W3C doc
@@ -843,9 +843,9 @@ object KeyUsage {
843843
trait KeyType extends js.Any
844844

845845
object KeyType {
846-
val public = "public".asInstanceOf[KeyType]
847-
val `private` = "private".asInstanceOf[KeyType]
848-
val secret = "secret".asInstanceOf[KeyType]
846+
val public: KeyType = "public".asInstanceOf[KeyType]
847+
val `private`: KeyType = "private".asInstanceOf[KeyType]
848+
val secret: KeyType = "secret".asInstanceOf[KeyType]
849849
}
850850

851851
/** see [[http://www.w3.org/TR/WebCryptoAPI/#dfn-KeyFormat ¶14.2 Data Types]] in W3C spec
@@ -856,16 +856,16 @@ trait KeyFormat extends js.Any
856856
object KeyFormat {
857857

858858
/** An unformatted sequence of bytes. Intended for secret keys. */
859-
val raw = "raw".asInstanceOf[KeyFormat]
859+
val raw: KeyFormat = "raw".asInstanceOf[KeyFormat]
860860

861861
/** The DER encoding of the PrivateKeyInfo structure from RFC 5208. */
862-
val pkcs8 = "pkcs8".asInstanceOf[KeyFormat]
862+
val pkcs8: KeyFormat = "pkcs8".asInstanceOf[KeyFormat]
863863

864864
/** The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280. */
865-
val spki = "spki".asInstanceOf[KeyFormat]
865+
val spki: KeyFormat = "spki".asInstanceOf[KeyFormat]
866866

867867
/** The key is a JsonWebKey dictionary encoded as a JavaScript object */
868-
val jwk = "jwk".asInstanceOf[KeyFormat]
868+
val jwk: KeyFormat = "jwk".asInstanceOf[KeyFormat]
869869
}
870870

871871
//

src/main/scala/org/scalajs/dom/experimental/gamepad/package.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package object gamepad {
1212
implicit def toGamepad(navigator: dom.Navigator): GamepadNavigator =
1313
navigator.asInstanceOf[GamepadNavigator]
1414

15-
final val `unknown` = "".asInstanceOf[GamepadMappingType]
15+
final val `unknown`: GamepadMappingType = "".asInstanceOf[GamepadMappingType]
1616

17-
final val `standard` = "standard".asInstanceOf[GamepadMappingType]
17+
final val `standard`: GamepadMappingType = "standard".asInstanceOf[GamepadMappingType]
1818
}

src/main/scala/org/scalajs/dom/experimental/mediastream/MediaStream.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ object MediaStreamTrackState {
112112
/** The track is active (the track's underlying media source is making a best-effort attempt to provide data in real
113113
* time). The output of a track in the live state can be switched on and off with the enabled attribute.
114114
*/
115-
val live = "live".asInstanceOf[MediaStreamTrackState]
115+
val live: MediaStreamTrackState = "live".asInstanceOf[MediaStreamTrackState]
116116

117117
/** The track has ended (the track's underlying media source is no longer providing data, and will never provide more
118118
* data for this track). Once a track enters this state, it never exits it.
119119
*
120120
* For example, a video track in a MediaStream ends if the user unplugs the USB web camera that acts as the track's
121121
* media source.
122122
*/
123-
val ended = "ended".asInstanceOf[MediaStreamTrackState]
123+
val ended: MediaStreamTrackState = "ended".asInstanceOf[MediaStreamTrackState]
124124
}
125125

126126
@js.native
@@ -406,15 +406,15 @@ object MediaDeviceKind {
406406

407407
/** Represents an audio input device; for example a microphone.
408408
*/
409-
val audioinput = "audioinput".asInstanceOf[MediaDeviceKind]
409+
val audioinput: MediaDeviceKind = "audioinput".asInstanceOf[MediaDeviceKind]
410410

411411
/** Represents an audio output device; for example a pair of headphones.
412412
*/
413-
val audiooutput = "audiooutput".asInstanceOf[MediaDeviceKind]
413+
val audiooutput: MediaDeviceKind = "audiooutput".asInstanceOf[MediaDeviceKind]
414414

415415
/** Represents a video input device; for example a webcam.
416416
*/
417-
val videoinput = "videoinput".asInstanceOf[MediaDeviceKind]
417+
val videoinput: MediaDeviceKind = "videoinput".asInstanceOf[MediaDeviceKind]
418418
}
419419

420420
@js.native

src/main/scala/org/scalajs/dom/experimental/permissions/package.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ package object permissions {
1414
sealed trait PermissionState extends js.Any
1515

1616
object PermissionState {
17-
val granted = "granted".asInstanceOf[PermissionState]
18-
val denied = "denied".asInstanceOf[PermissionState]
19-
val prompt = "prompt".asInstanceOf[PermissionState]
17+
val granted: PermissionState = "granted".asInstanceOf[PermissionState]
18+
val denied: PermissionState = "denied".asInstanceOf[PermissionState]
19+
val prompt: PermissionState = "prompt".asInstanceOf[PermissionState]
2020
}
2121

2222
trait PermissionStatus extends dom.EventTarget {
@@ -28,10 +28,10 @@ package object permissions {
2828
sealed trait PermissionName extends js.Any
2929

3030
object PermissionName {
31-
val geolocation = "geolocation".asInstanceOf[PermissionName]
32-
val midi = "midi".asInstanceOf[PermissionName]
33-
val notifications = "notifications".asInstanceOf[PermissionName]
34-
val push = "push".asInstanceOf[PermissionName]
31+
val geolocation: PermissionName = "geolocation".asInstanceOf[PermissionName]
32+
val midi: PermissionName = "midi".asInstanceOf[PermissionName]
33+
val notifications: PermissionName = "notifications".asInstanceOf[PermissionName]
34+
val push: PermissionName = "push".asInstanceOf[PermissionName]
3535

3636
val `persistent-storage` =
3737
"persistent-storage".asInstanceOf[PermissionName]

0 commit comments

Comments
 (0)