prettier 3.1.2 → 3.2.0
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/prettier/rake/task.rb +1 -1
- data/lib/prettier.rb +2 -1
- data/package.json +1 -1
- data/rubocop.yml +7 -7
- data/src/parseSync.js +1 -1
- data/src/server.rb +23 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a60ee62443799f6fdd3380700b4091b75e1f50658e01cad2cdf1ade440917f4
|
4
|
+
data.tar.gz: 4c95bb8ae2916d965e12cc376aa2c8df0ce985420e78edc45554c6412a4e3469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f449363349b3476457419d8374dd1127ac8bcfb7faf2afa1f20eb49b21968c2cd5301ad26731bde90e8de64f5604534f375ffcf7ef60bdb21b0fb3f95c160439
|
7
|
+
data.tar.gz: 27fde34295c91d167f693d5ab4c8e67c639d9302854a7ef2423552b978a9611615b94fa07b3dae6d20c611fc7bc9764820570555a88faf61450235c467ee757e
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.2.0] - 2022-07-22
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- [#1250](https://github.com/prettier/plugin-ruby/issues/1250) - alexf101, kddnewton - Respect the `tabWidth` option.
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- [#1255](https://github.com/prettier/plugin-ruby/pull/1255) - soberstadt - The rake task now runs check if write is false.
|
18
|
+
- [#1237](https://github.com/prettier/plugin-ruby/issues/1237) - boris-petrov - Disable the style rules associated with quotes.
|
19
|
+
- [#1248](https://github.com/prettier/plugin-ruby/pull/1248) - mhssmnn - Fix process waiting on STDIN.
|
20
|
+
|
9
21
|
## [3.1.2] - 2022-05-13
|
10
22
|
|
11
23
|
### Changed
|
data/lib/prettier/rake/task.rb
CHANGED
data/lib/prettier.rb
CHANGED
@@ -11,9 +11,10 @@ module Prettier
|
|
11
11
|
def self.run(args)
|
12
12
|
quoted = args.map { |arg| arg.start_with?("-") ? arg : "\"#{arg}\"" }
|
13
13
|
command = "node #{BINARY} --plugin \"#{PLUGIN}\" #{quoted.join(" ")}"
|
14
|
+
opts = STDIN.tty? ? {} : { stdin_data: STDIN }
|
14
15
|
|
15
16
|
stdout, stderr, status =
|
16
|
-
Open3.capture3({ "RBPRETTIER" => "1" }, command,
|
17
|
+
Open3.capture3({ "RBPRETTIER" => "1" }, command, opts)
|
17
18
|
STDOUT.puts(stdout)
|
18
19
|
|
19
20
|
# If we completed successfully, then just exit out.
|
data/package.json
CHANGED
data/rubocop.yml
CHANGED
@@ -32,16 +32,16 @@ Style/Lambda:
|
|
32
32
|
Style/MultilineBlockChain:
|
33
33
|
Enabled: false
|
34
34
|
|
35
|
-
#
|
36
|
-
#
|
35
|
+
# Disable the single- vs double-quotes rules as these depend on whether the user
|
36
|
+
# has added or not `plugin/single_quotes` for `syntax_tree`
|
37
37
|
Style/StringLiterals:
|
38
|
-
|
38
|
+
Enabled: false
|
39
39
|
|
40
40
|
Style/StringLiteralsInInterpolation:
|
41
|
-
|
41
|
+
Enabled: false
|
42
42
|
|
43
43
|
Style/QuotedSymbols:
|
44
|
-
|
44
|
+
Enabled: false
|
45
45
|
|
46
46
|
# We let users have a little more freedom with symbol and words arrays. If the
|
47
47
|
# user only has an individual item like ["value"] then we don't bother
|
@@ -52,8 +52,8 @@ Style/SymbolArray:
|
|
52
52
|
Style/WordArray:
|
53
53
|
Enabled: false
|
54
54
|
|
55
|
-
#
|
56
|
-
#
|
55
|
+
# Disable the trailing-comma rules as these depend on whether the user has added
|
56
|
+
# or not `plugin/trailing_comma` for `syntax_tree`
|
57
57
|
Style/TrailingCommaInArguments:
|
58
58
|
Enabled: false
|
59
59
|
|
data/src/parseSync.js
CHANGED
@@ -181,7 +181,7 @@ function parseSync(parser, source, opts) {
|
|
181
181
|
}
|
182
182
|
|
183
183
|
const response = spawnSync(parserArgs.cmd, parserArgs.args, {
|
184
|
-
input: `${parser}|${opts.printWidth}|${source}`,
|
184
|
+
input: `${parser}|${opts.printWidth}|${opts.tabWidth}|${source}`,
|
185
185
|
maxBuffer: 15 * 1024 * 1024
|
186
186
|
});
|
187
187
|
|
data/src/server.rb
CHANGED
@@ -74,8 +74,8 @@ listener =
|
|
74
74
|
|
75
75
|
# Start up a new thread that will handle each successive connection.
|
76
76
|
Thread.new(server.accept_nonblock) do |socket|
|
77
|
-
parser,
|
78
|
-
socket.read.force_encoding("UTF-8").split("|",
|
77
|
+
parser, maxwidth_string, tabwidth_string, source =
|
78
|
+
socket.read.force_encoding("UTF-8").split("|", 4)
|
79
79
|
|
80
80
|
source.each_line do |line|
|
81
81
|
case line
|
@@ -92,25 +92,40 @@ listener =
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
|
95
|
+
# At the moment, we're not going to support odd tabwidths. It's going to
|
96
|
+
# have to be a multiple of 2, because of the way that the prettyprint
|
97
|
+
# gem functions. So we're going to just use integer division here.
|
98
|
+
scalar = tabwidth_string.to_i / 2
|
99
|
+
genspace = ->(n) { " " * n * scalar }
|
100
|
+
|
101
|
+
maxwidth = maxwidth_string.to_i
|
96
102
|
response =
|
97
103
|
case parser
|
98
104
|
when "ping"
|
99
105
|
"pong"
|
100
106
|
when "ruby"
|
101
|
-
formatter =
|
107
|
+
formatter =
|
108
|
+
SyntaxTree::Formatter.new(source, [], maxwidth, "\n", &genspace)
|
102
109
|
SyntaxTree.parse(source).format(formatter)
|
103
110
|
formatter.flush
|
104
111
|
formatter.output.join
|
105
112
|
when "rbs"
|
106
|
-
formatter =
|
113
|
+
formatter =
|
114
|
+
SyntaxTree::RBS::Formatter.new(
|
115
|
+
source,
|
116
|
+
[],
|
117
|
+
maxwidth,
|
118
|
+
"\n",
|
119
|
+
&genspace
|
120
|
+
)
|
107
121
|
SyntaxTree::RBS.parse(source).format(formatter)
|
108
122
|
formatter.flush
|
109
123
|
formatter.output.join
|
110
124
|
when "haml"
|
111
|
-
PrettierPrint.
|
112
|
-
|
113
|
-
|
125
|
+
formatter = PrettierPrint.new(+"", maxwidth, "\n", &genspace)
|
126
|
+
SyntaxTree::Haml.parse(source).format(formatter)
|
127
|
+
formatter.flush
|
128
|
+
formatter.output
|
114
129
|
end
|
115
130
|
|
116
131
|
if response
|
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: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: syntax_tree
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: syntax_tree-haml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|