Skip to content

Commit

Permalink
Add editorconfig file for consistent whitespace (bhauman#522)
Browse files Browse the repository at this point in the history
* Add editorconfig file

* Remove trailing spaces and add newlines
  • Loading branch information
danielcompton authored and Bruce Hauman committed Feb 7, 2017
1 parent e626ee1 commit 250dcb6
Show file tree
Hide file tree
Showing 27 changed files with 152 additions and 141 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
12 changes: 6 additions & 6 deletions example/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

:resource-paths ["resources" "other_resources"]


:cljsbuild {
:builds {
:example {
Expand All @@ -69,9 +69,9 @@
;; :recompile-dependents true
:optimizations :none}}






:example-prod {
:source-paths ["src"]
:compiler { :main example.core
Expand All @@ -90,7 +90,7 @@
:target :nodejs
:source-map true}}
:example-admin {
:figwheel true
:figwheel true
:source-paths ["other_src" "src" #_"../support/src"]
:compiler {
:main "example-admin.core"
Expand Down Expand Up @@ -133,7 +133,7 @@
:server-port 3449 ;; default
:css-dirs ["resources/public/css"]
:open-file-command "emacsclient"

;; :ring-handler example.server/handler

;; :repl false
Expand Down Expand Up @@ -172,5 +172,5 @@

;; :validate-config :warn-unknown-keys
;; :validate-interactive true

})
2 changes: 1 addition & 1 deletion example/script/figwheel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:all-builds
[{ :id "example"
:source-paths ["src"]

:figwheel { :websocket-host "localhost"
:on-jsload "example.core/fig-reload"
; :debug true
Expand Down
2 changes: 1 addition & 1 deletion examples/implicit-js-reloading/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
:output-to "resources/public/js/compiled/example.js"
:output-dir "resources/public/js/compiled/out"
:source-map-timestamp true}}

;; JavaScript can also be the root of a cljs project!
;; This means that you can build a JavaScript project
;; in Figwheel. Again you need to follow the
Expand Down
4 changes: 2 additions & 2 deletions examples/js-modules-reloading/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.459"]]

:plugins [[lein-figwheel "0.5.10-SNAPSHOT"]]

:clean-targets ^{:protect false} ["resources/public/js/compiled" :target-path]

:source-paths ["src"]

:cljsbuild {:builds
Expand Down
6 changes: 3 additions & 3 deletions examples/separate-server/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
;; NOTE: lein-ring plugin allows you to start a server
;; with a simple `lein ring`
;; see --> https://github.com/weavejester/lein-ring

[lein-ring "0.10.0"]]

;; NOTE: configure lein-ring to serve your ring handler
Expand Down Expand Up @@ -66,7 +66,7 @@
:aliases {"package" ["do" "clean"
["cljsbuild" "once" "min"]
["ring" "uberjar"]]}

;; setting up nREPL for Figwheel and ClojureScript dev
;; Please see:
;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl
Expand All @@ -78,7 +78,7 @@
;; see --> dev/user.clj
[ring-server "0.4.0"]]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]

;; need to add dev source path here to get user.clj loaded
:source-paths ["src" "dev"]
;; for CIDER
Expand Down
2 changes: 1 addition & 1 deletion examples/using-ring-handler/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
[figwheel-sidecar "0.5.10-SNAPSHOT"]
[com.cemerick/piggieback "0.2.1"]]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]

;; need to add dev source path here to get user.clj loaded
:source-paths ["src" "dev"]
;; for CIDER
Expand Down
2 changes: 1 addition & 1 deletion plugin/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
:source-paths ["dev" "src"]
:aliases {"change-version" ["run" "-m" "figwheel-tasks.core" ":change-version"]
"install-all" ["run" "-m" "figwheel-tasks.core" ":install-all"]}}}

