Skip to content

Commit

Permalink
Fixing lints
Browse files Browse the repository at this point in the history
  • Loading branch information
oliyh committed Jan 15, 2021
1 parent 4b9b439 commit da11c47
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 32 deletions.
8 changes: 4 additions & 4 deletions src/re_graph/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(re-frame/reg-event-fx
::mutate
interceptors
(fn [{:keys [db dispatchable-event instance-name]} [query-id query variables callback-event :as event]]
(fn [{:keys [db dispatchable-event instance-name]} [query-id query variables callback-event]]
(let [query (str "mutation " (string/replace query #"^mutation\s?" ""))
websocket-supported? (contains? (get-in db [:ws :supported-operations]) :mutate)]
(cond
Expand Down Expand Up @@ -62,7 +62,7 @@
(re-frame/reg-event-fx
::query
interceptors
(fn [{:keys [db dispatchable-event instance-name]} [query-id query variables callback-event :as event]]
(fn [{:keys [db dispatchable-event instance-name]} [query-id query variables callback-event]]
(let [query (str "query " (string/replace query #"^query\s?" ""))
websocket-supported? (contains? (get-in db [:ws :supported-operations]) :query)]
(cond
Expand Down Expand Up @@ -132,7 +132,7 @@
(re-frame/reg-event-fx
::subscribe
interceptors
(fn [{:keys [db instance-name dispatchable-event] :as cofx} [subscription-id query variables callback-event :as event]]
(fn [{:keys [db instance-name dispatchable-event]} [subscription-id query variables callback-event]]
(cond
(get-in db [:subscriptions (name subscription-id) :active?])
{} ;; duplicate subscription
Expand Down Expand Up @@ -165,7 +165,7 @@
(re-frame/reg-event-fx
::unsubscribe
interceptors
(fn [{:keys [db instance-name]} [subscription-id :as event]]
(fn [{:keys [db instance-name]} [subscription-id]]
(if (get-in db [:ws :ready?])
{:db (update db :subscriptions dissoc (name subscription-id))
::internals/send-ws [(get-in db [:ws :connection])
Expand Down
14 changes: 7 additions & 7 deletions src/re_graph/internals.cljc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns re-graph.internals
(:require [re-frame.core :as re-frame]
[re-frame.interceptor :refer [->interceptor get-coeffect assoc-coeffect update-coeffect get-effect assoc-effect enqueue]]
[re-frame.interceptor :refer [->interceptor get-coeffect assoc-coeffect update-coeffect get-effect assoc-effect]]
[re-frame.std-interceptors :as rfi]
[re-frame.interop :refer [empty-queue]]
[re-graph.logging :as log]
Expand Down Expand Up @@ -99,7 +99,7 @@
(cons-interceptor (rfi/path :re-graph instance-name))
(assoc-coeffect :event trimmed-event))

:default
:else
(do (log/error "No default instance of re-graph found but no valid instance name was provided. Valid instance names are:" (keys re-graph)
"but was provided with" provided-instance-name
"handling event" event-name)
Expand Down Expand Up @@ -203,7 +203,7 @@
(re-frame/reg-event-fx
::on-ws-data
interceptors
(fn [{:keys [db] :as cofx} [subscription-id payload :as event]]
(fn [{:keys [db]} [subscription-id payload]]
(if-let [callback-event (get-in db [:subscriptions (name subscription-id) :callback])]
{:dispatch (conj callback-event payload)}
(log/warn "No callback-event found for subscription" subscription-id))))
Expand Down Expand Up @@ -262,7 +262,7 @@

(defn- on-ws-message [instance-name]
(fn [m]
(let [{:keys [type id payload] :as data} (message->data m)]
(let [{:keys [type id payload]} (message->data m)]
(condp = type
"data"
(re-frame/dispatch [::on-ws-data instance-name id payload])
Expand All @@ -285,7 +285,7 @@
(re-frame/dispatch [::on-ws-open instance-name websocket]))))

(defn- on-close [instance-name]
(fn [& args]
(fn [& _args]
(re-frame/dispatch [::on-ws-close instance-name])))

(defn- on-error [instance-name]
Expand All @@ -301,7 +301,7 @@

(re-frame/reg-fx
::connect-ws
(fn [[instance-name {{:keys [url sub-protocol impl]} :ws}]]
(fn [[instance-name {{:keys [url sub-protocol #?(:clj impl)]} :ws}]]
#?(:cljs (let [ws (cond
(nil? sub-protocol)
(js/WebSocket. url)
Expand Down Expand Up @@ -364,7 +364,7 @@
{:requests {}})

(defn http-options
[{:keys [http] :or {http {}} :as options}]
[{:keys [http] :or {http {}}}]
(when http
(let [{:keys [url] :as http-options} (merge http-default-options http http-initial-state)]
(when url
Expand Down
3 changes: 1 addition & 2 deletions src/re_graph/logging.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
(ns re-graph.logging
(:refer-clojure :exclude [time])
(:require #?(:clj [clojure.tools.logging :as log]
:cljs [goog.log :as glog]))
#?(:cljs (:import goog.debug.Console)))
:cljs [goog.log :as glog])))

#?(:cljs
(def logger
Expand Down
10 changes: 5 additions & 5 deletions test/re_graph/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
[re-frame.db :refer [app-db]]
[day8.re-frame.test :refer [run-test-sync run-test-async wait-for]
:refer-macros [run-test-sync run-test-async wait-for]]
[clojure.test :refer [deftest is testing run-tests]
:refer-macros [deftest is testing run-tests]]
[clojure.test :refer [deftest is testing]
:refer-macros [deftest is testing]]
#?@(:clj [[cheshire.core :as json]
[hato.client :as hato]
[clj-http.client :as clj-http]])))
Expand Down Expand Up @@ -502,7 +502,7 @@
(let [query "{ things { id } }"
variables {:some "variable"}
http-url "http://foo.bar/graph-ql"
http-server-response (fn [url & [opts respond raise]]
http-server-response (fn [_url & [_opts respond _raise]]
(respond {:status 400, :body {:errors [{:message "OK"
:extensions {:status 404}}]}}))]
(init instance-name {:http {:url http-url}
Expand Down Expand Up @@ -595,7 +595,7 @@
(testing "Request can be specified"
(re-frame/reg-fx
::internals/send-http
(fn [[_ _ http-url {:keys [request payload]} :as fx-args]]
(fn [[_ _ _http-url {:keys [request]}]]
(is (= expected-request
request))))
(dispatch [::re-graph/query "{ things { id } }" {:some "variable"} [::on-thing]])
Expand Down Expand Up @@ -903,7 +903,7 @@
(let [last-http-message (atom nil)]
(re-frame/reg-fx
::internals/send-http
(fn [[_ _ http-url {:keys [request]} :as fx-args]]
(fn [[_ _ _http-url {:keys [request]} :as fx-args]]
(reset! last-http-message request)
(dispatch-response fx-args {})))

Expand Down
2 changes: 1 addition & 1 deletion test/re_graph/figwheel_runner.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
[re-graph.integration-test]
[figwheel.main.testing :refer [run-tests-async]]))

(defn -main [& args]
(defn -main [& _args]
(run-tests-async 5000))
6 changes: 3 additions & 3 deletions test/re_graph/integration_server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
[com.walmartlabs.lacinia.pedestal :as lacinia]
[com.walmartlabs.lacinia.schema :as schema]))

(defn- resolve-pets [context args parent]
(defn- resolve-pets [_context _args _parent]
[{:id 123 :name "Billy"}
{:id 234 :name "Bob"}
{:id 345 :name "Beatrice"}])

(defn- create-pet [context args parent]
(defn- create-pet [_context args _parent]
(assoc args :id 999))

(defn- stream-pets [context args source-stream]
(defn- stream-pets [_context args source-stream]
(let [{:keys [count]} args
runnable ^Runnable (fn []
(dotimes [i count]
Expand Down
9 changes: 4 additions & 5 deletions test/re_graph/integration_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
(:require [re-graph.core :as re-graph]
[re-graph.internals :as internals]
#?(:clj [clojure.test :refer [deftest testing is use-fixtures]]
:cljs [cljs.test :refer-macros [deftest testing is use-fixtures]])
[day8.re-frame.test :refer [run-test-sync run-test-async wait-for]
:refer-macros [run-test-sync]]
:cljs [cljs.test :refer-macros [deftest testing is]])
[day8.re-frame.test :refer [run-test-async wait-for #?(:clj run-test-sync)]]
[re-frame.core :as re-frame]
[re-frame.db :as rfdb]
#?(:clj [re-graph.integration-server :refer [with-server]])))
Expand Down Expand Up @@ -92,7 +91,7 @@

(re-frame/reg-fx
::internals/disconnect-ws
(fn [[ws]]
(fn [_]
(re-frame/dispatch [::ws-disconnected])))

(re-frame/reg-event-fx
Expand Down Expand Up @@ -139,7 +138,7 @@

(re-frame/reg-fx
::internals/disconnect-ws
(fn [[ws]]
(fn [_]
(re-frame/dispatch [::ws-disconnected])))

(re-frame/reg-event-fx
Expand Down
8 changes: 4 additions & 4 deletions test/re_graph/internals_test.cljc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(ns re-graph.internals-test
(:require [re-graph.internals :as internals]
[day8.re-frame.test :refer [run-test-sync run-test-async wait-for]
:refer-macros [run-test-sync run-test-async wait-for]]
[clojure.test :refer [deftest is testing run-tests]
:refer-macros [deftest is testing run-tests]]))
[day8.re-frame.test :refer [run-test-sync]
:refer-macros [run-test-sync]]
[clojure.test :refer [deftest is testing]
:refer-macros [deftest is testing]]))

(defn- run-options-test
[]
Expand Down
2 changes: 1 addition & 1 deletion test/re_graph/test_runner.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
(with-server
#(fig/-main "-co" "test.cljs.edn" "-m" "re-graph.figwheel-runner")))

(defn -main [& args]
(defn -main [& _args]
(run-tests))

0 comments on commit da11c47

Please sign in to comment.