0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-26 08:29:42 -05:00

📎 Fix linter issues

Related to the linter update on devenv
This commit is contained in:
Andrey Antukh 2022-06-13 11:18:35 +02:00
parent 97bf20dd4c
commit 65e99cabbf
13 changed files with 33 additions and 31 deletions

View file

@ -213,7 +213,7 @@
[& args] [& args]
`(jdbc/with-transaction ~@args)) `(jdbc/with-transaction ~@args))
(defn ^Connection open (defn open
[pool] [pool]
(jdbc/get-connection pool)) (jdbc/get-connection pool))

View file

@ -27,7 +27,8 @@
(s/def ::info-data (s/def ::info-data
(s/keys :req-un [::fullname ::email ::backend])) (s/keys :req-un [::fullname ::email ::backend]))
(defn ^java.lang.AutoCloseable connect (defn connect
^java.lang.AutoCloseable
[] []
(let [params {:ssl? (cfg/get :ldap-ssl) (let [params {:ssl? (cfg/get :ldap-ssl)
:startTLS? (cfg/get :ldap-starttls) :startTLS? (cfg/get :ldap-starttls)

View file

@ -130,7 +130,8 @@
(def default-timeout (def default-timeout
(dt/duration {:seconds 30})) (dt/duration {:seconds 30}))
(defn- ^Region lookup-region (defn- lookup-region
^Region
[region] [region]
(Region/of (name region))) (Region/of (name region)))

View file

@ -30,7 +30,8 @@
[v] [v]
(InternetAddress/parse ^String v)) (InternetAddress/parse ^String v))
(defn- ^Message$RecipientType resolve-recipient-type (defn- resolve-recipient-type
^Message$RecipientType
[type] [type]
(case type (case type
:to Message$RecipientType/TO :to Message$RecipientType/TO
@ -157,7 +158,8 @@
(.setDebug session debug) (.setDebug session debug)
session)) session))
(defn ^MimeMessage smtp-message (defn smtp-message
^MimeMessage
[cfg message] [cfg message]
(let [^Session session (smtp-session cfg)] (let [^Session session (smtp-session cfg)]
(build-message cfg session message))) (build-message cfg session message)))

View file

@ -169,7 +169,7 @@
[svg-attrs svg-styles] [svg-attrs svg-styles]
(extract-svg-attrs render-id svg-defs svg-attrs) (extract-svg-attrs render-id svg-defs svg-attrs)
styles (-> (obj/get props "style" (obj/new)) styles (-> (obj/get props "style" (obj/create))
(obj/merge! svg-styles) (obj/merge! svg-styles)
(add-layer-props shape)) (add-layer-props shape))
@ -211,24 +211,24 @@
(defn extract-style-attrs (defn extract-style-attrs
[shape] [shape]
(-> (obj/new) (-> (obj/create)
(add-style-attrs shape))) (add-style-attrs shape)))
(defn extract-fill-attrs (defn extract-fill-attrs
[fill-data render-id index type] [fill-data render-id index type]
(let [fill-styles (-> (obj/get fill-data "style" (obj/new)) (let [fill-styles (-> (obj/get fill-data "style" (obj/create))
(add-fill fill-data render-id index type))] (add-fill fill-data render-id index type))]
(-> (obj/new) (-> (obj/create)
(obj/set! "style" fill-styles)))) (obj/set! "style" fill-styles))))
(defn extract-stroke-attrs (defn extract-stroke-attrs
[stroke-data index render-id] [stroke-data index render-id]
(let [stroke-styles (-> (obj/get stroke-data "style" (obj/new)) (let [stroke-styles (-> (obj/get stroke-data "style" (obj/create))
(add-stroke stroke-data render-id index))] (add-stroke stroke-data render-id index))]
(-> (obj/new) (-> (obj/create)
(obj/set! "style" stroke-styles)))) (obj/set! "style" stroke-styles))))
(defn extract-border-radius-attrs (defn extract-border-radius-attrs
[shape] [shape]
(-> (obj/new) (-> (obj/create)
(add-border-radius shape))) (add-border-radius shape)))

View file

@ -428,7 +428,7 @@
elem-name (obj/get child "type") elem-name (obj/get child "type")
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx)) render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx))
stroke-id (dm/fmt "strokes-%" (:id shape)) stroke-id (dm/fmt "strokes-%" (:id shape))
stroke-props (-> (obj/new) stroke-props (-> (obj/create)
(obj/set! "id" stroke-id) (obj/set! "id" stroke-id)
(cond-> (cond->
;; There is a blur ;; There is a blur

View file

@ -262,7 +262,7 @@
(when (= (:type shape) :svg-raw) (when (= (:type shape) :svg-raw)
(let [shape (-> shape (d/update-in-when [:content :attrs :style] str->style)) (let [shape (-> shape (d/update-in-when [:content :attrs :style] str->style))
props props
(-> (obj/new) (-> (obj/create)
(obj/set! "penpot:x" (:x shape)) (obj/set! "penpot:x" (:x shape))
(obj/set! "penpot:y" (:y shape)) (obj/set! "penpot:y" (:y shape))
(obj/set! "penpot:width" (:width shape)) (obj/set! "penpot:width" (:width shape))
@ -328,7 +328,7 @@
(mf/defc export-data (mf/defc export-data
[{:keys [shape]}] [{:keys [shape]}]
(let [props (-> (obj/new) (add-data shape) (add-library-refs shape))] (let [props (-> (obj/create) (add-data shape) (add-library-refs shape))]
[:> "penpot:shape" props [:> "penpot:shape" props
(export-shadow-data shape) (export-shadow-data shape)
(export-blur-data shape) (export-blur-data shape)

View file

@ -34,18 +34,18 @@
; Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1734805 ; Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1734805
[clip-wrapper clip-props] [clip-wrapper clip-props]
(if masked-group? (if masked-group?
["g" (-> (obj/new) ["g" (-> (obj/create)
(obj/set! "clipPath" (clip-url render-id mask)))] (obj/set! "clipPath" (clip-url render-id mask)))]
[mf/Fragment nil]) [mf/Fragment nil])
[mask-wrapper mask-props] [mask-wrapper mask-props]
(if masked-group? (if masked-group?
["g" (-> (obj/new) ["g" (-> (obj/create)
(obj/set! "mask" (mask-url render-id mask)))] (obj/set! "mask" (mask-url render-id mask)))]
[mf/Fragment nil]) [mf/Fragment nil])
;; This factory is generic, it's used for viewer, workspace and handoff. ;; This factory is generic, it's used for viewer, workspace and handoff.
;; These props are generated in viewer wrappers only, in the rest of the ;; These props are generated in viewer wrappers only, in the rest of the
;; cases these props will be nil, not affecting the code. ;; cases these props will be nil, not affecting the code.
delta (unchecked-get props "delta") delta (unchecked-get props "delta")
fixed? (unchecked-get props "fixed?")] fixed? (unchecked-get props "fixed?")]

View file

@ -55,9 +55,8 @@
type (:type shape) type (:type shape)
render-id (mf/use-memo #(str (uuid/next))) render-id (mf/use-memo #(str (uuid/next)))
filter-id (str "filter_" render-id) filter-id (str "filter_" render-id)
styles (-> (obj/new) styles (-> (obj/create)
(obj/set! "pointerEvents" pointer-events) (obj/set! "pointerEvents" pointer-events)
(cond-> (and (:blend-mode shape) (not= (:blend-mode shape) :normal)) (cond-> (and (:blend-mode shape) (not= (:blend-mode shape) :normal))
(obj/set! "mixBlendMode" (d/name (:blend-mode shape))))) (obj/set! "mixBlendMode" (d/name (:blend-mode shape)))))

View file

@ -11,7 +11,6 @@
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
[app.common.geom.shapes :as gsh] [app.common.geom.shapes :as gsh]
[app.main.ui.shapes.filters :as f] [app.main.ui.shapes.filters :as f]
[app.util.object :as obj]
[app.util.svg :as usvg] [app.util.svg :as usvg]
[rumext.alpha :as mf])) [rumext.alpha :as mf]))
@ -68,7 +67,7 @@
[wrapper wrapper-props] (if (= tag :mask) [wrapper wrapper-props] (if (= tag :mask)
["g" #js {:className "svg-mask-wrapper" ["g" #js {:className "svg-mask-wrapper"
:transform (str transform)}] :transform (str transform)}]
[mf/Fragment (obj/new)])] [mf/Fragment #js {}])]
[:> (name tag) (clj->js attrs) [:> (name tag) (clj->js attrs)
[:> wrapper wrapper-props [:> wrapper wrapper-props

View file

@ -212,11 +212,11 @@
:y y :y y
:id id :id id
:data-colors (->> colors (str/join ",")) :data-colors (->> colors (str/join ","))
:data-mapping (-> color-mapping-inverse (clj->js) (js/JSON.stringify)) :data-mapping (-> color-mapping-inverse clj->js js/JSON.stringify)
:transform transform :transform transform
:width (if (#{:auto-width} grow-type) 100000 width) :width (if (#{:auto-width} grow-type) 100000 width)
:height (if (#{:auto-height :auto-width} grow-type) 100000 height) :height (if (#{:auto-height :auto-width} grow-type) 100000 height)
:style (-> (obj/new) (attrs/add-layer-props shape)) :style (-> (obj/create) (attrs/add-layer-props shape))
:ref ref} :ref ref}
;; We use a class here because react has a bug that won't use the appropriate selector for ;; We use a class here because react has a bug that won't use the appropriate selector for
;; `background-clip` ;; `background-clip`

View file

@ -89,7 +89,7 @@
childs (mapv #(get objects %) (:shapes shape)) childs (mapv #(get objects %) (:shapes shape))
shape (geom/transform-shape shape) shape (geom/transform-shape shape)
props (-> (obj/new) props (-> (obj/create)
(obj/merge! props) (obj/merge! props)
(obj/merge! #js {:shape shape (obj/merge! #js {:shape shape
:childs childs}))] :childs childs}))]
@ -105,7 +105,7 @@
[props] [props]
(let [shape (unchecked-get props "shape") (let [shape (unchecked-get props "shape")
childs (mapv #(get objects %) (:shapes shape)) childs (mapv #(get objects %) (:shapes shape))
props (-> (obj/new) props (-> (obj/create)
(obj/merge! props) (obj/merge! props)
(obj/merge! #js {:childs childs}))] (obj/merge! #js {:childs childs}))]
[:> group-wrapper props])))) [:> group-wrapper props]))))
@ -121,7 +121,7 @@
(let [shape (unchecked-get props "shape") (let [shape (unchecked-get props "shape")
children (->> (cph/get-children-ids objects (:id shape)) children (->> (cph/get-children-ids objects (:id shape))
(select-keys objects)) (select-keys objects))
props (-> (obj/new) props (-> (obj/create)
(obj/merge! props) (obj/merge! props)
(obj/merge! #js {:childs children}))] (obj/merge! #js {:childs children}))]
[:> bool-wrapper props])))) [:> bool-wrapper props]))))
@ -136,7 +136,7 @@
[props] [props]
(let [shape (unchecked-get props "shape") (let [shape (unchecked-get props "shape")
childs (mapv #(get objects %) (:shapes shape)) childs (mapv #(get objects %) (:shapes shape))
props (-> (obj/new) props (-> (obj/create)
(obj/merge! props) (obj/merge! props)
(obj/merge! #js {:childs childs}))] (obj/merge! #js {:childs childs}))]
[:> svg-raw-wrapper props])))) [:> svg-raw-wrapper props]))))

View file

@ -6,12 +6,12 @@
(ns app.util.object (ns app.util.object
"A collection of helpers for work with javascript objects." "A collection of helpers for work with javascript objects."
(:refer-clojure :exclude [set! get get-in merge clone contains?]) (:refer-clojure :exclude [set! new get get-in merge clone contains?])
(:require (:require
["lodash/omit" :as omit] ["lodash/omit" :as omit]
[cuerdas.core :as str])) [cuerdas.core :as str]))
(defn new [] #js {}) (defn create [] #js {})
(defn get (defn get
([obj k] ([obj k]