prettier 2.0.0.pre.rc4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7001f9fc2c9aed2d630d5133b86baa047f44b1634690e0fcecc81c6186943c6d
4
- data.tar.gz: 73cd58e7dec8253b2d1a9e9a4d18dd1cb968b147ddf71f069457ed2c1091a066
3
+ metadata.gz: a8393d82622bcce83298aa8e2833b37bccf9742b0a67e81cd3b730e57e6795b8
4
+ data.tar.gz: a66af4efc73854f143e0faa288fdde112bf87ba45364af3efd862a179734453c
5
5
  SHA512:
6
- metadata.gz: 96f757bea8e85f036ba84dbd59a64e072264eedfcec6c901df5ef94bcb9f638a5fbb5c84a5b92c8f02cf26f75a8d1f8a5025a13eb3ec9a9bc3c2efc5f8790303
7
- data.tar.gz: 13b2dd4e2d8e13f3bc01e5cca5d9abbaab975b668f164dd82e3c598344def9acd618082a0da7bb710e47886d85efaa7ca1d55bd33af24aee4ce2e41e0a7bbd89
6
+ metadata.gz: f780174b5b038bfd9583c637caefff23e442f4aef626e9e33769811c15afd7c267bb78f20c4eb223ab4b50f3c0b6664123c6ce00d997ff0a571b0d57228f5070
7
+ data.tar.gz: bdfbd3f42b4db020059b511b3176ee7b5393a5a008136dd06a584c26df69afbcfe7d937e6151e22029858d71bad68e8c68eb07241e67771debd802cf733c282d
data/CHANGELOG.md CHANGED
@@ -6,7 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [2.0.0-rc4]
9
+ ## [2.0.0] - 2021-10-28
10
+
11
+ ### Changed
12
+
13
+ - [#1018](https://github.com/prettier/plugin-ruby/issues/1018) - rindek, kddnewton - Ensure brackets are used when matching an array pattern with a single element.
14
+ - [#906](https://github.com/prettier/plugin-ruby/issues/906) - Hansenq, kddnewton - Turn off the `Style/MultilineBlockChain` rubocop rule in our shipped configuration because multiple chained method calls with blocks can potentially conflict with rubocop's desired output.
15
+
16
+ ## [2.0.0-rc4] - 2021-10-18
10
17
 
11
18
  ### Added
12
19
 
@@ -17,14 +24,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
17
24
 
18
25
  - [#1000](https://github.com/prettier/plugin-ruby/pull/1000) - nbudin, kddnewton - Fix for rescuing single top-level exceptions in `rescue` clauses.
19
26
 
20
- ## [2.0.0-rc3]
27
+ ## [2.0.0-rc3] - 2021-10-01
21
28
 
22
29
  ### Changed
23
30
 
24
31
  - [#987](https://github.com/prettier/plugin-ruby/pull/9870) - valscion - Ignore stderr when checking for node <-> ruby connection clients, restoring the behavior of v1.x
25
32
  - [#989](https://github.com/prettier/plugin-ruby/issues/989) - hubertjakubiak, kddnewton - Make sure comments after the keyword/lbrace are not moved inside the body of the statements of do and brace blocks.
26
33
 
27
- ## [2.0.0-rc2]
34
+ ## [2.0.0-rc2] - 2021-09-30
28
35
 
29
36
  ### Added
30
37
 
@@ -35,7 +42,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
35
42
 
36
43
  - [#943](https://github.com/prettier/plugin-ruby/issues/943) - valscion, kddnewton - Trailing call operators that are followed by comments should stay on the first line.
37
44
 
38
- ## [2.0.0-rc1]
45
+ ## [2.0.0-rc1] - 2021-09-30
39
46
 
40
47
  ### Added
41
48
 
@@ -1180,7 +1187,8 @@ would previously result in `array[]`, but now prints properly.
1180
1187
 
1181
1188
  - Initial release 🎉
1182
1189
 
1183
- [unreleased]: https://github.com/prettier/plugin-ruby/compare/v2.0.0-rc4...HEAD
1190
+ [unreleased]: https://github.com/prettier/plugin-ruby/compare/v2.0.0...HEAD
1191
+ [2.0.0]: https://github.com/prettier/plugin-ruby/compare/v2.0.0-rc4...v2.0.0
1184
1192
  [2.0.0-rc4]: https://github.com/prettier/plugin-ruby/compare/v2.0.0-rc3...v2.0.0-rc4
1185
1193
  [2.0.0-rc3]: https://github.com/prettier/plugin-ruby/compare/v2.0.0-rc2...v2.0.0-rc3
1186
1194
  [2.0.0-rc2]: https://github.com/prettier/plugin-ruby/compare/v2.0.0-rc1...v2.0.0-rc2
@@ -19,24 +19,36 @@ const printPatternArg = (path, opts, print) => {
19
19
  };
20
20
  const printAryPtn = (path, opts, print) => {
21
21
  const [constant, preargs, splatarg, postargs] = path.getValue().body;
22
- let args = [];
22
+ let argDocs = [];
23
23
  if (preargs) {
24
- args = args.concat(path.map((argPath) => printPatternArg(argPath, opts, print), "body", 1));
24
+ argDocs = argDocs.concat(path.map((argPath) => printPatternArg(argPath, opts, print), "body", 1));
25
25
  }
26
26
  if (splatarg) {
27
- args.push(["*", path.call(print, "body", 2)]);
27
+ argDocs.push(["*", path.call(print, "body", 2)]);
28
28
  }
29
29
  if (postargs) {
30
- args = args.concat(path.map(print, "body", 3));
30
+ argDocs = argDocs.concat(path.map(print, "body", 3));
31
31
  }
32
- args = group(join([",", line], args));
33
- if (constant || patterns.includes(path.getParentNode().type)) {
34
- args = ["[", args, "]"];
32
+ let argDoc = group(join([",", line], argDocs));
33
+ // There are a couple of cases where we _must_ use brackets. They include:
34
+ //
35
+ // * When the number of arguments inside the array pattern is one 1, then we
36
+ // have to include them, otherwise it matches the whole array. Consider the
37
+ // difference between `in [elem]` and `in elem`.
38
+ // * If we have a wrapping constant, then we definitely need the brackets.
39
+ // Consider the difference between `in Const[elem]` and `in Const elem`
40
+ // * If we're nested inside a parent pattern, then we have to have brackets.
41
+ // Consider the difference between `in key: first, second` and
42
+ // `in key: [first, second]`.
43
+ if (argDocs.length === 1 ||
44
+ constant ||
45
+ patterns.includes(path.getParentNode().type)) {
46
+ argDoc = ["[", argDoc, "]"];
35
47
  }
36
48
  if (constant) {
37
- return [path.call(print, "body", 0), args];
49
+ return [path.call(print, "body", 0), argDoc];
38
50
  }
39
- return args;
51
+ return argDoc;
40
52
  };
41
53
  exports.printAryPtn = printAryPtn;
42
54
  const printFndPtn = (path, opts, print) => {
@@ -86,9 +98,10 @@ const printHshPtn = (path, opts, print) => {
86
98
  };
87
99
  exports.printHshPtn = printHshPtn;
88
100
  const printIn = (path, opts, print) => {
101
+ const keyword = "in ";
89
102
  const parts = [
90
- "in ",
91
- align("in ".length, path.call((valuePath) => printPatternArg(valuePath, opts, print), "body", 0)),
103
+ keyword,
104
+ align(keyword.length, path.call((valuePath) => printPatternArg(valuePath, opts, print), "body", 0)),
92
105
  indent([hardline, path.call(print, "body", 1)])
93
106
  ];
94
107
  if (path.getValue().body[2]) {
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prettier/plugin-ruby",
3
- "version": "2.0.0-rc4",
3
+ "version": "2.0.0",
4
4
  "description": "prettier plugin for the Ruby programming language",
5
5
  "main": "dist/plugin.js",
6
6
  "scripts": {
@@ -26,9 +26,9 @@
26
26
  "@types/jest": "^27.0.1",
27
27
  "@types/node": "^16.9.1",
28
28
  "@types/prettier": "^2.3.2",
29
- "@typescript-eslint/eslint-plugin": "^4.31.2",
30
- "@typescript-eslint/parser": "^4.31.2",
31
- "eslint": "^7.22.0",
29
+ "@typescript-eslint/eslint-plugin": "^5.2.0",
30
+ "@typescript-eslint/parser": "^5.2.0",
31
+ "eslint": "^8.1.0",
32
32
  "eslint-config-prettier": "^8.0.0",
33
33
  "husky": "^7.0.0",
34
34
  "jest": "^27.0.1",
data/rubocop.yml CHANGED
@@ -13,12 +13,16 @@ Layout:
13
13
  Layout/LineLength:
14
14
  Enabled: true
15
15
 
16
- # Disabling all of the following options because they could conflict with a
17
- # prettier configuration setting.
18
-
19
16
  Style/MultilineIfModifier: # rubyModifier
20
17
  Enabled: false
21
18
 
19
+ # When method chains with multiple blocks are chained together, rubocop will let
20
+ # them pass if they're using braces but not if they're using do and end
21
+ # keywords. Because we will break individual blocks down to using keywords if
22
+ # they are multiline, this conflicts with rubocop.
23
+ Style/MultilineBlockChain:
24
+ Enabled: false
25
+
22
26
  Style/SymbolArray: # rubyArrayLiteral
23
27
  Enabled: false
24
28
 
@@ -34,5 +38,7 @@ Style/TrailingCommaInArrayLiteral: # trailingComma
34
38
  Style/TrailingCommaInHashLiteral: # trailingComma
35
39
  Enabled: false
36
40
 
41
+ # lambdas that are constructed with the lambda method call cannot be safely
42
+ # turned into lambda literals without removing a method call.
37
43
  Style/Lambda:
38
44
  Enabled: false
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: 2.0.0.pre.rc4
4
+ version: 2.0.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: 2021-10-18 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -129,9 +129,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ">"
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
- version: 1.3.1
134
+ version: '0'
135
135
  requirements: []
136
136
  rubygems_version: 3.2.3
137
137
  signing_key: