@prettier/plugin-ruby
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -9,2 +9,8 @@ # Changelog | ||
## [0.4.1] - 2019-02-12 | ||
### Changed | ||
- [INTERNAL] Provide the `makeList` utility for the nodes that are lists from within ripper. | ||
- Again, this time for real, properly escape strings. (Thanks to @awinograd for the report.) | ||
- Fix up trailing commas on command calls. | ||
## [0.4.0] - 2019-02-12 | ||
@@ -109,3 +115,4 @@ ### Added | ||
[Unreleased]: https://github.com/CultureHQ/add-to-calendar/compare/v0.4.0...HEAD | ||
[Unreleased]: https://github.com/CultureHQ/add-to-calendar/compare/v0.4.1...HEAD | ||
[0.4.1]: https://github.com/CultureHQ/add-to-calendar/compare/v0.4.0...v0.4.1 | ||
[0.4.0]: https://github.com/CultureHQ/add-to-calendar/compare/v0.3.7...v0.4.0 | ||
@@ -112,0 +119,0 @@ [0.3.7]: https://github.com/CultureHQ/add-to-calendar/compare/v0.3.6...v0.3.7 |
{ | ||
"name": "@prettier/plugin-ruby", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "prettier plugin for the Ruby programming language", | ||
@@ -9,3 +9,3 @@ "main": "src/ruby.js", | ||
"print": "prettier --plugin=.", | ||
"rubocop": "run() { prettier --plugin=. $1 | bundle exec rubocop --stdin $1; }; run" | ||
"rubocop": "run() { prettier --plugin=. $@ | bundle exec rubocop --stdin $1; }; run" | ||
}, | ||
@@ -12,0 +12,0 @@ "repository": { |
const { align, breakParent, concat, dedent, dedentToRoot, group, hardline, ifBreak, indent, join, line, lineSuffix, literalline, markAsRoot, softline, trim } = require("prettier").doc.builders; | ||
const { concatBody, empty, first, literal, makeCall, prefix, printComments, skipAssignIndent, surround } = require("./utils"); | ||
const { concatBody, empty, first, literal, makeCall, makeList, prefix, printComments, skipAssignIndent, surround } = require("./utils"); | ||
@@ -71,3 +71,3 @@ module.exports = { | ||
...parts, | ||
trailingComma ? ifBreak(",", "") : "" | ||
path.getParentNode().type !== "command" && trailingComma ? ifBreak(",", "") : "" | ||
])); | ||
@@ -384,3 +384,3 @@ }, | ||
methref: (path, opts, print) => join(".:", path.map(print, "body")), | ||
mlhs: (path, opts, print) => path.map(print, "body"), | ||
mlhs: makeList, | ||
mlhs_add_post: (path, opts, print) => [ | ||
@@ -399,3 +399,3 @@ ...path.call(print, "body", 0), | ||
])), | ||
mrhs: (path, opts, print) => path.map(print, "body"), | ||
mrhs: makeList, | ||
mrhs_add_star: (path, opts, print) => group(join( | ||
@@ -402,0 +402,0 @@ concat([",", line]), |
const { concat, group, indent, softline } = require("prettier").doc.builders; | ||
const { makeList } = require("../utils"); | ||
module.exports = { | ||
regexp: (path, opts, print) => path.map(print, "body"), | ||
regexp: makeList, | ||
regexp_literal: (path, opts, print) => { | ||
@@ -6,0 +7,0 @@ const [contents, ending] = path.map(print, "body"); |
const { concat, group, hardline, indent, join, line, softline } = require("prettier").doc.builders; | ||
const { concatBody, empty, surround } = require("../utils"); | ||
const { concatBody, empty, makeList, surround } = require("../utils"); | ||
@@ -12,3 +12,3 @@ // Matches _any_ escape and unescaped quotes (both single and double). | ||
// enclose `content` with `enclosingQuote`. | ||
content.replace(quotePattern, (match, escaped, quote) => { | ||
return content.replace(quotePattern, (match, escaped, quote) => { | ||
if (escaped === otherQuote) { | ||
@@ -25,5 +25,5 @@ return escaped; | ||
} | ||
return "\\" + escaped; | ||
}); | ||
return content; | ||
}; | ||
@@ -51,3 +51,3 @@ | ||
}, | ||
string: (path, opts, print) => path.map(print, "body"), | ||
string: makeList, | ||
string_concat: (path, opts, print) => group(concat([ | ||
@@ -59,3 +59,14 @@ path.call(print, "body", 0), | ||
string_dvar: surround("#{", "}"), | ||
string_embexpr: surround("#{", "}"), | ||
string_embexpr: (path, opts, print) => { | ||
const stmts = path.getValue().body[0].body; | ||
const isHeredoc = stmts.length === 1 && ( | ||
stmts[0].type === "heredoc" || stmts[0].body[0].type === "heredoc" | ||
); | ||
return concat([ | ||
"#{", | ||
path.call(print, "body", 0), | ||
concat([isHeredoc ? hardline : "", "}"]) | ||
]); | ||
}, | ||
string_literal: (path, { preferSingleQuotes }, print) => { | ||
@@ -99,3 +110,3 @@ const string = path.getValue().body[0]; | ||
word_new: empty, | ||
xstring: (path, opts, print) => path.map(print, "body"), | ||
xstring: makeList, | ||
xstring_literal: (path, opts, print) => group(concat([ | ||
@@ -102,0 +113,0 @@ "`", |
@@ -21,2 +21,4 @@ const { breakParent, concat, hardline, lineSuffix } = require("prettier").doc.builders; | ||
const makeList = (path, opts, print) => path.map(print, "body"); | ||
const prefix = value => (path, opts, print) => concat([ | ||
@@ -68,2 +70,3 @@ value, | ||
makeCall, | ||
makeList, | ||
prefix, | ||
@@ -70,0 +73,0 @@ printComments, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176547
1125