aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--apheleia-formatters.el4
-rw-r--r--test/formatters/installers/prettier-json-stringify.bash1
-rw-r--r--test/formatters/samplecode/prettier-json-stringify/in.json13
-rw-r--r--test/formatters/samplecode/prettier-json-stringify/out.json15
5 files changed, 35 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3297592..6158708 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,8 +6,10 @@ The format is based on [Keep a Changelog].
## Unreleased
### Formatters
* `biome` ([#339]).
+* `prettier-json-stringify` ([#183]).
[#339]: https://github.com/radian-software/apheleia/pull/339
+[#183]: https://github.com/radian-software/apheleia/pull/183
## 4.3 (released 2024-11-12)
### Features
diff --git a/apheleia-formatters.el b/apheleia-formatters.el
index ba3aad1..092b41e 100644
--- a/apheleia-formatters.el
+++ b/apheleia-formatters.el
@@ -129,6 +129,10 @@
. ("apheleia-npx" "prettier" "--stdin-filepath" filepath
"--parser=json"
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
+ (prettier-json-stringify
+ . ("apheleia-npx" "prettier" "--stdin-filepath" filepath
+ "--parser=json-stringify"
+ (apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(prettier-markdown
. ("apheleia-npx" "prettier" "--stdin-filepath" filepath
"--parser=markdown"
diff --git a/test/formatters/installers/prettier-json-stringify.bash b/test/formatters/installers/prettier-json-stringify.bash
new file mode 100644
index 0000000..09ba518
--- /dev/null
+++ b/test/formatters/installers/prettier-json-stringify.bash
@@ -0,0 +1 @@
+npm install -g prettier
diff --git a/test/formatters/samplecode/prettier-json-stringify/in.json b/test/formatters/samplecode/prettier-json-stringify/in.json
new file mode 100644
index 0000000..f6d73a6
--- /dev/null
+++ b/test/formatters/samplecode/prettier-json-stringify/in.json
@@ -0,0 +1,13 @@
+{
+ "name": "test-package-json",
+ "version": "1.0.0",
+ "main": "index.js",
+ "files": ["index.js"],
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "description": ""
+}
diff --git a/test/formatters/samplecode/prettier-json-stringify/out.json b/test/formatters/samplecode/prettier-json-stringify/out.json
new file mode 100644
index 0000000..51ba2a3
--- /dev/null
+++ b/test/formatters/samplecode/prettier-json-stringify/out.json
@@ -0,0 +1,15 @@
+{
+ "name": "test-package-json",
+ "version": "1.0.0",
+ "main": "index.js",
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "description": ""
+}