I have tried adding in a custom formatter for Javascript, using Prettier (http://prettier.io)
I installed prettier globally via npm
npm install -g prettier
In the preferences I added a new custom formatter for .jsx files.
Name: Prettier
Language: JSX
Formatter: Other / Generic Command Line Formatter
Executable To Use: C:\path\to\npm\node_modules\prettier\bin-prettier.js (Also tried standalone.js and index.js)
Command Line Arguments: write
When I try to format code I get a windows script host error dialog box pointing to line 169 char 2 of prettier index.js. Expected identifier, string or number.
I get the particular error is not anything to do with Komodo but Iâm wondering if all my config is correct and if anyone else has had success setting up a custom formatter for Prettier?
@stereofx, Komodo can only run a binary in this context. I believe the binaries live in .../node_modules/.bin. Point to the Prettier binary that should be there.
@careyh thanks for the suggestion. Looks like Prettierâs binary just executes the JS index file, so same error - just thought I would let you know. I could add this to the feature ideas section.
Could you try the command in the terminal and see what happens? The fact that youâre getting a Windows error tells me there is something wrong with the way youâre using the formatter.
Given the fields you filled in for the custom formatter it would be something like:
By terminal, I assume you are referring to the windows terminal (not Komodo terminal).
bin-prettier.cmd errors because the file in the node_modules bin directory is just a symlink to Prettierâs index js file, not an actual cmd file - I guess that could be a problem.
You should be able to see the commands I entered in the screenshot, none of them worked and I keep getting the windows error, but slightly different now.
So they are putting a non-binary/terminal ready file into the bin folder? I canât help there then. You need a file that is executable by your terminal. If you can figure out how to install the prettier formatter that way then youâll be set.