javascriptreactjsecmascript-6prettier

How to remove semicolons in prettier?


I am using the VS Code prettier plugin to format my code, how can I add a setting to not add or remove semicolons when I format my code? I know that this feature was added in January but I found no mention in the PR or issue of how to add it to settings.


Solution

  • From the README:

    prettier.semi (default: true)

    Whether to add a semicolon at the end of every line (semi: true), or only at the beginning of lines that may introduce ASI failures (semi: false)

    You have to set prettier.semi to false.

    To change Prettier's settings in VS Code, search for >open settings:

    a screenshot showing a search for "open settings"

    You can also add the following to your .prettierrc file:

    {
      ...
      "semi": false
    }