Skip to content

Commit

Permalink
Add support for cljstyle for Clojure code
Browse files Browse the repository at this point in the history
  • Loading branch information
dpassen committed Dec 9, 2024
1 parent 543f6d6 commit daaa9dd
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].

## Unreleased
### Formatters
* [cljstyle](https://github.com/greglook/cljstyle) for
for clojure, clojurescript, edn files.

## 4.3 (released 2024-11-12)
### Features
* New user option `apheleia-skip-functions`, like
Expand Down
1 change: 1 addition & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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"
Expand Down
1 change: 1 addition & 0 deletions test/formatters/installers/cljstyle.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl -sLO "https://raw.githubusercontent.com/greglook/cljstyle/main/util/install-cljstyle" && chmod +x install-cljstyle && ./install-cljstyle
12 changes: 12 additions & 0 deletions test/formatters/samplecode/cljstyle/in.clj
Original file line number Diff line number Diff line change
@@ -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))))
6 changes: 6 additions & 0 deletions test/formatters/samplecode/cljstyle/in.cljs
Original file line number Diff line number Diff line change
@@ -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"))
4 changes: 4 additions & 0 deletions test/formatters/samplecode/cljstyle/in.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:deps {clojure.java-time/clojure.java-time
{:mvn/version "1.1.0"}
}
}
16 changes: 16 additions & 0 deletions test/formatters/samplecode/cljstyle/out.clj
Original file line number Diff line number Diff line change
@@ -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))))
8 changes: 8 additions & 0 deletions test/formatters/samplecode/cljstyle/out.cljs
Original file line number Diff line number Diff line change
@@ -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"))
2 changes: 2 additions & 0 deletions test/formatters/samplecode/cljstyle/out.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:deps {clojure.java-time/clojure.java-time
{:mvn/version "1.1.0"}}}

0 comments on commit daaa9dd

Please sign in to comment.