A prettier plugin for the Ruby programming language
Switch branches/tags
Nothing to show
Clone or download
kddeisz Merge pull request #15 from kddeisz/dependabot/npm_and_yarn/prettier-…
…1.15.2

Bump prettier from 1.15.1 to 1.15.2
Latest commit 4d361b8 Nov 12, 2018

README.md

prettier-ruby

This is a work in progress plugin for prettier that supports the Ruby programming language. Under the hood it uses Ruby's own ripper library which allows this package to maintain parity with the existing Ruby parser.

Getting started

Install the dependencies by running yarn in the root of the repository. You can then pretty print a ruby source file by running yarn print [PATH].

Options

Below are the options (from src/index.js) that prettier-ruby currently supports:

  • inlineConditionals - When it fits on one line, allow if and unless statements to use the modifier form.
  • inlineLoops - When it fits on one line, allow while and until statements to use the modifier form.
  • preferHashLabels - When possible, use the shortened hash key syntax, as opposed to hash rockets.
  • preferSingleQuotes - When double quotes are not necessary for interpolation, prefer the use of single quotes for string literals.

Known limitations

Currently, prettier-ruby drops a lot of comments.