Prettier File Watcher for PyCharm (or any other IDEA-based editor)

26 Mar · by Tim Kamanin · 1 min read

Save the following code as an xml and import it as a file watcher into Pycharm:

<TaskOptions>
  <TaskOptions>
    <option name="arguments" value="--write $FilePathRelativeToProjectRoot$" />
    <option name="checkSyntaxErrors" value="true" />
    <option name="description" />
    <option name="exitCodeBehavior" value="ERROR" />
    <option name="fileExtension" value="js" />
    <option name="immediateSync" value="false" />
    <option name="name" value="Prettier" />
    <option name="output" value="$FilePathRelativeToProjectRoot$" />
    <option name="outputFilters">
      <array />
    </option>
    <option name="outputFromStdout" value="false" />
    <option name="program" value="prettier" />
    <option name="runOnExternalChanges" value="true" />
    <option name="scopeName" value="Project Files" />
    <option name="trackOnlyRoot" value="false" />
    <option name="workingDir" value="$ProjectFileDir$" />
    <envs />
  </TaskOptions>
</TaskOptions>

You should now have Prettier formatting your javascript automatically. No more ugly JS!

Comments