Skip to content

Commit

Permalink
Enabled warning 105. Converted all externals to explicit using the br…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpyder committed Oct 31, 2021
1 parent b7e3095 commit 18d9d55
Show file tree
Hide file tree
Showing 78 changed files with 850 additions and 867 deletions.
2 changes: 1 addition & 1 deletion bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"warnings": {
"number": "+A-105",
"number": "+A",
"error": "+A"
},
"bs-dev-dependencies": [
Expand Down
5 changes: 2 additions & 3 deletions src/Webapi.res
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module Iterator = Webapi__Iterator

module Performance = Webapi__Performance

/** @since 0.19.0 */
module ReadableStream = Webapi__ReadableStream

module IntersectionObserver = Webapi__IntersectionObserver
Expand All @@ -20,7 +19,7 @@ module WebSocket = Webapi__WebSocket

type rafId

@val external requestAnimationFrame: (float => unit) => unit = ""
@val external requestAnimationFrame: (float => unit) => unit = "requestAnimationFrame"
@val
external requestCancellableAnimationFrame: (float => unit) => rafId = "requestAnimationFrame"
@val external cancelAnimationFrame: rafId => unit = ""
@val external cancelAnimationFrame: rafId => unit = "cancelAnimationFrame"
98 changes: 48 additions & 50 deletions src/Webapi/Canvas/Webapi__Canvas__Canvas2d.res
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ type rec style<_> =
| Pattern: style<pattern>

/* 2d Canvas API, following https://simon.html5.org/dump/html5-canvas-cheat-sheet.html */
@send external save: t => unit = ""
@send external restore: t => unit = ""
@send external save: t => unit = "save"
@send external restore: t => unit = "restore"

/* Transformation */
@send external scale: (t, ~x: float, ~y: float) => unit = ""
@send external rotate: (t, float) => unit = ""
@send external translate: (t, ~x: float, ~y: float) => unit = ""
@send external scale: (t, ~x: float, ~y: float) => unit = "scale"
@send external rotate: (t, float) => unit = "rotate"
@send external translate: (t, ~x: float, ~y: float) => unit = "translate"
@send
external transform: (
t,
Expand All @@ -94,7 +94,7 @@ external transform: (
~m22: float,
~dx: float,
~dy: float,
) => unit = ""
) => unit = "transform"
@send
external setTransform: (
t,
Expand All @@ -104,17 +104,17 @@ external setTransform: (
~m22: float,
~dx: float,
~dy: float,
) => unit = ""
) => unit = "setTransform"

/* Compositing */
@set external globalAlpha: (t, float) => unit = ""
@set external globalCompositeOperation: (t, Composite.t) => unit = ""
@set external globalAlpha: (t, float) => unit = "globalAlpha"
@set external globalCompositeOperation: (t, Composite.t) => unit = "globalCompositeOperation"

/* Line Styles */
@set external lineWidth: (t, float) => unit = ""
@set external lineCap: (t, LineCap.t) => unit = ""
@set external lineJoin: (t, LineJoin.t) => unit = ""
@set external miterLimit: (t, float) => unit = ""
@set external lineWidth: (t, float) => unit = "lineWidth"
@set external lineCap: (t, LineCap.t) => unit = "lineCap"
@set external lineJoin: (t, LineJoin.t) => unit = "lineJoin"
@set external miterLimit: (t, float) => unit = "miterLimit"

/* Colors, Styles, and Shadows */
@set external setFillStyle: (t, @ignore style<'a>, 'a) => unit = "fillStyle"
Expand Down Expand Up @@ -145,21 +145,21 @@ let reifyStyle = (type a, x: 'a): (style<a>, a) => {
)
}

@get external fillStyle: t => 'a = ""
@get external strokeStyle: t => 'a = ""
@get external fillStyle: t => 'a = "fillStyle"
@get external strokeStyle: t => 'a = "strokeStyle"

let fillStyle = (ctx: t) => ctx->fillStyle->reifyStyle

let strokeStyle = (ctx: t) => ctx->strokeStyle->reifyStyle

@set external shadowOffsetX: (t, float) => unit = ""
@set external shadowOffsetY: (t, float) => unit = ""
@set external shadowBlur: (t, float) => unit = ""
@set external shadowColor: (t, string) => unit = ""
@set external shadowOffsetX: (t, float) => unit = "shadowOffsetX"
@set external shadowOffsetY: (t, float) => unit = "shadowOffsetY"
@set external shadowBlur: (t, float) => unit = "shadowBlur"
@set external shadowColor: (t, string) => unit = "shadowColor"

