Skip to content

Commit

Permalink
Bump Prettier dependency to 1.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Nov 9, 2019
1 parent e788e8d commit 98d27c7
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 47 deletions.
6 changes: 4 additions & 2 deletions docs/rationale.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ One final thing: TC39 has [not yet decided if decorators come before or after `e

```js
@decorator
export class Foo { }
export class Foo {}

export @decorator class Foo { }
export
@decorator
class Foo {}
```

### Semicolons
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "1.19.0",
"version": "1.20.0-dev",
"description": "Prettier is an opinionated code formatter",
"bin": {
"prettier": "./bin/prettier.js"
Expand Down Expand Up @@ -96,7 +96,7 @@
"jest-snapshot-serializer-raw": "1.1.0",
"jest-watch-typeahead": "0.4.0",
"mkdirp": "0.5.1",
"prettier": "1.18.2",
"prettier": "1.19.0",
"prettylint": "1.0.0",
"rimraf": "3.0.0",
"rollup": "1.26.3",
Expand Down
3 changes: 2 additions & 1 deletion src/language-css/printer-postcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ function genericPrint(path, options, print) {
(isAdditionNode(iNode) || isSubtractionNode(iNode)) &&
i === 0 &&
(iNextNode.type === "value-number" || iNextNode.isHex) &&
(parentParentNode && isColorAdjusterFuncNode(parentParentNode)) &&
parentParentNode &&
isColorAdjusterFuncNode(parentParentNode) &&
!hasEmptyRawBefore(iNextNode);

const requireSpaceBeforeOperator =
Expand Down
8 changes: 4 additions & 4 deletions src/language-html/printer-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ function genericPrint(path, options, print) {
const shouldHugContent =
node.children.length === 1 &&
node.firstChild.type === "interpolation" &&
(node.firstChild.isLeadingSpaceSensitive &&
!node.firstChild.hasLeadingSpaces) &&
(node.lastChild.isTrailingSpaceSensitive &&
!node.lastChild.hasTrailingSpaces);
node.firstChild.isLeadingSpaceSensitive &&
!node.firstChild.hasLeadingSpaces &&
node.lastChild.isTrailingSpaceSensitive &&
!node.lastChild.hasTrailingSpaces;
const attrGroupId = Symbol("element-attr-group-id");
return concat([
group(
Expand Down
6 changes: 3 additions & 3 deletions src/language-html/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ function forceBreakContent(node) {
node.children.some(child => hasNonTextChild(child)))) ||
(node.firstChild &&
node.firstChild === node.lastChild &&
(hasLeadingLineBreak(node.firstChild) &&
(!node.lastChild.isTrailingSpaceSensitive ||
hasTrailingLineBreak(node.lastChild))))
hasLeadingLineBreak(node.firstChild) &&
(!node.lastChild.isTrailingSpaceSensitive ||
hasTrailingLineBreak(node.lastChild)))
);
}

Expand Down
7 changes: 4 additions & 3 deletions src/language-js/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ function handleClassComments(
enclosingNode &&
(enclosingNode.type === "ClassDeclaration" ||
enclosingNode.type === "ClassExpression") &&
(enclosingNode.decorators && enclosingNode.decorators.length > 0) &&
enclosingNode.decorators &&
enclosingNode.decorators.length > 0 &&
!(followingNode && followingNode.type === "Decorator")
) {
if (!enclosingNode.decorators || enclosingNode.decorators.length === 0) {
Expand Down Expand Up @@ -573,8 +574,8 @@ function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
}
if (
enclosingNode &&
(enclosingNode.type === "MethodDefinition" &&
enclosingNode.value.params.length === 0)
enclosingNode.type === "MethodDefinition" &&
enclosingNode.value.params.length === 0
) {
addDanglingComment(enclosingNode.value, comment);
return true;
Expand Down
9 changes: 4 additions & 5 deletions src/language-js/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,10 @@ function embed(path, print, textToDoc, options) {
*/
if (
parentParent &&
(parentParent.type === "TaggedTemplateExpression" &&
parent.quasis.length === 1 &&
(parentParent.tag.type === "Identifier" &&
(parentParent.tag.name === "md" ||
parentParent.tag.name === "markdown")))
parentParent.type === "TaggedTemplateExpression" &&
parent.quasis.length === 1 &&
parentParent.tag.type === "Identifier" &&
(parentParent.tag.name === "md" || parentParent.tag.name === "markdown")
) {
const text = parent.quasis[0].value.raw.replace(
/((?:\\\\)*)\\`/g,
Expand Down
28 changes: 14 additions & 14 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,9 @@ function printPathNoParens(path, options, print, args) {
(n === parent.body && parent.type === "ArrowFunctionExpression") ||
(n !== parent.body && parent.type === "ForStatement") ||
(parent.type === "ConditionalExpression" &&
(parentParent.type !== "ReturnStatement" &&
parentParent.type !== "CallExpression" &&
parentParent.type !== "OptionalCallExpression"));
parentParent.type !== "ReturnStatement" &&
parentParent.type !== "CallExpression" &&
parentParent.type !== "OptionalCallExpression");

const shouldIndentIfInlining =
parent.type === "AssignmentExpression" ||
Expand Down Expand Up @@ -3601,10 +3601,10 @@ function printPathNoParens(path, options, print, args) {
isNgForOf(n, index, parentNode) ||
(((index === 1 && (n.key.name === "then" || n.key.name === "else")) ||
(index === 2 &&
(n.key.name === "else" &&
parentNode.body[index - 1].type ===
"NGMicrosyntaxKeyedExpression" &&
parentNode.body[index - 1].key.name === "then"))) &&
n.key.name === "else" &&
parentNode.body[index - 1].type ===
"NGMicrosyntaxKeyedExpression" &&
parentNode.body[index - 1].key.name === "then")) &&
parentNode.body[0].type === "NGMicrosyntaxExpression");
return concat([
path.call(print, "key"),
Expand Down Expand Up @@ -4450,12 +4450,12 @@ function printExportDeclaration(path, options, print) {

if (
isDefault &&
(decl.declaration.type !== "ClassDeclaration" &&
decl.declaration.type !== "FunctionDeclaration" &&
decl.declaration.type !== "TSInterfaceDeclaration" &&
decl.declaration.type !== "DeclareClass" &&
decl.declaration.type !== "DeclareFunction" &&
decl.declaration.type !== "TSDeclareFunction")
decl.declaration.type !== "ClassDeclaration" &&
decl.declaration.type !== "FunctionDeclaration" &&
decl.declaration.type !== "TSInterfaceDeclaration" &&
decl.declaration.type !== "DeclareClass" &&
decl.declaration.type !== "DeclareFunction" &&
decl.declaration.type !== "TSDeclareFunction"
) {
parts.push(semi);
}
Expand Down Expand Up @@ -5140,7 +5140,7 @@ function separatorNoWhitespace(

if (
(childNode.type === "JSXElement" && !childNode.closingElement) ||
(nextNode && (nextNode.type === "JSXElement" && !nextNode.closingElement))
(nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement)
) {
return child.length === 1 ? softline : hardline;
}
Expand Down
9 changes: 7 additions & 2 deletions src/language-yaml/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,13 @@ function getFlowScalarLineContents(nodeType, content, options) {
index !== 0 &&
rawLineContents[index - 1].length !== 0 &&
lineContentWords.length !== 0 &&
!// trailing backslash in quoteDouble should be preserved
(nodeType === "quoteDouble" && getLast(getLast(reduced)).endsWith("\\"))
!(
// trailing backslash in quoteDouble should be preserved
(
nodeType === "quoteDouble" &&
getLast(getLast(reduced)).endsWith("\\")
)
)
? reduced.concat([reduced.pop().concat(lineContentWords)])
: reduced.concat([lineContentWords]),
[]
Expand Down
8 changes: 5 additions & 3 deletions tests_integration/__tests__/infer-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ describe("--write and --list-different with unknown path and no parser", () => {
});

describe("multiple files", () => {
runPrettier("cli/infer-parser/", ["--list-different", "--write", "*"]).test(
{ status: 0 }
);
runPrettier("cli/infer-parser/", [
"--list-different",
"--write",
"*"
]).test({ status: 0 });
});
});

Expand Down
8 changes: 4 additions & 4 deletions website/blog/2017-05-03-1.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,10 @@ In 1.0, we made class be inline inside of arrow functions. It turns out that it
```js
// Before
export default (ViewComponent: Function, ContainerComponent: Function) => class
extends React.Component {
static propTypes = {};
};
export default (ViewComponent: Function, ContainerComponent: Function) =>
class extends React.Component {
static propTypes = {};
};

// After
export default (ViewComponent: Function, ContainerComponent: Function) =>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5479,10 +5479,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier@1.18.2:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
prettier@1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.0.tgz#3bec4489d5eebcd52b95ddd2c22467b5c852fde1"
integrity sha512-GlAIjk6DjkNT6u/Bw5QCWrbzh9YlLKwwmJT//1YiCR3WDpZDnyss64aXHQZgF8VKeGlWnX6+tGsKSVxsZT/gtA==

pretty-format@^23.0.1, pretty-format@^23.2.0:
version "23.2.0"
Expand Down

0 comments on commit 98d27c7

Please sign in to comment.