Skip to content

Commit

Permalink
Enable json5 and json-stringify parsers by default
Browse files Browse the repository at this point in the history
These two parsers were accidentally omitted from the default list.  In
particular, this broke the choice of parser for package.json files.
So add them to the default list.

This solves the original motivating factor for #92, but not #92
itself which is a request for enhanced debugging capabilities.

Original commit by @aspiers, re-committed here in an attempt to fix a
mysterious CI failure.
  • Loading branch information
jscheid committed Sep 20, 2021
1 parent 85c9349 commit 5cc1eec
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions prettier-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions prettier.el
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Requires Prettier 1.9+."
html
java
json
json5
json-stringify
less
lua
markdown
Expand Down
3 changes: 3 additions & 0 deletions test-cases/json-stringify/a.original.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"keywords": ["mtg"]
}
5 changes: 5 additions & 0 deletions test-cases/json-stringify/a.prettier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"keywords": [
"mtg"
]
}
12 changes: 12 additions & 0 deletions test-cases/json-stringify/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions test-cases/json-stringify/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"prettier": "^2.2.1"
}
}
7 changes: 7 additions & 0 deletions test-cases/json-stringify/prepare.elisp
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit 5cc1eec

Please sign in to comment.