/* Gradients */
@send
external createLinearGradient: (t, ~x0: float, ~y0: float, ~x1: float, ~y1: float) => gradient = ""
external createLinearGradient: (t, ~x0: float, ~y0: float, ~x1: float, ~y1: float) => gradient = "createLinearGradient"
@send
external createRadialGradient: (
t,
Expand All @@ -169,8 +169,8 @@ external createRadialGradient: (
~y1: float,
~r0: float,
~r1: float,
) => gradient = ""
@send external addColorStop: (gradient, float, string) => unit = ""
) => gradient = "createRadialGradient"
@send external addColorStop: (gradient, float, string) => unit = "addColorStop"
@val
external createPattern: (
t,
Expand All @@ -182,17 +182,17 @@ external createPattern: (
| @as("repeat-y") #repeatY
| @as("no-repeat") #noRepeat
],
) => pattern = ""
) => pattern = "createPattern"

/* Paths */
@send external beginPath: t => unit = ""
@send external closePath: t => unit = ""
@send external fill: t => unit = ""
@send external stroke: t => unit = ""
@send external clip: t => unit = ""
@send external moveTo: (t, ~x: float, ~y: float) => unit = ""
@send external lineTo: (t, ~x: float, ~y: float) => unit = ""
@send external quadraticCurveTo: (t, ~cp1x: float, ~cp1y: float, ~x: float, ~y: float) => unit = ""
@send external beginPath: t => unit = "beginPath"
@send external closePath: t => unit = "closePath"
@send external fill: t => unit = "fill"
@send external stroke: t => unit = "stroke"
@send external clip: t => unit = "clip"
@send external moveTo: (t, ~x: float, ~y: float) => unit = "moveTo"
@send external lineTo: (t, ~x: float, ~y: float) => unit = "lineTo"
@send external quadraticCurveTo: (t, ~cp1x: float, ~cp1y: float, ~x: float, ~y: float) => unit = "quadraticCurveTo"
@send
external bezierCurveTo: (
t,
Expand All @@ -202,8 +202,8 @@ external bezierCurveTo: (
~cp2y: float,
~x: float,
~y: float,
) => unit = ""
@send external arcTo: (t, ~x1: float, ~y1: float, ~x2: float, ~y2: float, ~r: float) => unit = ""
) => unit = "bezierCurveTo"
@send external arcTo: (t, ~x1: float, ~y1: float, ~x2: float, ~y2: float, ~r: float) => unit = "arcTo"
@send
external arc: (
t,
Expand All @@ -213,26 +213,25 @@ external arc: (
~startAngle: float,
~endAngle: float,
~anticw: bool,
) => unit = ""
@send external rect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = ""
@send external isPointInPath: (t, ~x: float, ~y: float) => bool = ""
) => unit = "arc"
@send external rect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = "rect"
@send external isPointInPath: (t, ~x: float, ~y: float) => bool = "isPointInPath"

/* Text */
@set external font: (t, string) => unit = ""
@set external textAlign: (t, string) => unit = ""
@set external textBaseline: (t, string) => unit = ""
@set external font: (t, string) => unit = "font"
@set external textAlign: (t, string) => unit = "textAlign"
@set external textBaseline: (t, string) => unit = "textBaseline"
@send
external fillText: (t, string, ~x: float, ~y: float, ~maxWidth: float=?, @ignore unit) => unit = ""
external fillText: (t, string, ~x: float, ~y: float, ~maxWidth: float=?, @ignore unit) => unit = "fillText"
@send
external strokeText: (t, string, ~x: float, ~y: float, ~maxWidth: float=?, @ignore unit) => unit =
""
@send external measureText: (t, string) => measureText = ""
@get external width: measureText => float = ""
external strokeText: (t, string, ~x: float, ~y: float, ~maxWidth: float=?, @ignore unit) => unit = "strokeText"
@send external measureText: (t, string) => measureText = "measureText"
@get external width: measureText => float = "width"

/* Rectangles */
@send external fillRect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = ""
@send external strokeRect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = ""
@send external clearRect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = ""
@send external fillRect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = "fillRect"
@send external strokeRect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = "strokeRect"
@send external clearRect: (t, ~x: float, ~y: float, ~w: float, ~h: float) => unit = "clearRect"

@send
external createImageDataCoords: (t, ~width: float, ~height: float) => Webapi__Dom__Image.t =
Expand All @@ -242,11 +241,10 @@ external createImageDataFromImage: (t, Webapi__Dom__Image.t) => Webapi__Dom__Ima
"createImageData"

@send
external getImageData: (t, ~sx: float, ~sy: float, ~sw: float, ~sh: float) => Webapi__Dom__Image.t =
""
external getImageData: (t, ~sx: float, ~sy: float, ~sw: float, ~sh: float) => Webapi__Dom__Image.t = "getImageData"

