Socket
Socket
Sign inDemoInstall

@prettier/plugin-ruby

Package Overview
Dependencies
Maintainers
13
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prettier/plugin-ruby - npm Package Versions

1
8

0.21.0

Diff

Changelog

Source

[0.21.0] - 2020-12-02

Changed

  • kddnewton, ryan-hunter-pc - Explicitly handle break and next keyword parentheses.
  • jbielick, kddnewton - Don't convert between 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.
  • kddnewton - Turn off the Symbol#to_proc transform by default.
  • janklimo, kddnewton - Properly handle trailing commas on hash arguments.
  • coiti, kddnewton - Properly handle parentheses when necessary on if/unless statements and while/until loops.
  • Rsullivan00 - Prevent command and command_call nodes from being turned into ternaries.
  • kddnewton - Better handling of the alias node with and without comments.
  • kddnewton - Better handling of the BEGIN and END nodes with and without comments.
  • kddnewton - Much better handling of heredocs where now there is a consistent heredoc node instead of multiple.
kddeisz
published 0.20.1 •

Changelog

Source

[0.20.1] - 2020-09-04

Changed

  • ftes, kddnewton - Properly escape HAML plain text statements that start with special HAML characters.

Removed

  • kddnewton - I'm stripping out the HAML plugin and putting it into its own package (@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.
kddeisz
published 0.20.0 •

Changelog

Source

[0.20.0] - 2020-08-28

Added

  • kddnewton - Allow embedded formatting on heredocs by the name placed at the start. For example,
<!-- prettier-ignore -->
javascript = <<~JAVASCRIPT
  const a=1;
  const b=2;
  return a+b;
JAVASCRIPT

Changed

  • mmainz - Fix the encoding setting such that we're not overwriting the entire set of environment variables.
kddeisz
published 0.19.1 •

Changelog

Source

[0.19.1] - 2020-08-21

Changed

  • Rsullivan00 - Do not tranform word-literal arrays when there is an escape sequence.
  • steobrien, kddnewton - Do not indent heredocs with calls more than they should be.
  • jpickwell - Include .simplecov in filenames
  • github0013, kddnewton - Ensure we're parsing ruby files using UTF-8 regardless of the system encoding.
kddeisz
published 0.19.0 •

Changelog

Source

[0.19.0] - 2020-07-03

Added

  • ryan-hunter-pc - Add the option to disable the Symbol#to_proc transform.
  • ryan-hunter-pc], [@SViccari, kddnewton - Disable Symbol#to_proc transform when used as a key inside of a hash where the key is either :if or :unless.
kddeisz
published 0.18.2 •

Changelog

Source

[0.18.2] - 2020-05-01

Changed

  • alse - Support vscodeLanguageIds for HAML.
  • ShayDavidson, kddnewton - Don't allow replacing if/else with ternary if there's an assignment in the predicate.
  • janklimo - Do not add an empty line after rescue when the block is empty.
kddeisz
published 0.18.1 •

Changelog

Source

[0.18.1] - 2020-04-05

Changed

  • petevk, kddnewton - Use braces for block format iff it was originally a brace block, otherwise you could be changing precedence. For example:
<!-- prettier-ignore -->
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.

  • flyerhzm - Rewrite operators binary parser, as in:
<!-- prettier-ignore -->
[
  '1111111111111111111111111111111111111111111111111111111111111111111111111',
  222
] +
  [1]
  • ftes, kddnewton - When old-form dynamic attributes are added to a div tag in HAML, it was previously skipping printing the %div, which led to it being incorrectly displayed.
  • ftes, kddnewton - Previously if you had a long tag declaration with attributes that made it hit the line limit, then the content of the tag would be pushed to the next line but indented one character too many.
  • ftes, kddnewton - Don't explicitly require JSON if it has already been loaded, as this can lead to rubygems activation errors.
  • mmainz, kddnewton - Handle heredocs as the receivers of call nodes, as in:
<!-- prettier-ignore -->
foo = <<~TEXT.strip
  bar
TEXT
  • github0013, kddnewton - Leave parentheses in place if the value of a return node contains a binary with low operator precedence, as in:
<!-- prettier-ignore -->
return (a or b) if c?
kddeisz
published 0.18.0 •

Changelog

Source

[0.18.0] - 2020-03-17

Added

  • kddnewton - Support for the nokw_param node for specifying when methods should no accept keywords, as in:
def foo(**nil)
end
  • kddnewton - Support for the args_forward node for forwarding all types of arguments, as in:
def foo(...)
  bar(...)
end

Changed

  • ftes, kddnewton - Handled 3 or more classes on a node in HAML, as in:
%table.table.is-striped.is-hoverable
  • ftes, kddnewton - Better handling of indentation of if/elsif/else, unless/elsif/else, and case/when branches, as in:
.column.is-12
  - if true
    TRUE
  - else
    FALSE
  • tobyndockerill - Format numbers with underscores after 4 digits, as opposed to 3.
  • ianks - Improve performance by using --disable-gems.
  • flyerhzm - Calls are grouped such that after an end parenthesis the following call will not be indented, as in:
<!-- prettier-ignore -->
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
  • pje, kddnewton - Method definition bodies (on defs nodes) should dedent if a helper method is called. As in:
<!-- prettier-ignore -->
private def self.foo
          'bar'
        end

should instead be indented as:

<!-- prettier-ignore -->
private def self.foo
  'bar'
end
  • masqita, kddnewton - Inline variable assignment within a predicate should force the conditional to break, as in:
array.each do |element|
  if index = difference.index(element)
    difference.delete_at(index)
  end
end
  • hafley66, kddnewton - Handle empty while and until blocks.
  • Fruetel, kddnewton - Simplify string escape pattern by locking on any escape sequence.
  • flyerhzm, kddnewton - Properly handle string quotes on symbols in hash keys.
kddeisz
published 0.17.0 •

Changelog

Source

[0.17.0] - 2019-12-12

Added

  • matt-wratt - Better support for explicit return nodes with empty arrays or arrays with a single element.
  • jrdioko, kddnewton - Alignment of not_to is explicitly allowed to not indent to better support rspec.

Changed

  • gin0606 - The max buffer being passed into the Ruby process is now up to 10MB.
kddeisz
published 0.16.0 •

Changelog

Source

[0.16.0] - 2019-11-14

Added

  • mmainz, kddnewton - Support for extra commas in multiple assignment, as it changes the meaning. For example,
<!-- prettier-ignore -->
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.

  • kddnewton - Experimental support for the HAMtemplate language.

Changed

  • github0013, kddnewton - Support proper string escaping when the original string in the source is wrapped in %q|...|. For example, %q|\'| should get printed as "\'", where previously it was dropping the backslash.
  • jamescostian, kddnewton - Force ternary breaking when using the lower-precendence operators and and or. For example,
<!-- prettier-ignore -->
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.

  • localhostdotdev], [@joeyjoejoejr], [@eins78, kddnewton - Better support for embedded expressions inside heredocs. For example,
<!-- prettier-ignore -->
<<-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 #{.

  • jamescostian, kddnewton - Fix up return node printing. When returning multiple values, you need to return an array literal as opposed to using parentheses.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc