Bump prettier (#6991)
This commit is contained in:
parent
d6db5fb1e1
commit
c7980b2b90
@ -51,7 +51,7 @@
|
||||
"mocha": "^3.0.0",
|
||||
"nyc": "^11.0.3",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"prettier": "1.7.3",
|
||||
"prettier": "1.9.1",
|
||||
"pump": "^1.0.2",
|
||||
"rimraf": "^2.4.3",
|
||||
"semver": "^5.0.0",
|
||||
|
||||
@ -88,7 +88,9 @@ class ConfigChainBuilder {
|
||||
mergeConfigFile(file: ConfigFile, envName: string) {
|
||||
if (this.seenFiles.has(file)) {
|
||||
throw new Error(
|
||||
`Cycle detected in Babel configuration file through "${file.filepath}".`,
|
||||
`Cycle detected in Babel configuration file through "${
|
||||
file.filepath
|
||||
}".`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -191,9 +191,9 @@ function assertPluginTarget(
|
||||
typeof value !== "function"
|
||||
) {
|
||||
throw new Error(
|
||||
`.${key}[${index}]${inArray
|
||||
? `[0]`
|
||||
: ""} must be a string, object, function`,
|
||||
`.${key}[${index}]${
|
||||
inArray ? `[0]` : ""
|
||||
} must be a string, object, function`,
|
||||
);
|
||||
}
|
||||
return value;
|
||||
|
||||
@ -164,7 +164,9 @@ export default function get(entryLoc): Array<Suite> {
|
||||
|
||||
if (minimumVersion == null) {
|
||||
throw new Error(
|
||||
`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`,
|
||||
`'minNodeVersion' has invalid semver format: ${
|
||||
taskOpts.minNodeVersion
|
||||
}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -25,16 +25,16 @@ export default function(api, options) {
|
||||
let moduleName = this.getModuleName();
|
||||
if (moduleName) moduleName = t.stringLiteral(moduleName);
|
||||
|
||||
const {
|
||||
meta,
|
||||
headers,
|
||||
} = rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop,
|
||||
});
|
||||
const { meta, headers } = rewriteModuleStatementsAndPrepareHeader(
|
||||
path,
|
||||
{
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop,
|
||||
},
|
||||
);
|
||||
|
||||
const amdArgs = [];
|
||||
const importNames = [];
|
||||
|
||||
@ -113,17 +113,17 @@ export default function(api, options) {
|
||||
let moduleName = this.getModuleName();
|
||||
if (moduleName) moduleName = t.stringLiteral(moduleName);
|
||||
|
||||
const {
|
||||
meta,
|
||||
headers,
|
||||
} = rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
exportName: "exports",
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop,
|
||||
});
|
||||
const { meta, headers } = rewriteModuleStatementsAndPrepareHeader(
|
||||
path,
|
||||
{
|
||||
exportName: "exports",
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop,
|
||||
},
|
||||
);
|
||||
|
||||
for (const [source, metadata] of meta.source) {
|
||||
const loadExpr = t.callExpression(t.identifier("require"), [
|
||||
|
||||
@ -130,16 +130,16 @@ export default function(api, options) {
|
||||
let moduleName = this.getModuleName();
|
||||
if (moduleName) moduleName = t.stringLiteral(moduleName);
|
||||
|
||||
const {
|
||||
meta,
|
||||
headers,
|
||||
} = rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop,
|
||||
});
|
||||
const { meta, headers } = rewriteModuleStatementsAndPrepareHeader(
|
||||
path,
|
||||
{
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop,
|
||||
},
|
||||
);
|
||||
|
||||
const amdArgs = [];
|
||||
const commonjsArgs = [];
|
||||
|
||||
@ -54,16 +54,15 @@ const byTestSuite = suite => browser => {
|
||||
: true;
|
||||
};
|
||||
|
||||
const compatSources = [
|
||||
"es6",
|
||||
"es2016plus",
|
||||
"esnext",
|
||||
].reduce((result, source) => {
|
||||
const data = require(`compat-table/data-${source}`);
|
||||
data.browsers = pickBy(envs, byTestSuite(source));
|
||||
result.push(data);
|
||||
return result;
|
||||
}, []);
|
||||
const compatSources = ["es6", "es2016plus", "esnext"].reduce(
|
||||
(result, source) => {
|
||||
const data = require(`compat-table/data-${source}`);
|
||||
data.browsers = pickBy(envs, byTestSuite(source));
|
||||
result.push(data);
|
||||
return result;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const interpolateAllResults = (rawBrowsers, tests) => {
|
||||
const interpolateResults = res => {
|
||||
|
||||
@ -56,36 +56,36 @@ export const isPluginRequired = (
|
||||
return true;
|
||||
}
|
||||
|
||||
const isRequiredForEnvironments: Array<
|
||||
string,
|
||||
> = targetEnvironments.filter(environment => {
|
||||
// Feature is not implemented in that environment
|
||||
if (!plugin[environment]) {
|
||||
return true;
|
||||
}
|
||||
const isRequiredForEnvironments: Array<string> = targetEnvironments.filter(
|
||||
environment => {
|
||||
// Feature is not implemented in that environment
|
||||
if (!plugin[environment]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const lowestImplementedVersion: string = plugin[environment];
|
||||
const lowestTargetedVersion: string = supportedEnvironments[environment];
|
||||
// If targets has unreleased value as a lowest version, then don't require a plugin.
|
||||
if (isUnreleasedVersion(lowestTargetedVersion, environment)) {
|
||||
return false;
|
||||
// Include plugin if it is supported in the unreleased environment, which wasn't specified in targets
|
||||
} else if (isUnreleasedVersion(lowestImplementedVersion, environment)) {
|
||||
return true;
|
||||
}
|
||||
const lowestImplementedVersion: string = plugin[environment];
|
||||
const lowestTargetedVersion: string = supportedEnvironments[environment];
|
||||
// If targets has unreleased value as a lowest version, then don't require a plugin.
|
||||
if (isUnreleasedVersion(lowestTargetedVersion, environment)) {
|
||||
return false;
|
||||
// Include plugin if it is supported in the unreleased environment, which wasn't specified in targets
|
||||
} else if (isUnreleasedVersion(lowestImplementedVersion, environment)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!semver.valid(lowestTargetedVersion)) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line max-len
|
||||
`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`,
|
||||
if (!semver.valid(lowestTargetedVersion)) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line max-len
|
||||
`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`,
|
||||
);
|
||||
}
|
||||
|
||||
return semver.gt(
|
||||
semverify(lowestImplementedVersion),
|
||||
lowestTargetedVersion,
|
||||
);
|
||||
}
|
||||
|
||||
return semver.gt(
|
||||
semverify(lowestImplementedVersion),
|
||||
lowestTargetedVersion,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
return isRequiredForEnvironments.length > 0;
|
||||
};
|
||||
|
||||
@ -37,20 +37,20 @@ export const statements: Formatter<
|
||||
Array<BabelNodeStatement>,
|
||||
> = makeStatementFormatter(body => body);
|
||||
|
||||
export const statement: Formatter<
|
||||
BabelNodeStatement,
|
||||
> = makeStatementFormatter(body => {
|
||||
// We do this validation when unwrapping since the replacement process
|
||||
// could have added or removed statements.
|
||||
if (body.length === 0) {
|
||||
throw new Error("Found nothing to return.");
|
||||
}
|
||||
if (body.length > 1) {
|
||||
throw new Error("Found multiple statements but wanted one");
|
||||
}
|
||||
export const statement: Formatter<BabelNodeStatement> = makeStatementFormatter(
|
||||
body => {
|
||||
// We do this validation when unwrapping since the replacement process
|
||||
// could have added or removed statements.
|
||||
if (body.length === 0) {
|
||||
throw new Error("Found nothing to return.");
|
||||
}
|
||||
if (body.length > 1) {
|
||||
throw new Error("Found multiple statements but wanted one");
|
||||
}
|
||||
|
||||
return body[0];
|
||||
});
|
||||
return body[0];
|
||||
},
|
||||
);
|
||||
|
||||
export const expression: Formatter<BabelNodeExpression> = {
|
||||
code: str => `(\n${str}\n)`,
|
||||
|
||||
@ -38,7 +38,9 @@ export default function populatePlaceholders(
|
||||
(replacements && replacements[placeholder.name]) || null,
|
||||
);
|
||||
} catch (e) {
|
||||
e.message = `babel-template placeholder "${placeholder.name}": ${e.message}`;
|
||||
e.message = `babel-template placeholder "${placeholder.name}": ${
|
||||
e.message
|
||||
}`;
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
@ -24,7 +24,9 @@ export default function traverse(
|
||||
if (parent.type !== "Program" && parent.type !== "File") {
|
||||
throw new Error(
|
||||
"You must pass a scope and parentPath unless traversing a Program/File. " +
|
||||
`Instead of that you tried to traverse a ${parent.type} node without ` +
|
||||
`Instead of that you tried to traverse a ${
|
||||
parent.type
|
||||
} node without ` +
|
||||
"passing scope and parentPath.",
|
||||
);
|
||||
}
|
||||
|
||||
@ -8,7 +8,9 @@ export default function builder(type: string, ...args: Array<any>): Object {
|
||||
const countArgs = args.length;
|
||||
if (countArgs > keys.length) {
|
||||
throw new Error(
|
||||
`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`,
|
||||
`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${
|
||||
keys.length
|
||||
}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -61,9 +61,10 @@ export function assertNodeType(...types: Array<string>): Function {
|
||||
|
||||
if (!valid) {
|
||||
throw new TypeError(
|
||||
`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(
|
||||
types,
|
||||
)} ` + `but instead got ${JSON.stringify(val && val.type)}`,
|
||||
`Property ${key} of ${
|
||||
node.type
|
||||
} expected node to be of a type ${JSON.stringify(types)} ` +
|
||||
`but instead got ${JSON.stringify(val && val.type)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -86,9 +87,10 @@ export function assertNodeOrValueType(...types: Array<string>): Function {
|
||||
|
||||
if (!valid) {
|
||||
throw new TypeError(
|
||||
`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(
|
||||
types,
|
||||
)} ` + `but instead got ${JSON.stringify(val && val.type)}`,
|
||||
`Property ${key} of ${
|
||||
node.type
|
||||
} expected node to be of a type ${JSON.stringify(types)} ` +
|
||||
`but instead got ${JSON.stringify(val && val.type)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -885,7 +885,9 @@ export default class ExpressionParser extends LValParser {
|
||||
if (node.property.name !== propertyName) {
|
||||
this.raise(
|
||||
node.property.start,
|
||||
`The only valid meta property for ${meta.name} is ${meta.name}.${propertyName}`,
|
||||
`The only valid meta property for ${meta.name} is ${
|
||||
meta.name
|
||||
}.${propertyName}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -151,9 +151,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
}
|
||||
|
||||
/**
|
||||
* If !expectSuccess, returns undefined instead of failing to parse.
|
||||
* If expectSuccess, parseElement should always return a defined value.
|
||||
*/
|
||||
* If !expectSuccess, returns undefined instead of failing to parse.
|
||||
* If expectSuccess, parseElement should always return a defined value.
|
||||
*/
|
||||
tsParseDelimitedListWorker<T: N.Node>(
|
||||
kind: ParsingContext,
|
||||
parseElement: () => ?T,
|
||||
|
||||
@ -124,9 +124,9 @@ for (const type in t.NODE_FIELDS) {
|
||||
}
|
||||
|
||||
for (let i = 0; i < t.TYPES.length; i++) {
|
||||
let decl = `declare function is${t.TYPES[
|
||||
i
|
||||
]}(node: Object, opts?: ?Object): boolean`;
|
||||
let decl = `declare function is${
|
||||
t.TYPES[i]
|
||||
}(node: Object, opts?: ?Object): boolean`;
|
||||
|
||||
if (t.NODE_FIELDS[t.TYPES[i]]) {
|
||||
decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`;
|
||||
|
||||
@ -5059,9 +5059,9 @@ preserve@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||
|
||||
prettier@1.7.3:
|
||||
version "1.7.3"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.3.tgz#8e6974725273914b1c47439959dd3d3ba53664b6"
|
||||
prettier@1.9.1:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.9.1.tgz#41638a0d47c1efbd1b7d5a742aaa5548eab86d70"
|
||||
|
||||
pretty-format@^21.2.1:
|
||||
version "21.2.1"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user