aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--apheleia-formatters.el1
-rw-r--r--test/formatters/installers/oxfmt.bash1
-rw-r--r--test/formatters/samplecode/oxfmt/in.js4
-rw-r--r--test/formatters/samplecode/oxfmt/in.ts1
-rw-r--r--test/formatters/samplecode/oxfmt/out.js5
-rw-r--r--test/formatters/samplecode/oxfmt/out.ts6
7 files changed, 21 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f36d76a..09e3bd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,11 +9,14 @@ The format is based on [Keep a Changelog].
* `bibtex-reformat` for BibTeX files.
* `rubocop` changed to use `--force-exclusion` to obey exclusions in config
files ([#380]).
+* [oxfmt](https://oxc.rs/docs/guide/usage/formatter) for JavaScript and
+ TypeScript files ([#382]).
### Bugs fixed
* `shfmt` did not work with `apheleia-formatters-respect-indent-level`
[#380]: https://github.com/radian-software/apheleia/pull/380
+[#382]: https://github.com/radian-software/apheleia/pull/382
## 4.4.2 (released 2025-11-21)
### Bugs fixed
diff --git a/apheleia-formatters.el b/apheleia-formatters.el
index 0cfad9f..9bc39f8 100644
--- a/apheleia-formatters.el
+++ b/apheleia-formatters.el
@@ -112,6 +112,7 @@
"--enable-outside-detected-project"))
(ocp-indent . ("ocp-indent"))
(ormolu . ("ormolu" "--stdin-input-file" filepath))
+ (oxfmt . ("apheleia-npx" "oxfmt" inplace))
(perltidy . ("perltidy" "--quiet" "--standard-error-output"
(apheleia-formatters-indent "-t" "-i")
(apheleia-formatters-fill-column "-l")))
diff --git a/test/formatters/installers/oxfmt.bash b/test/formatters/installers/oxfmt.bash
new file mode 100644
index 0000000..7c33fd0
--- /dev/null
+++ b/test/formatters/installers/oxfmt.bash
@@ -0,0 +1 @@
+npm install -g oxfmt
diff --git a/test/formatters/samplecode/oxfmt/in.js b/test/formatters/samplecode/oxfmt/in.js
new file mode 100644
index 0000000..fd56713
--- /dev/null
+++ b/test/formatters/samplecode/oxfmt/in.js
@@ -0,0 +1,4 @@
+function HelloWorld({greeting = "hello", greeted = '"World"', silent = false, onMouseOver,}) {
+
+ if(!greeting){return null};
+ }
diff --git a/test/formatters/samplecode/oxfmt/in.ts b/test/formatters/samplecode/oxfmt/in.ts
new file mode 100644
index 0000000..c75d40f
--- /dev/null
+++ b/test/formatters/samplecode/oxfmt/in.ts
@@ -0,0 +1 @@
+interface GreetingSettings{greeting: string; duration?: number; color?: string;}declare function greet(setting: GreetingSettings): void;
diff --git a/test/formatters/samplecode/oxfmt/out.js b/test/formatters/samplecode/oxfmt/out.js
new file mode 100644
index 0000000..ca6d896
--- /dev/null
+++ b/test/formatters/samplecode/oxfmt/out.js
@@ -0,0 +1,5 @@
+function HelloWorld({ greeting = "hello", greeted = '"World"', silent = false, onMouseOver }) {
+ if (!greeting) {
+ return null;
+ }
+}
diff --git a/test/formatters/samplecode/oxfmt/out.ts b/test/formatters/samplecode/oxfmt/out.ts
new file mode 100644
index 0000000..143b5a7
--- /dev/null
+++ b/test/formatters/samplecode/oxfmt/out.ts
@@ -0,0 +1,6 @@
+interface GreetingSettings {
+ greeting: string;
+ duration?: number;
+ color?: string;
+}
+declare function greet(setting: GreetingSettings): void;