Bump prettier@1.19.1 (#10728)

This commit is contained in:
Brian Ng 2019-11-16 09:05:40 -06:00 committed by Nicolò Ribaudo
parent f087cf842f
commit c37361ba2e
11 changed files with 77 additions and 86 deletions

View File

@ -57,7 +57,7 @@
"lint-staged": "^9.2.0",
"lodash": "^4.17.13",
"output-file-sync": "^2.0.0",
"prettier": "^1.17.1",
"prettier": "^1.19.1",
"pump": "^3.0.0",
"rimraf": "^2.6.3",
"rollup": "^1.12.0",

View File

@ -1,9 +1,7 @@
// @flow
export { default as File } from "./transformation/file/file";
export {
default as buildExternalHelpers,
} from "./tools/build-external-helpers";
export { default as buildExternalHelpers } from "./tools/build-external-helpers";
export { resolvePlugin, resolvePreset } from "./config/files";
export { version } from "../package.json";

View File

@ -59,7 +59,10 @@ describe("option-manager", () => {
const { calls: calls2, plugin: plugin2 } = makePlugin();
loadOptions({
plugins: [[plugin1, { arg: 1 }], [plugin2, { arg: 2 }, "some-name"]],
plugins: [
[plugin1, { arg: 1 }],
[plugin2, { arg: 2 }, "some-name"],
],
});
expect(calls1).toEqual([{ arg: 1 }]);
expect(calls2).toEqual([{ arg: 2 }]);
@ -74,7 +77,10 @@ describe("option-manager", () => {
plugins: [[plugin1, { arg: 1 }]],
env: {
test: {
plugins: [[plugin1, { arg: 3 }], [plugin2, { arg: 2 }]],
plugins: [
[plugin1, { arg: 3 }],
[plugin2, { arg: 2 }],
],
},
},
});
@ -98,7 +104,10 @@ describe("option-manager", () => {
const { calls: calls2, plugin: preset2 } = makePlugin();
loadOptions({
presets: [[preset1, { arg: 1 }], [preset2, { arg: 2 }, "some-name"]],
presets: [
[preset1, { arg: 1 }],
[preset2, { arg: 2 }, "some-name"],
],
});
expect(calls1).toEqual([{ arg: 1 }]);
expect(calls2).toEqual([{ arg: 2 }]);
@ -112,7 +121,10 @@ describe("option-manager", () => {
presets: [[preset1, { arg: 1 }]],
env: {
test: {
presets: [[preset1, { arg: 3 }], [preset2, { arg: 2 }]],
presets: [
[preset1, { arg: 3 }],
[preset2, { arg: 2 }],
],
},
},
});
@ -130,7 +142,10 @@ describe("option-manager", () => {
presets: [[preset1, { arg: 1 }]],
env: {
test: {
presets: [[preset1, { arg: 3 }], [preset2, { arg: 2 }]],
presets: [
[preset1, { arg: 3 }],
[preset2, { arg: 2 }],
],
},
},
});

View File

@ -65,9 +65,9 @@ export function ObjectProperty(node: Object) {
// shorthand!
if (
node.shorthand &&
(t.isIdentifier(node.key) &&
t.isIdentifier(node.value) &&
node.key.name === node.value.name)
t.isIdentifier(node.key) &&
t.isIdentifier(node.value) &&
node.key.name === node.value.name
) {
return;
}

View File

@ -70,7 +70,8 @@ function normalizeOptions(code, opts): Format {
format.shouldPrintComment ||
(value =>
format.comments ||
(value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0));
value.indexOf("@license") >= 0 ||
value.indexOf("@preserve") >= 0);
}
if (format.compact === "auto") {

View File

@ -97,7 +97,8 @@ export function createClassFeaturePlugin({
} else {
if (
(privateNames.has(name) &&
(!privateNames.has(getName) && !privateNames.has(setName))) ||
!privateNames.has(getName) &&
!privateNames.has(setName)) ||
(privateNames.has(name) &&
(privateNames.has(getName) || privateNames.has(setName)))
) {

View File

@ -40,7 +40,10 @@ function getNormalizedV8Flag(arg) {
}
// These are aliases for node options defined by babel-node.
const aliases = new Map([["-d", "--debug"], ["-gc", "--expose-gc"]]);
const aliases = new Map([
["-d", "--debug"],
["-gc", "--expose-gc"],
]);
getV8Flags(function(err, v8Flags) {
for (let i = 0; i < babelArgs.length; i++) {

View File

@ -87,26 +87,28 @@ const memberExpressionOptimisationVisitor = {
const argsOptEligible =
!state.deopted &&
!// ex: `args[0] = "whatever"`
(
(grandparentPath.isAssignmentExpression() &&
parentPath.node === grandparentPath.node.left) ||
// ex: `[args[0]] = ["whatever"]`
grandparentPath.isLVal() ||
// ex: `for (rest[0] in this)`
// ex: `for (rest[0] of this)`
grandparentPath.isForXStatement() ||
// ex: `++args[0]`
// ex: `args[0]--`
grandparentPath.isUpdateExpression() ||
// ex: `delete args[0]`
grandparentPath.isUnaryExpression({ operator: "delete" }) ||
// ex: `args[0]()`
// ex: `new args[0]()`
// ex: `new args[0]`
((grandparentPath.isCallExpression() ||
grandparentPath.isNewExpression()) &&
parentPath.node === grandparentPath.node.callee)
!(
// ex: `args[0] = "whatever"`
(
(grandparentPath.isAssignmentExpression() &&
parentPath.node === grandparentPath.node.left) ||
// ex: `[args[0]] = ["whatever"]`
grandparentPath.isLVal() ||
// ex: `for (rest[0] in this)`
// ex: `for (rest[0] of this)`
grandparentPath.isForXStatement() ||
// ex: `++args[0]`
// ex: `args[0]--`
grandparentPath.isUpdateExpression() ||
// ex: `delete args[0]`
grandparentPath.isUnaryExpression({ operator: "delete" }) ||
// ex: `args[0]()`
// ex: `new args[0]()`
// ex: `new args[0]`
((grandparentPath.isCallExpression() ||
grandparentPath.isNewExpression()) &&
parentPath.node === grandparentPath.node.callee)
)
);
if (argsOptEligible) {

View File

@ -59,7 +59,8 @@ export default declare((api, options) => {
const { value } = expressionResult;
const isMutable =
(!state.mutablePropsAllowed &&
(value && typeof value === "object")) ||
value &&
typeof value === "object") ||
typeof value === "function";
if (!isMutable) {
// It evaluated to an immutable value, so we can hoist it.

View File

@ -7,13 +7,9 @@ import buildChildren from "./builders/react/buildChildren";
export { default as assertNode } from "./asserts/assertNode";
export * from "./asserts/generated";
//builders
export {
default as createTypeAnnotationBasedOnTypeof,
} from "./builders/flow/createTypeAnnotationBasedOnTypeof";
export {
default as createUnionTypeAnnotation,
} from "./builders/flow/createUnionTypeAnnotation";
// builders
export { default as createTypeAnnotationBasedOnTypeof } from "./builders/flow/createTypeAnnotationBasedOnTypeof";
export { default as createUnionTypeAnnotation } from "./builders/flow/createUnionTypeAnnotation";
export * from "./builders/generated";
// clone
@ -25,16 +21,10 @@ export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc";
// comments
export { default as addComment } from "./comments/addComment";
export { default as addComments } from "./comments/addComments";
export {
default as inheritInnerComments,
} from "./comments/inheritInnerComments";
export {
default as inheritLeadingComments,
} from "./comments/inheritLeadingComments";
export { default as inheritInnerComments } from "./comments/inheritInnerComments";
export { default as inheritLeadingComments } from "./comments/inheritLeadingComments";
export { default as inheritsComments } from "./comments/inheritsComments";
export {
default as inheritTrailingComments,
} from "./comments/inheritTrailingComments";
export { default as inheritTrailingComments } from "./comments/inheritTrailingComments";
export { default as removeComments } from "./comments/removeComments";
// constants
@ -43,17 +33,13 @@ export * from "./constants";
// converters
export { default as ensureBlock } from "./converters/ensureBlock";
export {
default as toBindingIdentifierName,
} from "./converters/toBindingIdentifierName";
export { default as toBindingIdentifierName } from "./converters/toBindingIdentifierName";
export { default as toBlock } from "./converters/toBlock";
export { default as toComputedKey } from "./converters/toComputedKey";
export { default as toExpression } from "./converters/toExpression";
export { default as toIdentifier } from "./converters/toIdentifier";
export { default as toKeyAlias } from "./converters/toKeyAlias";
export {
default as toSequenceExpression,
} from "./converters/toSequenceExpression";
export { default as toSequenceExpression } from "./converters/toSequenceExpression";
export { default as toStatement } from "./converters/toStatement";
export { default as valueToNode } from "./converters/valueToNode";
@ -61,28 +47,16 @@ export { default as valueToNode } from "./converters/valueToNode";
export * from "./definitions";
// modifications
export {
default as appendToMemberExpression,
} from "./modifications/appendToMemberExpression";
export { default as appendToMemberExpression } from "./modifications/appendToMemberExpression";
export { default as inherits } from "./modifications/inherits";
export {
default as prependToMemberExpression,
} from "./modifications/prependToMemberExpression";
export { default as prependToMemberExpression } from "./modifications/prependToMemberExpression";
export { default as removeProperties } from "./modifications/removeProperties";
export {
default as removePropertiesDeep,
} from "./modifications/removePropertiesDeep";
export {
default as removeTypeDuplicates,
} from "./modifications/flow/removeTypeDuplicates";
export { default as removePropertiesDeep } from "./modifications/removePropertiesDeep";
export { default as removeTypeDuplicates } from "./modifications/flow/removeTypeDuplicates";
// retrievers
export {
default as getBindingIdentifiers,
} from "./retrievers/getBindingIdentifiers";
export {
default as getOuterBindingIdentifiers,
} from "./retrievers/getOuterBindingIdentifiers";
export { default as getBindingIdentifiers } from "./retrievers/getBindingIdentifiers";
export { default as getOuterBindingIdentifiers } from "./retrievers/getOuterBindingIdentifiers";
// traverse
export { default as traverse } from "./traverse/traverse";
@ -105,16 +79,12 @@ export { default as isReferenced } from "./validators/isReferenced";
export { default as isScope } from "./validators/isScope";
export { default as isSpecifierDefault } from "./validators/isSpecifierDefault";
export { default as isType } from "./validators/isType";
export {
default as isValidES3Identifier,
} from "./validators/isValidES3Identifier";
export { default as isValidES3Identifier } from "./validators/isValidES3Identifier";
export { default as isValidIdentifier } from "./validators/isValidIdentifier";
export { default as isVar } from "./validators/isVar";
export { default as matchesPattern } from "./validators/matchesPattern";
export { default as validate } from "./validators/validate";
export {
default as buildMatchMemberExpression,
} from "./validators/buildMatchMemberExpression";
export { default as buildMatchMemberExpression } from "./validators/buildMatchMemberExpression";
export * from "./validators/generated";
// react

View File

@ -8724,10 +8724,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@^1.17.1:
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.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
pretty-format@^24.9.0:
version "24.9.0"