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
end
won't be transformed to
File.directory? entry ? Dir[File.join(entry, '**', "*.rb")] : entry
e.g.
if result
'foo'
else
'bar'
end
won't be transformed to
result ? 'foo' : 'bar'
e.g.
while true
break :value
end
won't be transformed to
break :value while true
e.g.
included do
has_many :build_items, dependent: :destroy
end
won'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)