:eval-in-leiningen true)
18 changes: 9 additions & 9 deletions plugin/src/leiningen/figwheel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#_[clojure.pprint :as pp]
[leiningen.core.eval :as leval]
[leiningen.clean :as clean]
[leiningen.core.main :as main]
[leiningen.core.main :as main]
[clojure.java.io :as io]
[clojure.set :refer [intersection]]
[leiningen.figwheel.fuzzy :as fuz]
Expand Down Expand Up @@ -91,7 +91,7 @@
(defn project-keys-affected-by-profile-mering [project]
(when-let [{:keys [profiles]} (meta project)]
(when (map? profiles)
(->> profiles
(->> profiles
vals
(filter map?)
(mapcat keys)
Expand Down Expand Up @@ -119,7 +119,7 @@
false)))

(comment

(def r (leiningen.core.project/read))
#_(meta (raw-project-with-profile-meta r))
(not= (fuzzy-config-from-project (:without-profiles (meta r)))
Expand Down Expand Up @@ -230,7 +230,7 @@
(str "---- Bad figwheel.edn File! ----\n"
"You have a malformed figwheel.edn file at the root of your\n"
"of your project directory.\n\n"

"While reading this file we encountered the following error:\n"
" ---> " (.getMessage e)
"\n\n"
Expand Down Expand Up @@ -315,7 +315,7 @@
(filter map?)
(keep (fn [x] (get-in x [:compiler :output-to])))
(filter string?)
(keep #(.getParentFile (io/file %)))
(keep #(.getParentFile (io/file %)))
distinct
(mapv #(.mkdirs %)))))

Expand All @@ -330,7 +330,7 @@
:builds-to-start ["asdf"]
:load-all-builds false
}})

(source-paths-for-classpath (normalize-data test-project ["example"]))
(figwheel-exec-body `())

Expand Down Expand Up @@ -360,7 +360,7 @@

(defn report-if-bad-command [command]
(when (and (command-like? command)
(not (known-commands command)))
(not (known-commands command)))
(println (str "Command Error: " (pr-str command)
" is not a known Figwheel command."))
(println " Known commands" (vec known-commands))
Expand Down Expand Up @@ -496,11 +496,11 @@ Commands:
builds.
:help
Prints this documentation
Configuration:
Figwheel relies on a configuration that is found in the project.clj
or in a figwheel.edn file in your project root. If a figwheel.edn is
present any Figwheel configuration found in the project.clj will be
Expand Down
2 changes: 1 addition & 1 deletion plugin/test/leiningen/figwheel_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
(= (->> v :cljsbuild :builds count)
(count (:all-builds nd)))))))

(defspec source-paths-for-class-path-arbi
(defspec source-paths-for-class-path-arbi
iterations
(prop/for-all
[v (gen/map (gen/elements [:figwheel-options :all-builds :build-ids])
Expand Down
4 changes: 2 additions & 2 deletions sidecar/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
[strictly-specking-standalone "0.1.1"]]

:clean-targets ^{:protect false} ["dev-resources/public/js" "target"]

:profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"]]
:source-paths ["cljs_src" "src"]
:plugins [[lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]
Expand Down Expand Up @@ -67,5 +67,5 @@
:optimizations :simple}
}]
}

)
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
(cond
(false? reload-clj-files) false
(or (true? reload-clj-files)
(not (map? reload-clj-files)))
(not (map? reload-clj-files)))
{:cljc true :clj true}
:else reload-clj-files))

Expand Down Expand Up @@ -105,7 +105,7 @@
(:id build-config)
{ :msg-name :files-changed
:files [{:file first-file :type :file}]}))))

(catch Throwable e
(notify/handle-exceptions figwheel-server (assoc build-config :exception e))))
(build-fn build-state)))))
6 changes: 3 additions & 3 deletions sidecar/src/figwheel_sidecar/build_middleware/injection.clj
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
(update-in [:compile-paths]
;; using the connect script instead of inline code because of two prominent
;; CLJS bugs
;; - another where the connection script isn't generated in a node env
;; - another where the connection script isn't generated in a node env
;; https://github.com/bhauman/lein-figwheel/issues/474
;; - one where analysis cache is invlidated
;; https://github.com/bhauman/lein-figwheel/issues/489
Expand Down Expand Up @@ -170,10 +170,10 @@

(defn require-connection-script-js [build]
(let [node? (when-let [target (get-in build [:build-options :target])]
(= target :nodejs))
(= target :nodejs))
main? (get-in build [:build-options :main])
output-to (get-in build [:build-options :output-to])
munged-connect-script-ns (compiler/munge (figwheel-connect-ns-name build))
munged-connect-script-ns (compiler/munge (figwheel-connect-ns-name build))
line (if (and main? (not node?))
(str
(when (get-in build [:figwheel :devcards])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

(defn file-changed?
"Standard checksum to see if a file actually changed."
[{:keys [file-md5-atom]} filepath]
[{:keys [file-md5-atom]} filepath]
(when-let [file (io/file filepath)]
(when (.exists file)
(let [contents (slurp file)]
Expand Down
12 changes: 6 additions & 6 deletions sidecar/src/figwheel_sidecar/cljs_utils/exception_parsing.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[clojure.stacktrace :as stack]
[clojure.walk :refer [postwalk]]
#_[clojure.pprint :refer [pprint]]
[strictly-specking-standalone.ansi-util :refer [color-text]]
[strictly-specking-standalone.ansi-util :refer [color-text]]
#_[cljs.build.api :as bapi]
[figwheel-sidecar.utils :as utils]))

Expand All @@ -25,10 +25,10 @@
(def serialize-edn-for-js-env (partial postwalk serialize-filter))

(defn inspect-exception [ex]
(->
(->
{:class (type ex)
:message (.getMessage ex)
:data (ex-data ex)
:data (ex-data ex)
:cause (when (.getCause ex) (inspect-exception (.getCause ex)))}
;; adding exception to meta data because I don't want it serialize over the wire
;; and its only here as a fall back
Expand Down Expand Up @@ -200,7 +200,7 @@
[[:error-in-code line (nth lines (dec line))]]
[[:error-message nil
(breaker-line (nth lines (dec line))
(when-not (= environment :repl) message)
(when-not (= environment :repl) message)
(if (= line 1)
(+ (repl-prompt-indent
environment
Expand Down Expand Up @@ -421,7 +421,7 @@
(fn [{:keys [class message]}]
(str " " (when class (str (left-pad-string max-len class) " : "))
(color-text message :bold)))
messages)))
messages)))
"\n\n"))
(when (pos? (count error-inline))
(str (format-error-inline error-inline)
Expand Down Expand Up @@ -518,7 +518,7 @@
(catch Throwable e
(inspect-exception e)
#_(print-exception e)
#_(->>
#_(->>
exception-data->display-data
formatted-exception-display-str
#_println
Expand Down
Loading

0 comments on commit 250dcb6

Please sign in to comment.