prettier 1.5.1 → 1.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d669fc2ab950c7a9163d2b9f63620ec0300536a72985fbe9378054cc988490d
4
- data.tar.gz: 9a99a3897282616faa104f47094afcf0b2b1f0a748a3376ddecb1aa55bc5f7f9
3
+ metadata.gz: 97cf5963c684d5bf17079800c59b79fb15f787c89c1b1d7bd315c3851307737f
4
+ data.tar.gz: 721e04eaa93f654d873e2b972b718b3d1db41d7acca278b8eec743aa92daf755
5
5
  SHA512:
6
- metadata.gz: 060eb9299ef84812b305c145c87e8fe59c440028df12e16e29509caa23abb0acde2aec7e43951a43f4fd6ad2b2a6cff8d45af5b358350ac75920582e87982f58
7
- data.tar.gz: bd1ffb84df6cc449db31bdca82f15cd3a15cb7842718e2ae1b79eb8849ac26f6d8f6d1164d9322e0b91dcdbc0a32aef2722686417f7285007424e771d8fc2ab7
6
+ metadata.gz: fe8997d3c57f9ed1d6cc23d198555c51d234dd856d0e3803879fb4a92809204fcb5d8b70e0a02421e902d9fd4d33e34e02e7e6ccd778caef203ce3aa7b6c6037
7
+ data.tar.gz: 91656de653ca7b90469dfbc3e6363259d3e9977693e649846d0bc4fd39e0585798f985334b1895790efbb9613f39ba35dce3193aecb59844d0f419d0da2c5bf0
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.5.2] - 2021-02-03
10
+
11
+ ### Changed
12
+
13
+ - kddeisz - Fix up `binary` node comparison operators so that it will handle either Symbol literals or the `@op` nodes which are incorrectly coming from JRuby (https://github.com/jruby/jruby/issues/6548).
14
+
9
15
  ## [1.5.1] - 2021-01-27
10
16
 
11
17
  ### Changed
@@ -199,7 +205,7 @@ end
199
205
  - kddeisz - Fix up a bug with constant aliases, e.g., `alias in IN`.
200
206
  - andyw8, kddeisz - Ensure `rescue` comments stay on the same line as their declaration.
201
207
 
202
- # [0.22.0] - 2020-12-08
208
+ ## [0.22.0] - 2020-12-08
203
209
 
204
210
  ### Changed
205
211
 
@@ -1071,7 +1077,8 @@ would previously result in `array[]`, but now prints properly.
1071
1077
 
1072
1078
  - Initial release 🎉
1073
1079
 
1074
- [unreleased]: https://github.com/prettier/plugin-ruby/compare/v1.5.1...HEAD
1080
+ [unreleased]: https://github.com/prettier/plugin-ruby/compare/v1.5.2...HEAD
1081
+ [1.5.2]: https://github.com/prettier/plugin-ruby/compare/v1.5.1...v1.5.2
1075
1082
  [1.5.1]: https://github.com/prettier/plugin-ruby/compare/v1.5.0...v1.5.1
1076
1083
  [1.5.0]: https://github.com/prettier/plugin-ruby/compare/v1.4.0...v1.5.0
1077
1084
  [1.4.0]: https://github.com/prettier/plugin-ruby/compare/v1.3.0...v1.4.0
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prettier/plugin-ruby",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "prettier plugin for the Ruby programming language",
5
5
  "main": "src/plugin.js",
6
6
  "scripts": {
data/src/parser/server.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/setup' if ENV['CI']
3
+ require 'bundler/setup' if ENV['PLUGIN_RUBY_CI']
4
4
  require 'socket'
5
5
  require 'json'
6
6
 
@@ -14,7 +14,7 @@ $PROGRAM_NAME = 'prettier-ruby-parser'
14
14
  # Make sure we trap these signals to be sure we get the quit command coming from
15
15
  # the parent node process
16
16
  quit = false
17
- trap(:QUIT) { quit = true }
17
+ trap(:QUIT) { quit = true } if RUBY_PLATFORM != 'java'
18
18
  trap(:INT) { quit = true }
19
19
  trap(:TERM) { quit = true }
20
20
 
data/src/ruby/embed.js CHANGED
@@ -8,7 +8,7 @@ const {
8
8
  stripTrailingHardline
9
9
  } = require("../prettier");
10
10
 
11
- const { literalLineNoBreak } = require("../utils");
11
+ const { literallineWithoutBreakParent } = require("../utils");
12
12
 
13
13
  const parsers = {
14
14
  css: "css",
@@ -30,7 +30,7 @@ function replaceNewlines(doc) {
30
30
  ? concat(
31
31
  currentDoc
32
32
  .split(/(\n)/g)
33
- .map((v, i) => (i % 2 === 0 ? v : literalLineNoBreak))
33
+ .map((v, i) => (i % 2 === 0 ? v : literallineWithoutBreakParent))
34
34
  )
35
35
  : currentDoc
36
36
  );
@@ -106,7 +106,7 @@ function embed(path, print, textToDoc, _opts) {
106
106
 
107
107
  // Pass that content into the embedded parser. Get back the doc node.
108
108
  const formatted = concat([
109
- literalLineNoBreak,
109
+ literallineWithoutBreakParent,
110
110
  replaceNewlines(stripTrailingHardline(textToDoc(content, { parser })))
111
111
  ]);
112
112
 
@@ -119,7 +119,7 @@ function embed(path, print, textToDoc, _opts) {
119
119
  group(
120
120
  concat([
121
121
  indent(markAsRoot(formatted)),
122
- literalLineNoBreak,
122
+ literallineWithoutBreakParent,
123
123
  ending.trim()
124
124
  ])
125
125
  )
@@ -132,7 +132,9 @@ function embed(path, print, textToDoc, _opts) {
132
132
  return markAsRoot(
133
133
  concat([
134
134
  path.call(print, "beging"),
135
- lineSuffix(group(concat([formatted, literalLineNoBreak, ending.trim()])))
135
+ lineSuffix(
136
+ group(concat([formatted, literallineWithoutBreakParent, ending.trim()]))
137
+ )
136
138
  ])
137
139
  );
138
140
  }
@@ -1,5 +1,5 @@
1
1
  const { concat, group, lineSuffix, join } = require("../../prettier");
2
- const { literalLineNoBreak } = require("../../utils");
2
+ const { literallineWithoutBreakParent } = require("../../utils");
3
3
 
4
4
  function printHeredoc(path, opts, print) {
5
5
  const { body, ending } = path.getValue();
@@ -11,7 +11,7 @@ function printHeredoc(path, opts, print) {
11
11
  }
12
12
 
13
13
  // In this case, the part of the string is just regular string content
14
- return join(literalLineNoBreak, part.body.split("\n"));
14
+ return join(literallineWithoutBreakParent, part.body.split("\n"));
15
15
  });
16
16
 
17
17
  // We use a literalline break because matching indentation is required
@@ -23,7 +23,9 @@ function printHeredoc(path, opts, print) {
23
23
  concat([
24
24
  path.call(print, "beging"),
25
25
  lineSuffix(
26
- group(concat([literalLineNoBreak].concat(parts).concat(ending)))
26
+ group(
27
+ concat([literallineWithoutBreakParent].concat(parts).concat(ending))
28
+ )
27
29
  )
28
30
  ])
29
31
  );
data/src/ruby/parser.rb CHANGED
@@ -565,6 +565,12 @@ class Prettier::Parser < Ripper
565
565
  # binary is a parser event that represents a binary operation between two
566
566
  # values.
567
567
  def on_binary(left, oper, right)
568
+ # On most Ruby implementations, oper is a Symbol that represents that
569
+ # operation being performed. For instance in the example `1 < 2`, the `oper`
570
+ # object would be `:<`. However, on JRuby, it's an `@op` node, so here we're
571
+ # going to explicitly convert it into the same normalized form.
572
+ oper = scanner_events.delete(oper)[:body] unless oper.is_a?(Symbol)
573
+
568
574
  {
569
575
  type: :binary,
570
576
  body: [left, oper, right],
data/src/utils.js CHANGED
@@ -5,7 +5,7 @@ module.exports = {
5
5
  isEmptyStmts: require("./utils/isEmptyStmts"),
6
6
  hasAncestor: require("./utils/hasAncestor"),
7
7
  literal: require("./utils/literal"),
8
- literalLineNoBreak: require("./utils/literalLineNoBreak"),
8
+ literallineWithoutBreakParent: require("./utils/literallineWithoutBreakParent"),
9
9
  makeCall: require("./utils/makeCall"),
10
10
  noIndent: require("./utils/noIndent"),
11
11
  printEmptyCollection: require("./utils/printEmptyCollection"),
@@ -0,0 +1,7 @@
1
+ const literallineWithoutBreakParent = {
2
+ type: "line",
3
+ hard: true,
4
+ literal: true
5
+ };
6
+
7
+ module.exports = literallineWithoutBreakParent;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prettier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Deisz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -100,7 +100,7 @@ files:
100
100
  - src/utils/isEmptyBodyStmt.js
101
101
  - src/utils/isEmptyStmts.js
102
102
  - src/utils/literal.js
103
- - src/utils/literalLineNoBreak.js
103
+ - src/utils/literallineWithoutBreakParent.js
104
104
  - src/utils/makeCall.js
105
105
  - src/utils/noIndent.js
106
106
  - src/utils/printEmptyCollection.js
@@ -1,7 +0,0 @@
1
- const literalLineNoBreak = {
2
- type: "line",
3
- hard: true,
4
- literal: true
5
- };
6
-
7
- module.exports = literalLineNoBreak;