This is a fork of prettier plugin-ruby, which is used in Awesome Code
npm install prettier awesomecode-plugin-ruby
npx prettier *.rb
It contains the following changes
e.g.
hello.foo.bar.hello.foo.bar.hello.foo.bar.hello.foo.bar.hello.foo.bar.hello['test']won't be transformed to
hello.foo.bar.hello.foo.bar.hello.foo.bar.hello.foo.bar.hello.foo.bar.hello[
'test'
]e.g.
if File.directory? entry
Dir[File.join(entry, '**', "*.rb")]
else
entry
endwon't be transformed to
File.directory? entry ? Dir[File.join(entry, '**', "*.rb")] : entrye.g.
if result
'foo'
else
'bar'
endwon't be transformed to
result ? 'foo' : 'bar'e.g.
while true
break :value
endwon't be transformed to
break :value while truee.g.
included do
has_many :build_items, dependent: :destroy
endwon't be transformed to
included { has_many :build_items, dependent: :destroy }"node ./node_modules/prettier/bin-prettier.js --plugin ./node_modules/awesomecode-plugin-ruby --config #{FormatTool::DOCKER_FORMATRC_YAML} --ignore-path #{FormatTool::DOCKER_FORMAT_IGNORE} --write #{FormatTool::DOCKER_INPUT_PATH}/**/*.{rb,rake}"won't be transformed to
"node ./node_modules/prettier/bin-prettier.js --plugin
./node_modules/awesomecode-plugin-ruby --config #{
FormatTool::DOCKER_FORMATRC_YAML
} --ignore-path #{FormatTool::DOCKER_FORMAT_IGNORE} --write #{
FormatTool::DOCKER_INPUT_PATH
}/**/*.{rb,rake}"['foo']
[:bar]won't be transformed to
%w[foo]
%i[bar]/abc/won't be transformed to
%r{abc}array.each { |element| element.to_s }won't be transformed to
array.each(&:to_s)thereisamethodcall(arg1, arg2).thereisanothermethodcall(arg1, arg2).asimpleone(arg)won't be transformed to
thereisamethodcall(arg1, arg2).thereisanothermethodcall(arg1, arg2).asimpleone(
arg
)json.(:id, :name)won't be transformed to
json.call(:id, :name)