prettier 0.18.1 → 0.18.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prettier/plugin-ruby",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "prettier plugin for the Ruby programming language",
5
5
  "main": "src/ruby.js",
6
6
  "scripts": {
@@ -25,7 +25,9 @@
25
25
  "all-contributors-cli": "^6.14.1",
26
26
  "eslint": "^6.8.0",
27
27
  "eslint-config-prettier": "^6.10.1",
28
- "jest": "^25.2.7"
28
+ "husky": "^4.2.5",
29
+ "jest": "^25.2.7",
30
+ "pretty-quick": "^2.0.1"
29
31
  },
30
32
  "eslintConfig": {
31
33
  "extends": [
@@ -53,6 +55,11 @@
53
55
  ],
54
56
  "testRegex": ".test.js$"
55
57
  },
58
+ "husky": {
59
+ "hooks": {
60
+ "pre-commit": "pretty-quick --staged"
61
+ }
62
+ },
56
63
  "prettier": {
57
64
  "trailingComma": "none"
58
65
  }
@@ -177,9 +177,10 @@ const canTernaryStmts = (stmts) => {
177
177
  // additional node must have only one statement, and that statement list must
178
178
  // pass the `canTernaryStmts` check.
179
179
  const canTernary = (path) => {
180
- const [_pred, stmts, addition] = path.getValue().body;
180
+ const [predicate, stmts, addition] = path.getValue().body;
181
181
 
182
182
  return (
183
+ !["assign", "opassign"].includes(predicate.type) &&
183
184
  addition &&
184
185
  addition.type === "else" &&
185
186
  [stmts, addition.body[0]].every(canTernaryStmts)
@@ -53,7 +53,11 @@ module.exports = {
53
53
  parts.push(" StandardError");
54
54
  }
55
55
 
56
- parts.push(indent(concat([hardline, path.call(print, "body", 2)])));
56
+ const rescueBody = path.call(print, "body", 2);
57
+
58
+ if (rescueBody.parts.length > 0) {
59
+ parts.push(indent(concat([hardline, rescueBody])));
60
+ }
57
61
 
58
62
  // This is the next clause on the `begin` statement, either another
59
63
  // `rescue`, and `ensure`, or an `else` clause.
@@ -78,7 +78,8 @@ module.exports = {
78
78
  {
79
79
  name: "HAML",
80
80
  parsers: ["haml"],
81
- extensions: [".haml"]
81
+ extensions: [".haml"],
82
+ vscodeLanguageIds: ["haml"]
82
83
  }
83
84
  ],
84
85
  parsers: {
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.18.1
4
+ version: 0.18.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: 2020-04-05 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler