Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier not formatting typescript file #72

Open
aoshi321 opened this issue May 25, 2022 · 1 comment
Open

Prettier not formatting typescript file #72

aoshi321 opened this issue May 25, 2022 · 1 comment

Comments

@aoshi321
Copy link

Hi

I have the following setting

(add-hook 'typescript-mode-hook 'prettier-js-mode)

but on save nothing happens.

thanks

@eliphazbouye
Copy link

eliphazbouye commented Jun 12, 2023

I have same issue, @aoshi321 you can fix that by adding a after-save-hook on your typescript emacs config.
Example :

(use-package typescript-mode
  :straight t
  :mode ("\\.tsx?\\'" . typescript-mode)
  :config
  (setq typescript-indent-level 2)
  (add-hook 'flycheck-mode-hook #'sopho/use-eslint-from-node-modules)
  (add-hook 'after-after-hook #'prettier-js-mode)) ; format file with prettier on save

(use-package prettier-js
  :straight t
  :commands (prettier-js-mode prettier-js)
  :hook ((typescript-mode . prettier-js-mode)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants