Unibeautify
  • Install
  • Docs
  • Assistant
  • Playground
  • GitHub

›Usage

About

  • What is Unibeautify
  • Unibeautify CI
  • Credits

Usage

  • Getting Started
  • Command-Line Interface (CLI)
  • Configuration File
  • Language Options
  • Beautifier Options
  • Supported Languages
  • Editor Integration

Contributing

  • Examples

Integrations

  • GitHub
  • GitLab
  • Bitbucket

Beautifiers

  • Black
  • Brittany
  • ClangFormat
  • CSScomb
  • ESLint
  • Gofmt
  • JS-Beautify
  • PHP-CS-Fixer
  • PHP_CodeSniffer
  • Prettier
  • Pretty Diff
  • sqlformat
  • stylelint
  • TSLint
  • YAPF
Edit

Configuration File

Unibeautify uses cosmiconfig for configuration file support. This means you can configure Unibeautify via:

  • A .unibeautifyrc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json/.js.
  • A unibeautify.config.js file that exports an object.
  • A "unibeautify" key in your package.json file.

The options to the configuration file are grouped by the respective language.

Using the Assistant

Use the Unibeautify assistant for an interactive setup of your configuration file. Simply select the languages you want, and it will walk you though the options available. At the end simply download or copy to your clipboard your configuration.

Example

Both YAML and JSON formats are supported. You can use json2yaml.com to convert from one to the other.

YAML

.unibeautifyrc.yml:

---
PHP: # Language
  beautifiers: # Enable beautifiers
  - PHP-CS-Fixer
  PHP-CS-Fixer: # Beautifier options
    prefer_beautifier_config: true
    PHP-CS-Fixer: # Executable options
      path: "/absolute/path/to/php-cs-fixer"
TypeScript:
  beautifiers: ["Pretty Diff", "Prettier"]
  align_assignments: false
  arrow_parens: "as-needed"
  break_chained_methods: true
  end_with_comma: true
  end_with_semicolon: true
  indent_char: " "
  indent_size: 2
  jsx_brackets: false
  multiline_ternary: true
  object_curly_spacing: true
  quotes: "double"
  space_after_anon_function: false
  wrap_line_length: 80
CSS:
  indent_char: " "
  indent_size: 2
HTML:
  indent_char: " "
  indent_size: 2

JSON

.unibeautifyrc.json:

{
  "PHP": {
    "beautifiers": [
      "PHP-CS-Fixer"
    ],
    "PHP-CS-Fixer": {
      "prefer_beautifier_config": true,
      "PHP-CS-Fixer": {
        "path": "/absolute/path/to/php-cs-fixer"
      }
    }
  },
  "TypeScript": {
    "beautifiers": [
      "Pretty Diff",
      "Prettier"
    ],
    "align_assignments": false,
    "arrow_parens": "as-needed",
    "break_chained_methods": true,
    "end_with_comma": true,
    "end_with_semicolon": true,
    "indent_char": " ",
    "indent_size": 2,
    "jsx_brackets": false,
    "multiline_ternary": true,
    "object_curly_spacing": true,
    "quotes": "double",
    "space_after_anon_function": false,
    "wrap_line_length": 80
  },
  "CSS": {
    "indent_char": " ",
    "indent_size": 2
  },
  "HTML": {
    "indent_char": " ",
    "indent_size": 2
  }
}
← Command-Line Interface (CLI)Language Options →
  • Using the Assistant
  • Example
    • YAML
    • JSON
Unibeautify
Docs
Getting StartedCLIConfigurationOptions
Community
User ShowcaseStack Overflow@Unibeautify on TwitterFollow Unibeautify on Twitter
More
GitHubStar Unibeautify on GitHubCode coverage of UnibeautifyCode coverage of Unibeautify
© 2020 Glavin Wiechert
Credits