Skip to content

Commit 07bf3b7

Browse files
committed
clean up warnings and remove rebase dep
1 parent e184d24 commit 07bf3b7

File tree

14 files changed

+41
-48
lines changed

14 files changed

+41
-48
lines changed

bsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name" : "reason-tools",
44
"version": "0.0.0",
55
"reason" : {"react-jsx" : 2},
6-
"bs-dependencies": ["reason-react", "rebase"],
6+
"bs-dependencies": ["reason-react"],
77
"sources": {
88
"dir": "src",
99
"subdirs": [

docs/Popup.bundle.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@
3434
"react-codemirror2": "^4.0.0",
3535
"react-copy-to-clipboard": "^5.0.1",
3636
"react-dom": "^16.0.0",
37-
"reason-react": "^0.3.0",
38-
"rebase": "glennsl/rebase#v0.0.2"
37+
"reason-react": "^0.3.0"
3938
},
4039
"devDependencies": {
41-
"bs-platform": "^2.1.0",
40+
"bs-platform": "^2.2.1",
4241
"chrome-store-api": "^1.0.5",
4342
"file-loader": "^1.1.5",
4443
"generate-json-webpack-plugin": "^0.2.1",

src/extension/background.re

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
open Rebase;
2-
31
open Core;
42

53
module Refmt = {
64
let refmt = Refmt2.refmtJS;
75
let parse =
86
fun
9-
| ("Failure", error) => Error(error)
7+
| ("Failure", error) => Protocol.Error(error)
108
| (conversion, outText) =>
119
switch (conversion |> Js.String.split("to")) {
1210
| [|inLang, outLang|] when Protocol.languageOfString(outLang) != RefmtShared.UnknownLang =>
13-
Ok(
11+
Protocol.Ok(
1412
Protocol.Refmt.{
1513
outText,
1614
inLang: Protocol.languageOfString(inLang),
1715
outLang: Protocol.languageOfString(outLang)
1816
}
1917
)
20-
| _ => Error(outText)
18+
| _ => Protocol.Error(outText)
2119
};
2220
};
2321

src/extension/common/protocol.re

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
open Rebase;
2-
31
open Common;
42

3+
type result('a, 'e) =
4+
| Ok('a)
5+
| Error('e);
6+
57
type language = RefmtShared.language;
68

79
type codeType = RefmtShared.codeType;
@@ -122,7 +124,7 @@ module Storage = {
122124
let queryDisabled = (callback: bool => unit) =>
123125
Chrome.Storage.Local.get(
124126
"disabled",
125-
(response) => response##disabled |> Js.Undefined.to_opt |> Option.getOr(false) |> callback
127+
(response) => response##disabled |> Js.Undefined.toOption |> Js.Option.getWithDefault(false) |> callback
126128
);
127129
let setDisabled = (value: bool) => Chrome.Storage.Local.set({"disabled": value});
128130
let onDisabledChanged = (callback: bool => unit) =>

src/extension/common/vendor/codeMirror.re

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ let make =
2020
| Some(true) => Js.true_
2121
| Some(false) | None => Js.false_
2222
},
23-
"style": Js.Undefined.from_opt(style),
24-
"value": Js.Undefined.from_opt(value),
23+
"style": Js.Undefined.fromOption(style),
24+
"value": Js.Undefined.fromOption(value),
2525
"onBeforeChange": (_editor, _data, value) => switch (onChange) {
2626
| Some(onChange) => onChange(value)
2727
| None => ()
2828
},
29-
"editorDidMount": Js.Undefined.from_opt(editorDidMount),
30-
"options": Js.Undefined.from_opt(options)
29+
"editorDidMount": Js.Undefined.fromOption(editorDidMount),
30+
"options": Js.Undefined.fromOption(options)
3131
},
3232
children
3333
);

src/extension/content/convert/detect.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ let isWhitelisted = () => getWhitelist() |> List.mem(getSignificantUrl());
6363
let isBlacklisted = () => getBlacklist() |> List.mem(getSignificantUrl());
6464

6565
let shouldConvert = () => {
66-
let cached: option(bool) = [%raw "window._rtShouldConvert"] |> Js.Undefined.to_opt;
66+
let cached: option(bool) = [%raw "window._rtShouldConvert"] |> Js.Undefined.toOption;
6767
switch cached {
6868
| Some(shouldConvert) => shouldConvert
6969
| None =>

src/extension/content/convert/retrieve.re

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ type listing = {
1515
};
1616

1717
let getTypeTable = (pre) =>
18-
switch (Js.Null.to_opt(Element.nextElementSibling(pre))) {
18+
switch (Js.Null.toOption(Element.nextElementSibling(pre))) {
1919
| None => None
2020
| Some(el) =>
2121
if (Js.to_bool(DOMTokenList.contains(Element.classList(el), "typetable"))) {
2222
let text = Element.innerText(el);
23-
switch (Js.Null.to_opt(Element.nextSibling(el))) {
23+
switch (Js.Null.toOption(Element.nextSibling(el))) {
2424
| None => Some({el, text, remove: () => Element.remove(el)})
2525
| Some(next) =>
2626
if (Node.nodeType(next) == Node._TEXT_NODE) {

src/extension/content/convertPage.re

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
open Rebase;
2-
31
open LocalDom;
42

53
open Common;
@@ -18,7 +16,7 @@ let swapStyleSheets = (_) => {
1816
};
1917

2018
let readjustViewport = () =>
21-
if (! Str.isEmpty(Location.hash)) {
19+
if (! (Location.hash == "")) {
2220
[%bs.raw {| window.location.href = window.location.href |}]
2321
};
2422

@@ -31,8 +29,8 @@ let doListing = (mode, state, listing) => {
3129
text,
3230
(response) => {
3331
switch response {
34-
| Error(_) => () /* TODO */
35-
| Ok({outText}) => Replace.replaceListing(els, outText, replace)
32+
| Protocol.Error(_) => () /* TODO */
33+
| Protocol.Ok({outText}) => Replace.replaceListing(els, outText, replace)
3634
};
3735
/* we're in an async callback, so keep track of when we're finished by keeping count */
3836
state.remaining = state.remaining - 1;

src/extension/page.re

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
open LocalDom;
22

3-
open Rebase;
4-
53
let onOpen: string => unit = [%bs.raw
64
{|
75
function (hash) {
@@ -28,8 +26,8 @@ let refmt =
2826
~outLang,
2927
(error) =>
3028
switch error {
31-
| Error(error) => cb(error, RefmtShared.UnknownLang, RefmtShared.UnknownLang)
32-
| Ok({outText, inLang, outLang}) => cb(outText, inLang, outLang)
29+
| Protocol.Error(error) => cb(error, RefmtShared.UnknownLang, RefmtShared.UnknownLang)
30+
| Protocol.Ok({outText, inLang, outLang}) => cb(outText, inLang, outLang)
3331
}
3432
);
3533
Protocol.Storage.setLatestInput(input)

0 commit comments

Comments
 (0)