Awesome Open Source
Awesome Open Source

Please Check the official repo here prettier-plugin-ruby

This repo is deprecated

Prettier Ruby Plugin

All Contributors

🚧 Work in Progress! 🚧


Please note that this plugin is under active development, and might not be ready to run on production code yet.

How it works

Prettier-Ruby relies on Ripper, the official parser of Ruby to understand your code. Once your code has been read and parsed, it is then reformatted using the formatting commands provided by Prettier.


If you're interested in contributing to the development of Prettier for Ruby:

  • Clone this repository
  • Run yarn to install dependencies
  • Ensure all tests run with yarn run test

You will find it useful to read the CONTRIBUTING guide from Prettier, as it all applies to this repository too.


Prettier-Ruby makes use of Ruby's official lexer and parser, Ripper. You can see the output of Ripper's tokens, sexpressions, the intermediate representation that prettier-ruby uses, as well as the final prettier-ruby result by appending DEBUG=true when running tests:

DEBUG=true yarn run test --watch

You should now see some useful debug output in your console:

Debug mode enabled, showing the parsed Ruby tokens and more

You can run the Ruby AST Exporter directly with a given string too:

$ ruby vendor/ruby/astexport.rb "puts 'hello world'"

To run an individual test folder:

DEBUG=true yarn run test tests/defs --watch


Until this package is officially released to npm you must clone it yourself, and run it directly:

  • Clone this repository
  • Run yarn to install dependencies
  • Run yarn prettier test.rb to check the output of a single file
  • Run on multiple files with yarn prettier your_folder/**/*.rb
  • Save the result with yarn prettier your_folder/**/*.rb --write


Thanks goes to these wonderful people (emoji key):

Alan Foster

📖 🐛 💻 🤔

Amit Solanki

📖 🐛 💻 🤔 💡 👀 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (71,009) 
ruby (12,918) 
prettier (107)