Enforce braces after if/etc (#1719)

See https://github.com/prettier/prettier/pull/1718#discussion_r118382742
This commit is contained in:
Joseph Frazier authored and Christopher Chedeau committed 2017-05-24 15:57:05 -07:00
1 parent a6068c0532
commit 7344a37b5c
4 files changed
+7 -3

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ module.exports = {
extends: ["eslint:recommended"],
plugins: ["prettier"],
rules: {
curly: "error",
"no-console": "off",
"no-inner-declarations": "off",
"no-var": "error",
+2 -1
View File
@@ -27,8 +27,9 @@ FastPath.from = function(obj) {
// lightweight FastPath [..., name, value] stacks.
const copy = Object.create(FastPath.prototype);
const stack = [obj.value];
for (let pp; (pp = obj.parentPath); obj = pp)
for (let pp; (pp = obj.parentPath); obj = pp) {
stack.push(obj.name, pp.value);
}
copy.stack = stack.reverse();
return copy;
}
+2 -1
View File
@@ -1369,9 +1369,10 @@ function genericPrintNoParens(path, options, print, args) {
case "CatchClause":
parts.push("catch (", path.call(print, "param"));
if (n.guard)
if (n.guard) {
// Note: esprima does not recognize conditional catch clauses.
parts.push(" if ", path.call(print, "guard"));
}
parts.push(") ", path.call(print, "body"));
+2 -1
View File
@@ -1,7 +1,7 @@
"use strict";
function isExportDeclaration(node) {
if (node)
if (node) {
switch (node.type) {
case "ExportDeclaration":
case "ExportDefaultDeclaration":
@@ -11,6 +11,7 @@ function isExportDeclaration(node) {
case "ExportAllDeclaration":
return true;
}
}
return false;
}