prettier 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,15 +12,11 @@ const isCall = (node) => ["::", "."].includes(node) || node.type === "@period";
12
12
  //
13
13
  // This works with `do` blocks as well.
14
14
  const toProc = (path, node) => {
15
- if (!node) {
16
- return null;
17
- }
18
-
19
15
  const [variables, blockContents] = node.body;
20
16
 
21
17
  // Ensure that there are variables being passed to this block.
22
18
  const params = variables && variables.body[0];
23
- if (!params || params.type !== "params") {
19
+ if (!params) {
24
20
  return null;
25
21
  }
26
22
 
@@ -39,7 +35,7 @@ const toProc = (path, node) => {
39
35
  if (blockContents.type === "bodystmt") {
40
36
  // We’re in a `do` block
41
37
  const blockStatements = blockContents.body[0];
42
- const rescueElseEnsure = blockStatements.body.slice(1);
38
+ const rescueElseEnsure = blockContents.body.slice(1);
43
39
 
44
40
  // You can’t use the to_proc shortcut if you’re rescuing
45
41
  if (rescueElseEnsure.some(Boolean)) {
@@ -84,7 +80,7 @@ const toProc = (path, node) => {
84
80
 
85
81
  if (path.getValue().type === "method_add_block") {
86
82
  assocNode = path.getParentNode();
87
- } else if (path.getValue().type === "args") {
83
+ } else {
88
84
  assocNode = path.getParentNode(2);
89
85
  }
90
86
 
@@ -97,7 +93,7 @@ const toProc = (path, node) => {
97
93
 
98
94
  if (
99
95
  key.type === "symbol_literal" &&
100
- ["if", "unless"].includes(key.body[0].body[0].body)
96
+ ["if", "unless"].includes(key.body[0].body)
101
97
  ) {
102
98
  return null;
103
99
  }
@@ -1,6 +1,9 @@
1
1
  function makeCall(path, opts, print) {
2
2
  const operation = path.getValue().body[1];
3
3
 
4
+ // Ignoring the next block for coverage information because it's only relevant
5
+ // in Ruby 2.5 and below.
6
+ /* istanbul ignore next */
4
7
  if ([".", "&."].includes(operation)) {
5
8
  return operation;
6
9
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prettier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Deisz
@@ -30,6 +30,7 @@ files:
30
30
  - node_modules/prettier/index.js
31
31
  - node_modules/prettier/third-party.js
32
32
  - package.json
33
+ - rubocop.yml
33
34
  - src/plugin.js
34
35
  - src/prettier.js
35
36
  - src/ruby/embed.js