aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Olson <me@mwolson.org>2025-12-13 15:23:25 -0500
committerGitHub <noreply@github.com>2025-12-13 12:23:25 -0800
commit8a6b75008d0cb5c5dabb08281ad2393ba4341d1c (patch)
tree09a19a13d502a3b857ccbad46a3fe81b52c68ac8 /test
parentfa5cb9b1d62a63f59e48649e478284d9fd6bb339 (diff)
Add support for oxfmt formatter (#382)
## Summary - Add oxfmt (Oxc Formatter) as a new formatter option for JavaScript and TypeScript files ## Details [Oxfmt](https://oxc.rs/docs/guide/usage/formatter) is a Rust-powered, Prettier-compatible code formatter from the Oxc project. It's currently in alpha but offers significant performance improvements (30x+ faster than Prettier). Key points: - Uses `inplace` mode since oxfmt doesn't support stdin/stdout - Works with all common JS/TS extensions (.js, .jsx, .mjs, .cjs, .ts, .tsx, .mts) - Not added to `apheleia-mode-alist` - users can opt-in by setting `apheleia-formatter` to `oxfmt` - Defaults are already sensible: 2-space indent, printWidth 100, no tabs Example usage: ```elisp (setf (alist-get 'oxfmt apheleia-formatters) '("apheleia-npx" "oxfmt" inplace)) ;; To use for JS/TS files: (setq-default apheleia-formatter 'oxfmt) ;; Or per-mode: (setf (alist-get 'typescript-ts-mode apheleia-mode-alist) 'oxfmt) ```
Diffstat (limited to 'test')
-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
5 files changed, 17 insertions, 0 deletions
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;