Skip to content
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

Enable ExplicitResultTypes #549

Merged
merged 1 commit into from
Sep 4, 2021
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
1 change: 1 addition & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rules = [
ExplicitResultTypes,
OrganizeImports,
RemoveUnused,
GenerateApiReport,
Expand Down
272 changes: 136 additions & 136 deletions api-reports/2_12.txt

Large diffs are not rendered by default.

272 changes: 136 additions & 136 deletions api-reports/2_13.txt

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions prePR.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ ThisBuild / prePR_nonCross := Def.sequential(
(example / clean).value
},

dom / Compile / scalafmt,
Def.taskDyn {
if (scalaVersion.value.startsWith("2."))
if (scalaVersion.value.matches("2\\.1[23]\\..+"))
armanbilge marked this conversation as resolved.
Show resolved Hide resolved
(dom / Compile / scalafix).toTask("")
else
Def.task[Unit]((dom / Compile / compile).value)
Def.task(())
},
dom / Compile / scalafmt,
armanbilge marked this conversation as resolved.
Show resolved Hide resolved

Def.task {
(testsShared / Test / compile).value
Expand Down
76 changes: 38 additions & 38 deletions src/main/scala/org/scalajs/dom/Fetch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Headers(map: HeadersInit = js.Array[js.Array[String]]()) extends js.Iterab
sealed trait ReferrerPolicy extends js.Any

object ReferrerPolicy {
val empty = "".asInstanceOf[ReferrerPolicy]
val empty: ReferrerPolicy = "".asInstanceOf[ReferrerPolicy]
val `no-referrer` = "no-referrer".asInstanceOf[ReferrerPolicy]

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

object HttpMethod {
val GET = "GET".asInstanceOf[HttpMethod]
val POST = "POST".asInstanceOf[HttpMethod]
val PUT = "PUT".asInstanceOf[HttpMethod]
val PATCH = "PATCH".asInstanceOf[HttpMethod]
val DELETE = "DELETE".asInstanceOf[HttpMethod]
val QUERY = "QUERY".asInstanceOf[HttpMethod]
val HEAD = "HEAD".asInstanceOf[HttpMethod]
val OPTIONS = "OPTIONS".asInstanceOf[HttpMethod]
val GET: HttpMethod = "GET".asInstanceOf[HttpMethod]
val POST: HttpMethod = "POST".asInstanceOf[HttpMethod]
val PUT: HttpMethod = "PUT".asInstanceOf[HttpMethod]
val PATCH: HttpMethod = "PATCH".asInstanceOf[HttpMethod]
val DELETE: HttpMethod = "DELETE".asInstanceOf[HttpMethod]
val QUERY: HttpMethod = "QUERY".asInstanceOf[HttpMethod]
val HEAD: HttpMethod = "HEAD".asInstanceOf[HttpMethod]
val OPTIONS: HttpMethod = "OPTIONS".asInstanceOf[HttpMethod]
}

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

object RequestType {
val empty = "".asInstanceOf[RequestType]
val audio = "audio".asInstanceOf[RequestType]
val font = "font".asInstanceOf[RequestType]
val image = "image".asInstanceOf[RequestType]
val script = "script".asInstanceOf[RequestType]
val style = "style".asInstanceOf[RequestType]
val track = "track".asInstanceOf[RequestType]
val video = "video".asInstanceOf[RequestType]
val empty: RequestType = "".asInstanceOf[RequestType]
val audio: RequestType = "audio".asInstanceOf[RequestType]
val font: RequestType = "font".asInstanceOf[RequestType]
val image: RequestType = "image".asInstanceOf[RequestType]
val script: RequestType = "script".asInstanceOf[RequestType]
val style: RequestType = "style".asInstanceOf[RequestType]
val track: RequestType = "track".asInstanceOf[RequestType]
val video: RequestType = "video".asInstanceOf[RequestType]
}

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

object RequestDestination {
val empty = "".asInstanceOf[RequestDestination]
val document = "document".asInstanceOf[RequestDestination]
val sharedworker = "sharedworker".asInstanceOf[RequestDestination]
val subresource = "subresource".asInstanceOf[RequestDestination]
val unknown = "unknown".asInstanceOf[RequestDestination]
val worker = "worker".asInstanceOf[RequestDestination]
val empty: RequestDestination = "".asInstanceOf[RequestDestination]
val document: RequestDestination = "document".asInstanceOf[RequestDestination]
val sharedworker: RequestDestination = "sharedworker".asInstanceOf[RequestDestination]
val subresource: RequestDestination = "subresource".asInstanceOf[RequestDestination]
val unknown: RequestDestination = "unknown".asInstanceOf[RequestDestination]
val worker: RequestDestination = "worker".asInstanceOf[RequestDestination]
}

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

object RequestMode {
val navigate = "navigate".asInstanceOf[RequestMode]
val navigate: RequestMode = "navigate".asInstanceOf[RequestMode]
val `same-origin` = "same-origin".asInstanceOf[RequestMode]
val `no-cors` = "no-cors".asInstanceOf[RequestMode]
val cors = "cors".asInstanceOf[RequestMode]
val cors: RequestMode = "cors".asInstanceOf[RequestMode]
}

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

object RequestCredentials {
val omit = "omit".asInstanceOf[RequestCredentials]
val omit: RequestCredentials = "omit".asInstanceOf[RequestCredentials]
val `same-origin` = "same-origin".asInstanceOf[RequestCredentials]
val include = "include".asInstanceOf[RequestCredentials]
val include: RequestCredentials = "include".asInstanceOf[RequestCredentials]
}

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

object RequestCache {
val default = "default".asInstanceOf[RequestCache]
val default: RequestCache = "default".asInstanceOf[RequestCache]
val `no-store` = "no-store".asInstanceOf[RequestCache]
val reload = "reload".asInstanceOf[RequestCache]
val reload: RequestCache = "reload".asInstanceOf[RequestCache]
val `no-cache` = "no-cache".asInstanceOf[RequestCache]
val `force-cache` = "force-cache".asInstanceOf[RequestCache]
val `only-if-cached` = "only-if-cached".asInstanceOf[RequestCache]
Expand All @@ -381,9 +381,9 @@ object RequestCache {
sealed trait RequestRedirect extends js.Any

object RequestRedirect {
val follow = "follow".asInstanceOf[RequestRedirect]
val error = "error".asInstanceOf[RequestRedirect]
val manual = "manual".asInstanceOf[RequestRedirect]
val follow: RequestRedirect = "follow".asInstanceOf[RequestRedirect]
val error: RequestRedirect = "error".asInstanceOf[RequestRedirect]
val manual: RequestRedirect = "manual".asInstanceOf[RequestRedirect]
}

@js.native
Expand All @@ -392,10 +392,10 @@ sealed trait ResponseType extends js.Any
/** see [[https://fetch.spec.whatwg.org/#responsetype]] of whatwg Fetch spec
*/
object ResponseType {
val basic = "basic".asInstanceOf[ResponseType]
val cors = "cors".asInstanceOf[ResponseType]
val default = "default".asInstanceOf[ResponseType]
val error = "error".asInstanceOf[ResponseType]
val opaque = "opaque".asInstanceOf[ResponseType]
val opaqueredirect = "opaqueredirect".asInstanceOf[ResponseType]
val basic: ResponseType = "basic".asInstanceOf[ResponseType]
val cors: ResponseType = "cors".asInstanceOf[ResponseType]
val default: ResponseType = "default".asInstanceOf[ResponseType]
val error: ResponseType = "error".asInstanceOf[ResponseType]
val opaque: ResponseType = "opaque".asInstanceOf[ResponseType]
val opaqueredirect: ResponseType = "opaqueredirect".asInstanceOf[ResponseType]
}
14 changes: 7 additions & 7 deletions src/main/scala/org/scalajs/dom/IDBTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ object IDBTransactionMode {
*
* MDN
*/
val READ_ONLY = "readonly".asInstanceOf[IDBTransactionMode]
val READ_ONLY: IDBTransactionMode = "readonly".asInstanceOf[IDBTransactionMode]

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

/** Allows reading and writing of data in existing data stores to be changed.
*
* MDN
*/
val READ_WRITE = "readwrite".asInstanceOf[IDBTransactionMode]
val READ_WRITE: IDBTransactionMode = "readwrite".asInstanceOf[IDBTransactionMode]

}

Expand Down Expand Up @@ -355,28 +355,28 @@ object IDBCursorDirection {
*
* MDN
*/
val PREV = "prev".asInstanceOf[IDBCursorDirection]
val PREV: IDBCursorDirection = "prev".asInstanceOf[IDBCursorDirection]

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

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

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

/** Same as IDBCursor with the value property.
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/org/scalajs/dom/Stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ object WriteableState {
/** The stream’s internal queue is full; that is, the stream is exerting backpressure. Use .ready to be notified of
* when the pressure subsides.
*/
val waiting = "waiting".asInstanceOf[WriteableState]
val waiting: WriteableState = "waiting".asInstanceOf[WriteableState]

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

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

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

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

/** [[https://streams.spec.whatwg.org/#ws-class ¶4.2. Class WritableStream]] of whatwg Stream spec
Expand Down
30 changes: 15 additions & 15 deletions src/main/scala/org/scalajs/dom/crypto/Crypto.scala
Original file line number Diff line number Diff line change
Expand Up @@ -827,14 +827,14 @@ object Pbkdf2Params {
trait KeyUsage extends js.Any

object KeyUsage {
val encrypt = "encrypt".asInstanceOf[KeyUsage]
val decrypt = "decrypt".asInstanceOf[KeyUsage]
val sign = "sign".asInstanceOf[KeyUsage]
val verify = "verify".asInstanceOf[KeyUsage]
val deriveKey = "deriveKey".asInstanceOf[KeyUsage]
val deriveBits = "deriveBits".asInstanceOf[KeyUsage]
val wrapKey = "wrapKey".asInstanceOf[KeyUsage]
val unwrapKey = "unwrapKey".asInstanceOf[KeyUsage]
val encrypt: KeyUsage = "encrypt".asInstanceOf[KeyUsage]
val decrypt: KeyUsage = "decrypt".asInstanceOf[KeyUsage]
val sign: KeyUsage = "sign".asInstanceOf[KeyUsage]
val verify: KeyUsage = "verify".asInstanceOf[KeyUsage]
val deriveKey: KeyUsage = "deriveKey".asInstanceOf[KeyUsage]
val deriveBits: KeyUsage = "deriveBits".asInstanceOf[KeyUsage]
val wrapKey: KeyUsage = "wrapKey".asInstanceOf[KeyUsage]
val unwrapKey: KeyUsage = "unwrapKey".asInstanceOf[KeyUsage]
}

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

object KeyType {
val public = "public".asInstanceOf[KeyType]
val `private` = "private".asInstanceOf[KeyType]
val secret = "secret".asInstanceOf[KeyType]
val public: KeyType = "public".asInstanceOf[KeyType]
val `private`: KeyType = "private".asInstanceOf[KeyType]
val secret: KeyType = "secret".asInstanceOf[KeyType]
}

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

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

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

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

/** The key is a JsonWebKey dictionary encoded as a JavaScript object */
val jwk = "jwk".asInstanceOf[KeyFormat]
val jwk: KeyFormat = "jwk".asInstanceOf[KeyFormat]
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package object gamepad {
implicit def toGamepad(navigator: dom.Navigator): GamepadNavigator =
navigator.asInstanceOf[GamepadNavigator]

final val `unknown` = "".asInstanceOf[GamepadMappingType]
final val `unknown`: GamepadMappingType = "".asInstanceOf[GamepadMappingType]

final val `standard` = "standard".asInstanceOf[GamepadMappingType]
final val `standard`: GamepadMappingType = "standard".asInstanceOf[GamepadMappingType]
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ object MediaStreamTrackState {
/** The track is active (the track's underlying media source is making a best-effort attempt to provide data in real
* time). The output of a track in the live state can be switched on and off with the enabled attribute.
*/
val live = "live".asInstanceOf[MediaStreamTrackState]
val live: MediaStreamTrackState = "live".asInstanceOf[MediaStreamTrackState]

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

@js.native
Expand Down Expand Up @@ -406,15 +406,15 @@ object MediaDeviceKind {

/** Represents an audio input device; for example a microphone.
*/
val audioinput = "audioinput".asInstanceOf[MediaDeviceKind]
val audioinput: MediaDeviceKind = "audioinput".asInstanceOf[MediaDeviceKind]

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

/** Represents a video input device; for example a webcam.
*/
val videoinput = "videoinput".asInstanceOf[MediaDeviceKind]
val videoinput: MediaDeviceKind = "videoinput".asInstanceOf[MediaDeviceKind]
}

@js.native
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ package object permissions {
sealed trait PermissionState extends js.Any

object PermissionState {
val granted = "granted".asInstanceOf[PermissionState]
val denied = "denied".asInstanceOf[PermissionState]
val prompt = "prompt".asInstanceOf[PermissionState]
val granted: PermissionState = "granted".asInstanceOf[PermissionState]
val denied: PermissionState = "denied".asInstanceOf[PermissionState]
val prompt: PermissionState = "prompt".asInstanceOf[PermissionState]
}

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

object PermissionName {
val geolocation = "geolocation".asInstanceOf[PermissionName]
val midi = "midi".asInstanceOf[PermissionName]
val notifications = "notifications".asInstanceOf[PermissionName]
val push = "push".asInstanceOf[PermissionName]
val geolocation: PermissionName = "geolocation".asInstanceOf[PermissionName]
val midi: PermissionName = "midi".asInstanceOf[PermissionName]
val notifications: PermissionName = "notifications".asInstanceOf[PermissionName]
val push: PermissionName = "push".asInstanceOf[PermissionName]

val `persistent-storage` =
"persistent-storage".asInstanceOf[PermissionName]
Expand Down
Loading