Enforce braces after `if`/etc (#1719)
See https://github.com/prettier/prettier/pull/1718#discussion_r118382742master
parent
a6068c0532
commit
7344a37b5c
|
@ -8,6 +8,7 @@ module.exports = {
|
|||
extends: ["eslint:recommended"],
|
||||
plugins: ["prettier"],
|
||||
rules: {
|
||||
curly: "error",
|
||||
"no-console": "off",
|
||||
"no-inner-declarations": "off",
|
||||
"no-var": "error",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue