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", "lint-staged": "^9.2.0",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"output-file-sync": "^2.0.0", "output-file-sync": "^2.0.0",
"prettier": "^1.17.1", "prettier": "^1.19.1",
"pump": "^3.0.0", "pump": "^3.0.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"rollup": "^1.12.0", "rollup": "^1.12.0",

View File

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

View File

@ -59,7 +59,10 @@ describe("option-manager", () => {
const { calls: calls2, plugin: plugin2 } = makePlugin(); const { calls: calls2, plugin: plugin2 } = makePlugin();
loadOptions({ 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(calls1).toEqual([{ arg: 1 }]);
expect(calls2).toEqual([{ arg: 2 }]); expect(calls2).toEqual([{ arg: 2 }]);
@ -74,7 +77,10 @@ describe("option-manager", () => {
plugins: [[plugin1, { arg: 1 }]], plugins: [[plugin1, { arg: 1 }]],
env: { env: {
test: { 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(); const { calls: calls2, plugin: preset2 } = makePlugin();
loadOptions({ 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(calls1).toEqual([{ arg: 1 }]);
expect(calls2).toEqual([{ arg: 2 }]); expect(calls2).toEqual([{ arg: 2 }]);
@ -112,7 +121,10 @@ describe("option-manager", () => {
presets: [[preset1, { arg: 1 }]], presets: [[preset1, { arg: 1 }]],
env: { env: {
test: { 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 }]], presets: [[preset1, { arg: 1 }]],
env: { env: {
test: { 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! // shorthand!
if ( if (
node.shorthand && node.shorthand &&
(t.isIdentifier(node.key) && t.isIdentifier(node.key) &&
t.isIdentifier(node.value) && t.isIdentifier(node.value) &&
node.key.name === node.value.name) node.key.name === node.value.name
) { ) {
return; return;
} }

View File

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

View File

@ -97,7 +97,8 @@ export function createClassFeaturePlugin({
} else { } else {
if ( if (
(privateNames.has(name) && (privateNames.has(name) &&
(!privateNames.has(getName) && !privateNames.has(setName))) || !privateNames.has(getName) &&
!privateNames.has(setName)) ||
(privateNames.has(name) && (privateNames.has(name) &&
(privateNames.has(getName) || privateNames.has(setName))) (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. // 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) { getV8Flags(function(err, v8Flags) {
for (let i = 0; i < babelArgs.length; i++) { for (let i = 0; i < babelArgs.length; i++) {

View File

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

View File

@ -59,7 +59,8 @@ export default declare((api, options) => {
const { value } = expressionResult; const { value } = expressionResult;
const isMutable = const isMutable =
(!state.mutablePropsAllowed && (!state.mutablePropsAllowed &&
(value && typeof value === "object")) || value &&
typeof value === "object") ||
typeof value === "function"; typeof value === "function";
if (!isMutable) { if (!isMutable) {
// It evaluated to an immutable value, so we can hoist it. // 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 { default as assertNode } from "./asserts/assertNode";
export * from "./asserts/generated"; export * from "./asserts/generated";
//builders // builders
export { export { default as createTypeAnnotationBasedOnTypeof } from "./builders/flow/createTypeAnnotationBasedOnTypeof";
default as createTypeAnnotationBasedOnTypeof, export { default as createUnionTypeAnnotation } from "./builders/flow/createUnionTypeAnnotation";
} from "./builders/flow/createTypeAnnotationBasedOnTypeof";
export {
default as createUnionTypeAnnotation,
} from "./builders/flow/createUnionTypeAnnotation";
export * from "./builders/generated"; export * from "./builders/generated";
// clone // clone
@ -25,16 +21,10 @@ export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc";
// comments // comments
export { default as addComment } from "./comments/addComment"; export { default as addComment } from "./comments/addComment";
export { default as addComments } from "./comments/addComments"; export { default as addComments } from "./comments/addComments";
export { export { default as inheritInnerComments } from "./comments/inheritInnerComments";
default as inheritInnerComments, export { default as inheritLeadingComments } from "./comments/inheritLeadingComments";
} from "./comments/inheritInnerComments";
export {
default as inheritLeadingComments,
} from "./comments/inheritLeadingComments";
export { default as inheritsComments } from "./comments/inheritsComments"; export { default as inheritsComments } from "./comments/inheritsComments";
export { export { default as inheritTrailingComments } from "./comments/inheritTrailingComments";
default as inheritTrailingComments,
} from "./comments/inheritTrailingComments";
export { default as removeComments } from "./comments/removeComments"; export { default as removeComments } from "./comments/removeComments";
// constants // constants
@ -43,17 +33,13 @@ export * from "./constants";
// converters // converters
export { default as ensureBlock } from "./converters/ensureBlock"; export { default as ensureBlock } from "./converters/ensureBlock";
export { export { default as toBindingIdentifierName } from "./converters/toBindingIdentifierName";
default as toBindingIdentifierName,
} from "./converters/toBindingIdentifierName";
export { default as toBlock } from "./converters/toBlock"; export { default as toBlock } from "./converters/toBlock";
export { default as toComputedKey } from "./converters/toComputedKey"; export { default as toComputedKey } from "./converters/toComputedKey";
export { default as toExpression } from "./converters/toExpression"; export { default as toExpression } from "./converters/toExpression";
export { default as toIdentifier } from "./converters/toIdentifier"; export { default as toIdentifier } from "./converters/toIdentifier";
export { default as toKeyAlias } from "./converters/toKeyAlias"; export { default as toKeyAlias } from "./converters/toKeyAlias";
export { export { default as toSequenceExpression } from "./converters/toSequenceExpression";
default as toSequenceExpression,
} from "./converters/toSequenceExpression";
export { default as toStatement } from "./converters/toStatement"; export { default as toStatement } from "./converters/toStatement";
export { default as valueToNode } from "./converters/valueToNode"; export { default as valueToNode } from "./converters/valueToNode";
@ -61,28 +47,16 @@ export { default as valueToNode } from "./converters/valueToNode";
export * from "./definitions"; export * from "./definitions";
// modifications // modifications
export { export { default as appendToMemberExpression } from "./modifications/appendToMemberExpression";
default as appendToMemberExpression,
} from "./modifications/appendToMemberExpression";
export { default as inherits } from "./modifications/inherits"; export { default as inherits } from "./modifications/inherits";
export { export { default as prependToMemberExpression } from "./modifications/prependToMemberExpression";
default as prependToMemberExpression,
} from "./modifications/prependToMemberExpression";
export { default as removeProperties } from "./modifications/removeProperties"; export { default as removeProperties } from "./modifications/removeProperties";
export { export { default as removePropertiesDeep } from "./modifications/removePropertiesDeep";
default as removePropertiesDeep, export { default as removeTypeDuplicates } from "./modifications/flow/removeTypeDuplicates";
} from "./modifications/removePropertiesDeep";
export {
default as removeTypeDuplicates,
} from "./modifications/flow/removeTypeDuplicates";
// retrievers // retrievers
export { export { default as getBindingIdentifiers } from "./retrievers/getBindingIdentifiers";
default as getBindingIdentifiers, export { default as getOuterBindingIdentifiers } from "./retrievers/getOuterBindingIdentifiers";
} from "./retrievers/getBindingIdentifiers";
export {
default as getOuterBindingIdentifiers,
} from "./retrievers/getOuterBindingIdentifiers";
// traverse // traverse
export { default as traverse } from "./traverse/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 isScope } from "./validators/isScope";
export { default as isSpecifierDefault } from "./validators/isSpecifierDefault"; export { default as isSpecifierDefault } from "./validators/isSpecifierDefault";
export { default as isType } from "./validators/isType"; export { default as isType } from "./validators/isType";
export { export { default as isValidES3Identifier } from "./validators/isValidES3Identifier";
default as isValidES3Identifier,
} from "./validators/isValidES3Identifier";
export { default as isValidIdentifier } from "./validators/isValidIdentifier"; export { default as isValidIdentifier } from "./validators/isValidIdentifier";
export { default as isVar } from "./validators/isVar"; export { default as isVar } from "./validators/isVar";
export { default as matchesPattern } from "./validators/matchesPattern"; export { default as matchesPattern } from "./validators/matchesPattern";
export { default as validate } from "./validators/validate"; export { default as validate } from "./validators/validate";
export { export { default as buildMatchMemberExpression } from "./validators/buildMatchMemberExpression";
default as buildMatchMemberExpression,
} from "./validators/buildMatchMemberExpression";
export * from "./validators/generated"; export * from "./validators/generated";
// react // react

View File

@ -8724,10 +8724,10 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^1.17.1: prettier@^1.19.1:
version "1.18.2" version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
pretty-format@^24.9.0: pretty-format@^24.9.0:
version "24.9.0" version "24.9.0"