fix(formatting): specify parser for prettier-js to avoid errors

Some buffers which use markdown-mode or yaml mode yield errors when
using the prettier-js package to format them, as it looks at the file
extension by default to figure out what parser to use.

Some temporary files that use these modes don't have the correct file
extension, so prettier-js yields an error. My manually specifying the
correct "--parser" option for each major-mode, this is no longer an
issue.
This commit is contained in:
2021-04-07 22:49:58 +01:00
parent dc24cd4f7f
commit 7de79dd704
2 changed files with 4 additions and 2 deletions

View File

@@ -42,7 +42,8 @@
:init
(defun siren-markdown-mode-setup ()
(setq-local markdown-asymmetric-header t
prettier-js-args '("--print-width" "80"
prettier-js-args '("--parser" "markdown"
"--print-width" "80"
"--prose-wrap" "always")
whitespace-action nil)

View File

@@ -20,7 +20,8 @@
:init
(defun siren-yaml-mode-setup ()
(run-hooks 'prog-mode-hook)
(setq tab-width 2)
(setq tab-width 2
prettier-js-args '("--parser" "yaml"))
(prettier-js-mode)
(subword-mode +1)))