Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

xinminlabs/plugin-ruby

This branch is 17 commits ahead of, 1090 commits behind prettier/plugin-ruby:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

51e3766 · Feb 18, 2021
Feb 2, 2021
Jan 28, 2021
Mar 1, 2019
Mar 4, 2019
Jan 1, 2021
Feb 18, 2021
Feb 18, 2021
Mar 3, 2019
Jan 5, 2021
Jan 5, 2021
Jan 5, 2021
Feb 3, 2021
Apr 24, 2019
Jan 2, 2021
Jan 5, 2021
Apr 28, 2020
Feb 18, 2021
Apr 14, 2019
Feb 10, 2021
Dec 12, 2020
Jan 3, 2021
Feb 9, 2021

Repository files navigation

awesomecode-plugin-ruby

This is a fork of prettier plugin-ruby, which is used in Awesome Code

How to use

npm install prettier awesomecode-plugin-ruby
npx prettier *.rb

What changed comparing to the official plugin ruby?

It removes the following configurations

  • rubyArrayLiteral
  • rubyHashLabel
  • rubyModifier
  • rubyToProc

It contains the following changes

do not add line break for array index

longarrayname[index]

won't be transformed to

longarrayname[index]

do not transform regexp

/abc/

won't be transformed to

%r{abc}

do not transform to proc

array.each { |element| element.to_s }

won't be transformed to

array.each(&:to_s)

do not transform array literal

['foo']
[:bar]

won't be transformed to

%w[foo]
%i[bar]

do not transform conditions

e.g.

if result
  'foo'
else
  'bar'
end

won't be transformed to

result ? 'foo' : 'bar'

do not transform loops

e.g.

while true
  break :value
end

won't be transformed to

break :value while true

do not transform blocks

e.g.

included do
  has_many :build_items, dependent: :destroy
end

won't be transformed to

included { has_many :build_items, dependent: :destroy }

About

Prettier Ruby Plugin used in awesomecode.io

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 69.4%
  • Ruby 30.6%