prettier / prettier-emacs

Minor mode to format JS code on file save

Home Page:http://jlongster.com/A-Prettier-Formatter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prettier options for Typescript

ivikash opened this issue Β· comments

Hey, I am trying to use prettier for typescript. By command line I am using --print-width 80 --single-quote --no-semi --no-bracket-spacing --write. Can you please let me know, how can I replicate this in elisp?

If I try this

  (setq prettier-js-args '(
                           "--print-width" "80"
                           "--single-quote" "true"
                           "--no-semi" "true"
                           "--no-bracket-spacing" "true"

                           ))

I receive the following error.

prettier errors:
Unable to read file: true
Error: ENOENT: no such file or directory, open 'true'
Unable to read file: true
Error: ENOENT: no such file or directory, open 'true'
  (setq prettier-js-args '(
                           "--print-width" "80"
                           "--single-quote" "true"
                           "--no-semi"
                           "--no-bracket-spacing"
                           ))

Works!

You have an example of this in the README.md. You can set arguments like this:

(setq prettier-js-args '(
  "--trailing-comma" "all"
  "--bracket-spacing" "false"
))

Let me know if it is not clear enough so we can fix the readme πŸ˜ƒ

Oops, looks like I was late! πŸ˜‚

I'm glad that you got it working! πŸ‘

Thanks @rcoedo πŸ‘