diff --git a/prettier-tests.el b/prettier-tests.el index 83a2848..2d33b28 100644 --- a/prettier-tests.el +++ b/prettier-tests.el @@ -45,6 +45,7 @@ (insert-file-contents original-file) (setq buffer-file-name original-file) (rename-buffer original-file) + (prettier--eval-file-if-exists "prepare.elisp") (set-auto-mode) (prettier--eval-file-if-exists "setup.elisp") (prettier-prettify) diff --git a/prettier.el b/prettier.el index c3f9934..34c65d4 100644 --- a/prettier.el +++ b/prettier.el @@ -153,6 +153,8 @@ Requires Prettier 1.9+." html java json + json5 + json-stringify less lua markdown diff --git a/test-cases/json-stringify/a.original.json b/test-cases/json-stringify/a.original.json new file mode 100644 index 0000000..e00f0f5 --- /dev/null +++ b/test-cases/json-stringify/a.original.json @@ -0,0 +1,3 @@ +{ + "keywords": ["mtg"] +} diff --git a/test-cases/json-stringify/a.prettier.json b/test-cases/json-stringify/a.prettier.json new file mode 100644 index 0000000..9d55d14 --- /dev/null +++ b/test-cases/json-stringify/a.prettier.json @@ -0,0 +1,5 @@ +{ + "keywords": [ + "mtg" + ] +} diff --git a/test-cases/json-stringify/package-lock.json b/test-cases/json-stringify/package-lock.json new file mode 100644 index 0000000..ca025f4 --- /dev/null +++ b/test-cases/json-stringify/package-lock.json @@ -0,0 +1,12 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + } + } +} diff --git a/test-cases/json-stringify/package.json b/test-cases/json-stringify/package.json new file mode 100644 index 0000000..9caf44e --- /dev/null +++ b/test-cases/json-stringify/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "prettier": "^2.2.1" + } +} diff --git a/test-cases/json-stringify/prepare.elisp b/test-cases/json-stringify/prepare.elisp new file mode 100644 index 0000000..c328a7c --- /dev/null +++ b/test-cases/json-stringify/prepare.elisp @@ -0,0 +1,7 @@ +(progn + (setq buffer-file-name (concat (file-name-directory buffer-file-name) "package.json")) + (json-mode)) + +;; Local Variables: +;; mode: emacs-lisp +;; End: