prettier 0.19.0 → 0.19.1

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: 358b5350f0d237d510b4da937cf34a1aac4af594929f8b1799b2da05fce6a755
4
- data.tar.gz: add73454d3a6e45214e568940551182313334ff4d43bf93196d1637b946e5866
3
+ metadata.gz: c1f1b3a234ed95cb01a603dafef678f5363e34953a35fb662ce59a83a0462393
4
+ data.tar.gz: 77fbbb7333e1d119a3ec3fbd6f4c3c305cba1826b9b03e5b22a7876ef5f0f686
5
5
  SHA512:
6
- metadata.gz: 5277fec090d225d2aff51abb198c3b61580f0304252a088bc574868dd2d122b666dabf627faadf50f9e8b066de3fd8593a149a61b9609e605acaae54f73e2de6
7
- data.tar.gz: 4571eed09e3a0e492b8b1c7a8dd157ca45db4fb617e17dada815f29beb598c23cfe0008a21d1dff329c4e19c659b2fa8751a339901d59ec156b7c37d75c9afe1
6
+ metadata.gz: 541b753615c3d8daab03eaeb2d82ec4fcca83e112ffc252a86be359f44f98368244701e92f386ab3c9b38f519e308144d9f8274017a25ee9258ca0f2af075226
7
+ data.tar.gz: 60da4e2ab1e640bb58df4ffccdade65c7dad1b923372f30d43799939ad084623ec996c3ef24c501681119a09d4ecaf481583770cb367d21f43a308748ac84483
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.19.1] - 2020-08-21
10
+
11
+ ### Changed
12
+
13
+ - [@Rsullivan00] - Do not tranform word-literal arrays when there is an escape sequence.
14
+ - [@steobrien], [@kddeisz] - Do not indent heredocs with calls more than they should be.
15
+ - [@jpickwell] - Include .simplecov in filenames
16
+ - [@github0013], [@kddeisz] - Ensure we're parsing ruby files using UTF-8 regardless of the system encoding.
17
+
9
18
  ## [0.19.0] - 2020-07-03
10
19
 
11
20
  ### Added
@@ -810,7 +819,8 @@ would previously result in `array[]`, but now prints properly.
810
819
 
811
820
  - Initial release 🎉
812
821
 
813
- [unreleased]: https://github.com/prettier/plugin-ruby/compare/v0.19.0...HEAD
822
+ [unreleased]: https://github.com/prettier/plugin-ruby/compare/v0.19.1...HEAD
823
+ [0.19.1]: https://github.com/prettier/plugin-ruby/compare/v0.19.0...v0.19.1
814
824
  [0.19.0]: https://github.com/prettier/plugin-ruby/compare/v0.18.2...v0.19.0
815
825
  [0.18.2]: https://github.com/prettier/plugin-ruby/compare/v0.18.1...v0.18.2
816
826
  [0.18.1]: https://github.com/prettier/plugin-ruby/compare/v0.18.0...v0.18.1
@@ -904,3 +914,5 @@ would previously result in `array[]`, but now prints properly.
904
914
  [@uri]: https://github.com/uri
905
915
  [@xipgroc]: https://github.com/xipgroc
906
916
  [@yuki24]: https://github.com/yuki24
917
+ [@rsullivan00]: https://github.com/Rsullivan00
918
+ [@steobrien]: https://github.com/steobrien
data/README.md CHANGED
@@ -217,6 +217,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
217
217
  <tr>
218
218
  <td align="center"><a href="https://github.com/ryan-hunter-pc"><img src="https://avatars2.githubusercontent.com/u/13044512?v=4" width="100px;" alt=""/><br /><sub><b>Ryan Hunter</b></sub></a><br /><a href="https://github.com/prettier/plugin-ruby/commits?author=ryan-hunter-pc" title="Code">💻</a></td>
219
219
  <td align="center"><a href="https://www.locksteplabs.com/"><img src="https://avatars1.githubusercontent.com/u/7811733?v=4" width="100px;" alt=""/><br /><sub><b>Jan Klimo</b></sub></a><br /><a href="https://github.com/prettier/plugin-ruby/commits?author=janklimo" title="Code">💻</a></td>
220
+ <td align="center"><a href="http://ricksullivan.net"><img src="https://avatars0.githubusercontent.com/u/3654176?v=4" width="100px;" alt=""/><br /><sub><b>Rick Sullivan</b></sub></a><br /><a href="https://github.com/prettier/plugin-ruby/issues?q=author%3ARsullivan00" title="Bug reports">🐛</a> <a href="https://github.com/prettier/plugin-ruby/commits?author=Rsullivan00" title="Code">💻</a></td>
221
+ <td align="center"><a href="https://twitter.com/steobrien"><img src="https://avatars3.githubusercontent.com/u/1694410?v=4" width="100px;" alt=""/><br /><sub><b>Stephen O'Brien</b></sub></a><br /><a href="https://github.com/prettier/plugin-ruby/issues?q=author%3Asteobrien" title="Bug reports">🐛</a></td>
222
+ <td align="center"><a href="https://github.com/nimish-mehta"><img src="https://avatars2.githubusercontent.com/u/2488470?v=4" width="100px;" alt=""/><br /><sub><b>Nimish Mehta</b></sub></a><br /><a href="https://github.com/prettier/plugin-ruby/issues?q=author%3Animish-mehta" title="Bug reports">🐛</a> <a href="https://github.com/prettier/plugin-ruby/commits?author=nimish-mehta" title="Code">💻</a></td>
220
223
  </tr>
221
224
  </table>
222
225
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prettier/plugin-ruby",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "prettier plugin for the Ruby programming language",
5
5
  "main": "src/ruby.js",
6
6
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "eslint-config-prettier": "^6.10.1",
28
28
  "husky": "^4.2.5",
29
29
  "jest": "^26.0.0",
30
- "pretty-quick": "^2.0.1"
30
+ "pretty-quick": "^3.0.0"
31
31
  },
32
32
  "eslintConfig": {
33
33
  "extends": [
@@ -9,13 +9,17 @@ const {
9
9
  softline
10
10
  } = require("../prettier");
11
11
 
12
+ const preserveArraySubstrings = [" ", "\\"];
13
+
12
14
  const isStringArray = (args) =>
13
15
  args.body.every(
14
16
  (arg) =>
15
17
  arg.type === "string_literal" &&
16
18
  arg.body[0].body.length === 1 &&
17
19
  arg.body[0].body[0].type === "@tstring_content" &&
18
- !arg.body[0].body[0].body.includes(" ")
20
+ !preserveArraySubstrings.some((str) =>
21
+ arg.body[0].body[0].body.includes(str)
22
+ )
19
23
  );
20
24
 
21
25
  const isSymbolArray = (args) =>
@@ -1,4 +1,4 @@
1
- const { concat, group, indent, hardline, softline } = require("../prettier");
1
+ const { concat, group, indent, literalline, softline } = require("../prettier");
2
2
  const toProc = require("../toProc");
3
3
  const { concatBody, first, makeCall } = require("../utils");
4
4
 
@@ -42,7 +42,7 @@ module.exports = {
42
42
  heredoc.beging,
43
43
  printedOperator,
44
44
  printedMessage,
45
- hardline,
45
+ literalline,
46
46
  concat(path.map.apply(path, [print].concat(heredoc.content))),
47
47
  heredoc.ending
48
48
  ]);
@@ -1,11 +1,27 @@
1
1
  const { spawnSync } = require("child_process");
2
2
  const path = require("path");
3
3
 
4
+ // In order to properly parse ruby code, we need to tell the ruby process to
5
+ // parse using UTF-8. Unfortunately, the way that you accomplish this looks
6
+ // differently depending on your platform. This object below represents all of
7
+ // the possible values of process.platform per:
8
+ // https://nodejs.org/api/process.html#process_process_platform
9
+ const LANG = {
10
+ aix: "C.UTF-8",
11
+ darwin: "en_US.UTF-8",
12
+ freebsd: "C.UTF-8",
13
+ linux: "C.UTF-8",
14
+ openbsd: "C.UTF-8",
15
+ sunos: "C.UTF-8",
16
+ win32: ".UTF-8"
17
+ }[process.platform];
18
+
4
19
  module.exports = (text, _parsers, _opts) => {
5
20
  const child = spawnSync(
6
21
  "ruby",
7
22
  ["--disable-gems", path.join(__dirname, "./ripper.rb")],
8
23
  {
24
+ env: { LANG },
9
25
  input: text,
10
26
  maxBuffer: 10 * 1024 * 1024 // 10MB
11
27
  }
@@ -3,10 +3,11 @@
3
3
  # We implement our own version checking here instead of using Gem::Version so
4
4
  # that we can use the --disable-gems flag.
5
5
  major, minor, * = RUBY_VERSION.split('.').map(&:to_i)
6
+
6
7
  if (major < 2) || ((major == 2) && (minor < 5))
7
8
  warn(
8
- "Ruby version #{current_version} not supported. " \
9
- "Please upgrade to #{required_version} or above."
9
+ "Ruby version #{RUBY_VERSION} not supported. " \
10
+ 'Please upgrade to 2.5.0 or above.'
10
11
  )
11
12
 
12
13
  exit 1
@@ -49,6 +49,7 @@ module.exports = {
49
49
  filenames: [
50
50
  ".irbrc",
51
51
  ".pryrc",
52
+ ".simplecov",
52
53
  "Appraisals",
53
54
  "Berksfile",
54
55
  "Brewfile",
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: 0.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Deisz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-03 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,8 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '13.0'
55
- description:
56
- email:
55
+ description:
56
+ email:
57
57
  executables:
58
58
  - rbprettier
59
59
  extensions: []
@@ -123,7 +123,7 @@ homepage: https://github.com/prettier/plugin-ruby#readme
123
123
  licenses:
124
124
  - MIT
125
125
  metadata: {}
126
- post_install_message:
126
+ post_install_message:
127
127
  rdoc_options: []
128
128
  require_paths:
129
129
  - lib
@@ -138,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubygems_version: 3.1.2
142
- signing_key:
141
+ rubygems_version: 3.0.3
142
+ signing_key:
143
143
  specification_version: 4
144
144
  summary: prettier plugin for the Ruby programming language
145
145
  test_files: []