From 9d2fd7b8e73c1829f3957799ea59ff25b8a96c0c Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Thu, 30 Mar 2023 11:21:27 -0400 Subject: [PATCH 1/3] feat: add prettier-json-stringify formatter --- apheleia-formatters.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apheleia-formatters.el b/apheleia-formatters.el index bef7aa0..b928504 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -128,6 +128,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" From c158010dcf554e2cd9a711c5caaa163110580652 Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Thu, 30 Mar 2023 11:39:32 -0400 Subject: [PATCH 2/3] docs: add the PR to the changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb03f72..ae2b5c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog]. +## Unreleased +### Formatters +* `prettier-json-stringify` ([#183]). + +[#183]: https://github.com/radian-software/apheleia/pull/183 + ## 4.3 (released 2024-11-12) ### Features * New user option `apheleia-skip-functions`, like From 0df46495ab417bca5cc6cbd38ee000f128bb9aa4 Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Wed, 25 Dec 2024 16:12:19 -0800 Subject: [PATCH 3/3] test: add tests for prettier-json-stringify formatter --- .../installers/prettier-json-stringify.bash | 1 + .../samplecode/prettier-json-stringify/in.json | 13 +++++++++++++ .../samplecode/prettier-json-stringify/out.json | 15 +++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 test/formatters/installers/prettier-json-stringify.bash create mode 100644 test/formatters/samplecode/prettier-json-stringify/in.json create mode 100644 test/formatters/samplecode/prettier-json-stringify/out.json 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": "" +}