@prettier/plugin-ruby
Advanced tools
Changelog
[0.21.0] - 2020-12-02
break
and next
keyword parentheses.lambda {}
and -> {}
. Technically it's breaking the semantics of the program. Also because lambda method call arguments can't handle everything that stabby lambda can.Symbol#to_proc
transform by default.command
and command_call
nodes from being turned into ternaries.alias
node with and without comments.BEGIN
and END
nodes with and without comments.heredoc
node instead of multiple.Changelog
[0.20.1] - 2020-09-04
@prettier/plugin-haml
). It's become too difficult to maintain within this repo, and it's confusing for contributors because there are some things that work with Ruby and some things that don't. This is going to simplify maintenance. This should probably be a major version bump but since we're still pre 1.0
I'm going to leave it as a patch.Changelog
[0.20.0] - 2020-08-28
javascript = <<~JAVASCRIPT
const a=1;
const b=2;
return a+b;
JAVASCRIPT
Changelog
[0.19.1] - 2020-08-21
Changelog
[0.19.0] - 2020-07-03
Symbol#to_proc
transform.Symbol#to_proc
transform when used as a key inside of a hash where the key is either :if
or :unless
.Changelog
[0.18.2] - 2020-05-01
vscodeLanguageIds
for HAML.rescue
when the block is empty.Changelog
[0.18.1] - 2020-04-05
expect do
field 1 do
"foo"
end
end.to raise_error
should maintain its do...end
and not switch to inline braces otherwise the brace might get associated with the 1
.
[
'1111111111111111111111111111111111111111111111111111111111111111111111111',
222
] +
[1]
div
tag in HAML, it was previously skipping printing the %div
, which led to it being incorrectly displayed.foo = <<~TEXT.strip
bar
TEXT
return (a or b) if c?
Changelog
[0.18.0] - 2020-03-17
nokw_param
node for specifying when methods should no accept keywords, as in:def foo(**nil)
end
args_forward
node for forwarding all types of arguments, as in:def foo(...)
bar(...)
end
%table.table.is-striped.is-hoverable
if/elsif/else
, unless/elsif/else
, and case/when
branches, as in:.column.is-12
- if true
TRUE
- else
FALSE
--disable-gems
.Config::Download.new(
'prettier',
filename: 'prettier.yml', url: 'https://raw.githubusercontent.com/...'
)
.perform
will now be printed as:
Config::Download.new(
"prettier",
filename: "prettier.yml",
url: "https://raw.githubusercontent.com/..."
).perform
defs
nodes) should dedent if a helper method is called. As in:private def self.foo
'bar'
end
should instead be indented as:
<!-- prettier-ignore -->private def self.foo
'bar'
end
array.each do |element|
if index = difference.index(element)
difference.delete_at(index)
end
end
while
and until
blocks.Changelog
[0.17.0] - 2019-12-12
return
nodes with empty arrays or arrays with a single element.not_to
is explicitly allowed to not indent to better support rspec.Changelog
[0.16.0] - 2019-11-14
a, = [1, 2, 3]
would previously get printed as a = [1, 2, 3]
, which changes the value of a
from 1
to the value of the entire array.
%q|...|
. For example, %q|\'|
should get printed as "\'"
, where previously it was dropping the backslash.and
and or
. For example,if x.nil?
puts 'nil' and return
else
x
end
the previous expression was being transformed into a ternary which was invalid ruby. Instead it now stays broken out into an if/else block.
<<-HERE
foo bar baz
#{qux}
foo bar baz
HERE
should remain formatted as it is. Whereas previously due to the way the lines were split, you would sometimes end up with it breaking after #{
.
return
node printing. When returning multiple values, you need to return an array literal as opposed to using parentheses.