diff options
| author | Derek Passen <dpassen1@gmail.com> | 2025-01-22 00:24:27 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-21 22:24:27 -0800 |
| commit | 049325e7734603e3c7ba05f26016beccafefb473 (patch) | |
| tree | a1fe1e55a6a91e5678dfd2ededa2e6323016c76c | |
| parent | 37f0a048bf91c7a145b33e98c984eb58132fb2f6 (diff) | |
Add support for `cljstyle` for Clojure code (#333)
Add support for [cljstyle](https://github.com/greglook/cljstyle)
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | apheleia-formatters.el | 1 | ||||
| -rw-r--r-- | test/formatters/installers/cljstyle.bash | 1 | ||||
| -rw-r--r-- | test/formatters/samplecode/cljstyle/in.clj | 12 | ||||
| -rw-r--r-- | test/formatters/samplecode/cljstyle/in.cljs | 6 | ||||
| -rw-r--r-- | test/formatters/samplecode/cljstyle/in.edn | 4 | ||||
| -rw-r--r-- | test/formatters/samplecode/cljstyle/out.clj | 16 | ||||
| -rw-r--r-- | test/formatters/samplecode/cljstyle/out.cljs | 8 | ||||
| -rw-r--r-- | test/formatters/samplecode/cljstyle/out.edn | 2 |
9 files changed, 52 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a1d4a5f..43a95cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog]. ## Unreleased ### Formatters +* [cljstyle](https://github.com/greglook/cljstyle) + for clojure, clojurescript, edn files. * `biome` ([#339]). * `gdformat` for [gdscript](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html) ([#342]). * `prettier-json-stringify` ([#183]). diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 7366262..95f663d 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -43,6 +43,7 @@ (apheleia-formatters-mode-extension) ".c"))) (cljfmt . ("cljfmt" "fix" "-")) + (cljstyle . ("cljstyle" "pipe")) (cmake-format . ("cmake-format" "-")) (crystal-tool-format . ("crystal" "tool" "format" "-")) (css-beautify "css-beautify" "--file" "-" "--end-with-newline" diff --git a/test/formatters/installers/cljstyle.bash b/test/formatters/installers/cljstyle.bash new file mode 100644 index 0000000..bffdfcf --- /dev/null +++ b/test/formatters/installers/cljstyle.bash @@ -0,0 +1 @@ +curl -sLO "https://raw.githubusercontent.com/greglook/cljstyle/main/util/install-cljstyle" && chmod +x install-cljstyle && ./install-cljstyle diff --git a/test/formatters/samplecode/cljstyle/in.clj b/test/formatters/samplecode/cljstyle/in.clj new file mode 100644 index 0000000..c783b0f --- /dev/null +++ b/test/formatters/samplecode/cljstyle/in.clj @@ -0,0 +1,12 @@ +(ns hello +(:require [java-time.api :as t])) + +(defn time-str + "Returns a string representation of a datetime in the local time zone." + [instant] + (t/format + (t/with-zone (t/formatter "hh:mm a") (t/zone-id)) +instant)) + +(defn run [opts] +(println "Hello world, the time is" (time-str (t/instant)))) diff --git a/test/formatters/samplecode/cljstyle/in.cljs b/test/formatters/samplecode/cljstyle/in.cljs new file mode 100644 index 0000000..1649480 --- /dev/null +++ b/test/formatters/samplecode/cljstyle/in.cljs @@ -0,0 +1,6 @@ +(ns hello-world.core +(:require react-dom)) + +(.render js/ReactDOM +(.createElement js/React "h2" nil "Hello, React!") + (.getElementById js/document "app")) diff --git a/test/formatters/samplecode/cljstyle/in.edn b/test/formatters/samplecode/cljstyle/in.edn new file mode 100644 index 0000000..88af84a --- /dev/null +++ b/test/formatters/samplecode/cljstyle/in.edn @@ -0,0 +1,4 @@ +{:deps {clojure.java-time/clojure.java-time +{:mvn/version "1.1.0"} + } + } diff --git a/test/formatters/samplecode/cljstyle/out.clj b/test/formatters/samplecode/cljstyle/out.clj new file mode 100644 index 0000000..69c2dbb --- /dev/null +++ b/test/formatters/samplecode/cljstyle/out.clj @@ -0,0 +1,16 @@ +(ns hello + (:require + [java-time.api :as t])) + + +(defn time-str + "Returns a string representation of a datetime in the local time zone." + [instant] + (t/format + (t/with-zone (t/formatter "hh:mm a") (t/zone-id)) + instant)) + + +(defn run + [opts] + (println "Hello world, the time is" (time-str (t/instant)))) diff --git a/test/formatters/samplecode/cljstyle/out.cljs b/test/formatters/samplecode/cljstyle/out.cljs new file mode 100644 index 0000000..a2f1106 --- /dev/null +++ b/test/formatters/samplecode/cljstyle/out.cljs @@ -0,0 +1,8 @@ +(ns hello-world.core + (:require + [react-dom])) + + +(.render js/ReactDOM + (.createElement js/React "h2" nil "Hello, React!") + (.getElementById js/document "app")) diff --git a/test/formatters/samplecode/cljstyle/out.edn b/test/formatters/samplecode/cljstyle/out.edn new file mode 100644 index 0000000..9c0ad45 --- /dev/null +++ b/test/formatters/samplecode/cljstyle/out.edn @@ -0,0 +1,2 @@ +{:deps {clojure.java-time/clojure.java-time + {:mvn/version "1.1.0"}}} |
