Bump prettier@2.2.1 (#12633)

This commit is contained in:
Brian Ng 2021-01-14 13:10:47 -06:00 committed by GitHub
parent 6e9a174e7f
commit fec4a132ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 46 deletions

View File

@ -58,7 +58,7 @@
"lint-staged": "^9.2.0", "lint-staged": "^9.2.0",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"mergeiterator": "^1.2.5", "mergeiterator": "^1.2.5",
"prettier": "^2.0.5", "prettier": "^2.2.1",
"rollup": "^2.26.5", "rollup": "^2.26.5",
"rollup-plugin-dts": "^2.0.0", "rollup-plugin-dts": "^2.0.0",
"rollup-plugin-node-polyfills": "^0.2.1", "rollup-plugin-node-polyfills": "^0.2.1",

View File

@ -167,16 +167,17 @@ describe("api", function () {
babelrc: false, babelrc: false,
}; };
Object.freeze(options); Object.freeze(options);
transformFile(__dirname + "/fixtures/api/file.js", options, function ( transformFile(
err, __dirname + "/fixtures/api/file.js",
res, options,
) { function (err, res) {
if (err) return done(err); if (err) return done(err);
expect(res.code).toBe("foo();"); expect(res.code).toBe("foo();");
// keep user options untouched // keep user options untouched
expect(options).toEqual({ babelrc: false }); expect(options).toEqual({ babelrc: false });
done(); done();
}); },
);
}); });
it("transformFileSync", function () { it("transformFileSync", function () {

View File

@ -78,43 +78,42 @@ export function getStatementParent(): NodePath {
export function getEarliestCommonAncestorFrom( export function getEarliestCommonAncestorFrom(
paths: Array<NodePath>, paths: Array<NodePath>,
): NodePath { ): NodePath {
return this.getDeepestCommonAncestorFrom(paths, function ( return this.getDeepestCommonAncestorFrom(
deepest, paths,
i, function (deepest, i, ancestries) {
ancestries, let earliest;
) { const keys = t.VISITOR_KEYS[deepest.type];
let earliest;
const keys = t.VISITOR_KEYS[deepest.type];
for (const ancestry of (ancestries: Array)) { for (const ancestry of (ancestries: Array)) {
const path = ancestry[i + 1]; const path = ancestry[i + 1];
// first path // first path
if (!earliest) { if (!earliest) {
earliest = path;
continue;
}
// handle containers
if (path.listKey && earliest.listKey === path.listKey) {
// we're in the same container so check if we're earlier
if (path.key < earliest.key) {
earliest = path; earliest = path;
continue; continue;
} }
// handle containers
if (path.listKey && earliest.listKey === path.listKey) {
// we're in the same container so check if we're earlier
if (path.key < earliest.key) {
earliest = path;
continue;
}
}
// handle keys
const earliestKeyIndex = keys.indexOf(earliest.parentKey);
const currentKeyIndex = keys.indexOf(path.parentKey);
if (earliestKeyIndex > currentKeyIndex) {
// key appears before so it's earlier
earliest = path;
}
} }
// handle keys return earliest;
const earliestKeyIndex = keys.indexOf(earliest.parentKey); },
const currentKeyIndex = keys.indexOf(path.parentKey); );
if (earliestKeyIndex > currentKeyIndex) {
// key appears before so it's earlier
earliest = path;
}
}
return earliest;
});
} }
/** /**

View File

@ -4857,7 +4857,7 @@ __metadata:
lint-staged: ^9.2.0 lint-staged: ^9.2.0
lodash: ^4.17.20 lodash: ^4.17.20
mergeiterator: ^1.2.5 mergeiterator: ^1.2.5
prettier: ^2.0.5 prettier: ^2.2.1
rollup: ^2.26.5 rollup: ^2.26.5
rollup-plugin-dts: ^2.0.0 rollup-plugin-dts: ^2.0.0
rollup-plugin-node-polyfills: ^0.2.1 rollup-plugin-node-polyfills: ^0.2.1
@ -10860,12 +10860,12 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"prettier@npm:^2.0.5": "prettier@npm:^2.2.1":
version: 2.0.5 version: 2.2.1
resolution: "prettier@npm:2.0.5" resolution: "prettier@npm:2.2.1"
bin: bin:
prettier: bin-prettier.js prettier: bin-prettier.js
checksum: d249d89361870a29b20e8b268cb09e908490b8c9e21f70393d12a213701f29ba7e95b7f9ce0ad63929c16ce475176742481911737ae3da4a498873e4a3b90990 checksum: 92c6c9f4b87eba1f28466edee57dd18c80d00b858edda77d46d1950d20e6e302b68ee255fc91133ba931e63c4577b5ae30da194d9626a8f3c0177778b91bf056
languageName: node languageName: node
linkType: hard linkType: hard