Check if file is ignored by prettier in apheleia

This commit is contained in:
Adam Goldsmith 2023-05-04 20:12:56 -04:00
parent 5f3d421593
commit ac4cd5a3f0

View File

@ -1076,7 +1076,12 @@
((member 'black formatters) (apheleia--pyproject-contains-section "tool.black"))
((member 'djlint formatters) (apheleia--pyproject-contains-section "tool.djlint"))
((member 'prettier formatters)
(= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name))))))))
(when (= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name)))
(let* ((config-file (shell-command-to-string (concat "prettier --find-config-path " (buffer-file-name))))
(default-directory (file-name-directory (expand-file-name config-file)))
(file-info (shell-command-to-string (concat "prettier --file-info " (buffer-file-name))))
(file-ignored (gethash "ignored" (json-parse-string file-info))))
(eq file-ignored :false))))))))
(add-to-list 'apheleia-inhibit-functions 'apheleia--check-formatter-configured)