@send
external putImageData: (t, ~imageData: Webapi__Dom__Image.t, ~dx: float, ~dy: float) => unit = ""
external putImageData: (t, ~imageData: Webapi__Dom__Image.t, ~dx: float, ~dy: float) => unit = "putImageData"

@send
external putImageDataWithDirtyRect: (
Expand Down
6 changes: 3 additions & 3 deletions src/Webapi/Dom/Webapi__Dom__AnimationEvent.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ include Webapi__Dom__Event.Impl({
@new external make: string => t = "AnimationEvent"
@new external makeWithOptions: (string, {..}) => t = "AnimationEvent"

@get external animationName: t => string = ""
@get external elapsedTime: t => float = ""
@get external pseudoElement: t => string /* enum-ish */ = ""
@get external animationName: t => string = "animationName"
@get external elapsedTime: t => float = "elapsedTime"
@get external pseudoElement: t => string = "pseudoElement"
14 changes: 7 additions & 7 deletions src/Webapi/Dom/Webapi__Dom__Attr.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ include Webapi__Dom__EventTarget.Impl({
type t = t
})

@get external namespaceURI: t => string = ""
@get external prefix: t => string = ""
@get external localName: t => string = ""
@get external name: t => string = ""
@get external value: t => string = ""
@get @return(nullable) external ownerElement: t => option<Dom.element> = ""
@get external specified: t => bool = "" /* useless; always returns true (exact wording from spec) */
@get external namespaceURI: t => string = "namespaceURI"
@get external prefix: t => string = "prefix"
@get external localName: t => string = "localName"
@get external name: t => string = "name"
@get external value: t => string = "value"
@get @return(nullable) external ownerElement: t => option<Dom.element> = "ownerElement"
@get external specified: t => bool = "specified" /* useless; always returns true (exact wording from spec) */
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__BeforeUnloadEvent.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include Webapi__Dom__Event.Impl({
@new external make: string => t = "BeforeUnloadEvent"
@new external makeWithOptions: (string, {..}) => t = "BeforeUnloadEvent"

@get external returnValue: t => string = ""
@get external returnValue: t => string = "returnValue"
14 changes: 7 additions & 7 deletions src/Webapi/Dom/Webapi__Dom__CharacterData.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module Impl = (
type t
},
) => {
@get external data: T.t => string = ""
@get external length: T.t => int = ""
@get external data: T.t => string = "data"
@get external length: T.t => int = "length"

@send external substringData: (T.t, ~offset: int, ~count: int) => string = ""
@send external appendData: (T.t, string) => unit = ""
@send external insertData: (T.t, ~offset: int, string) => unit = ""
@send external deleteData: (T.t, ~offset: int, ~count: int) => unit = ""
@send external replaceData: (T.t, ~offset: int, ~count: int, string) => unit = ""
@send external substringData: (T.t, ~offset: int, ~count: int) => string = "substringData"
@send external appendData: (T.t, string) => unit = "appendData"
@send external insertData: (T.t, ~offset: int, string) => unit = "insertData"
@send external deleteData: (T.t, ~offset: int, ~count: int) => unit = "deleteData"
@send external replaceData: (T.t, ~offset: int, ~count: int, string) => unit = "replaceData"
}

type t = Dom.characterData
Expand Down
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__ChildNode.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module Impl = (
type t
},
) => {
@send external remove: T.t => unit = ""
@send external remove: T.t => unit = "remove"
}
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__ClipboardEvent.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include Webapi__Dom__Event.Impl({
@new external make: string => t = "ClipboardEvent"
@new external makeWithOptions: (string, {..}) => t = "ClipboardEvent"

@get external clipboardData: t => Dom.dataTransfer = ""
@get external clipboardData: t => Dom.dataTransfer = "clipboardData"
6 changes: 3 additions & 3 deletions src/Webapi/Dom/Webapi__Dom__CloseEvent.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ include Webapi__Dom__Event.Impl({
@new external make: string => t = "CloseEvent"
@new external makeWithOptions: (string, {..}) => t = "CloseEvent"

@get external wasClean: t => bool = ""
@get external code: t => int = ""
@get external reason: t => string = ""
@get external wasClean: t => bool = "wasClean"
@get external code: t => int = "code"
@get external reason: t => string = "reason"
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__CompositionEvent.res
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ include Webapi__Dom__UiEvent.Impl({
@new external make: string => t = "CompositionEvent"
@new external makeWithOptions: (string, {..}) => t = "CompositionEvent"

@get external data: t => string = ""
@get external data: t => string = "data"
Loading

0 comments on commit 18d9d55

Please sign in to comment.