Skip to content

Instantly share code, notes, and snippets.

@jeluard
Created July 27, 2017 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeluard/65d202fece6e13089787b973325d0303 to your computer and use it in GitHub Desktop.
Save jeluard/65d202fece6e13089787b973325d0303 to your computer and use it in GitHub Desktop.

This document details coding style followed by status-react project.

It is based on following documents:

Some points particularly relevant are refined bellow.

Namespaces

No :use, :refer or :refer :all, only :as

(ns examples.ns
  (:require [clojure.zip :as zip]))

Use consistent aliases across namespaces

Align keywords

(ns examples.ns
  (:require [clojure.string :as str]
                 [clojure.zip     :as zip]))

Use long aliases when needed

Comments

Comments start with ;;

;; some comment

Comments should be added before form

;; public key of current logged in account
(s/def ::current-public-key (s/nilable string?))

;; used in modal list (for example for wallet)
(s/def :contacts/contacts-click-params (s/nilable map?)) 

Re-frame

Declare keys on first line

 (reg-sub
    :photo-path
    :<- [:get :contacts]
    :<- [:get-contacts]
    (fn [contacts [_ id]]
      (:photo-path (contacts id))))

 (register-handler :request-discoveries
   ...)

+(reg-fx ::init-store
 +  (fn []
 +    (data-store/init)))

TODO Keywords and namespaces?

Specs

Use meaningful namespaced keywords

(s/def :contact/last-updated (s/nilable int?))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment