bcomnes / sublime-standard-format

:sparkles: Runs standard --fix against the javascript in your ST3 window on save or manually.
https://packagecontrol.io/packages/StandardFormat
MIT License
60 stars 21 forks source link

Standard Format

tests

A Sublime Text 3 plug-in that runs standard --fix against the javascript code in your ST3 window on save or manually. Can be toggled on or off. Includes a few settings that let you tweak your search path to favor local dependencies over global ones.

Supports any tool that accepts a stdin and stdout formatting API. The following tools are used by default:

standard --fix
semistandard --fix

action gif

Installation

Install Standard Format using Package Control.

# In the command palate
- package control install
- standard format

Standard Format (the Sublime Text Plug-in) requires that you install standard either locally to your project or globally. It is recomended to save it to your local project.

$ npm install standard@latest --save-dev

Configuration

You can find Standard Format settings in the StandardFormat.sublime-settings file.

Standard Format is agressive about finding your developer dependencies. The search path that it uses by default are in the following order:

Other settings:

Default:

{
  "commands": [
    ["standard", "--stdin", "--fix"],
    ["semistandard", "--stdin", "--fix" ]
    ["ts-standard", "--stdin", "--fix", "--stdin-filename", "{FILENAME}" ]
  ]
}

Project local settings

If the default/user settings isn't fined grained enough, you can set project specific settings in .sublime-project project specific settings. See sublime project docs for more details.

{
  "settings": {
    "standard_format": {
      "format_on_save": true,
      "commands": [
        ["eslint_d", "--stdin", "--fix-to-stdout"]
      ]
    }
  }
}

Hints

Windows is now supported. Please open any issues that you come across.

Linter

Standard Format pairs nicely with the Sublime Text standard linter:

References