Skip to content

Commit

Permalink
Bump prettier@2.2.1 (#12633)
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism committed Jan 14, 2021
1 parent 6e9a174 commit fec4a13
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"lint-staged": "^9.2.0",
"lodash": "^4.17.20",
"mergeiterator": "^1.2.5",
"prettier": "^2.0.5",
"prettier": "^2.2.1",
"rollup": "^2.26.5",
"rollup-plugin-dts": "^2.0.0",
"rollup-plugin-node-polyfills": "^0.2.1",
Expand Down
21 changes: 11 additions & 10 deletions packages/babel-core/test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,17 @@ describe("api", function () {
babelrc: false,
};
Object.freeze(options);
transformFile(__dirname + "/fixtures/api/file.js", options, function (
err,
res,
) {
if (err) return done(err);
expect(res.code).toBe("foo();");
// keep user options untouched
expect(options).toEqual({ babelrc: false });
done();
});
transformFile(
__dirname + "/fixtures/api/file.js",
options,
function (err, res) {
if (err) return done(err);
expect(res.code).toBe("foo();");
// keep user options untouched
expect(options).toEqual({ babelrc: false });
done();
},
);
});

it("transformFileSync", function () {
Expand Down
57 changes: 28 additions & 29 deletions packages/babel-traverse/src/path/ancestry.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,43 +78,42 @@ export function getStatementParent(): NodePath {
export function getEarliestCommonAncestorFrom(
paths: Array<NodePath>,
): NodePath {
return this.getDeepestCommonAncestorFrom(paths, function (
deepest,
i,
ancestries,
) {
let earliest;
const keys = t.VISITOR_KEYS[deepest.type];
return this.getDeepestCommonAncestorFrom(
paths,
function (deepest, i, ancestries) {
let earliest;
const keys = t.VISITOR_KEYS[deepest.type];

for (const ancestry of (ancestries: Array)) {
const path = ancestry[i + 1];

// first path
if (!earliest) {
earliest = path;
continue;
}
for (const ancestry of (ancestries: Array)) {
const path = ancestry[i + 1];

// 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) {
// first path
if (!earliest) {
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 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;
}
}
}

return earliest;
});
return earliest;
},
);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4857,7 +4857,7 @@ __metadata:
lint-staged: ^9.2.0
lodash: ^4.17.20
mergeiterator: ^1.2.5
prettier: ^2.0.5
prettier: ^2.2.1
rollup: ^2.26.5
rollup-plugin-dts: ^2.0.0
rollup-plugin-node-polyfills: ^0.2.1
Expand Down Expand Up @@ -10860,12 +10860,12 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"prettier@npm:^2.0.5":
version: 2.0.5
resolution: "prettier@npm:2.0.5"
"prettier@npm:^2.2.1":
version: 2.2.1
resolution: "prettier@npm:2.2.1"
bin:
prettier: bin-prettier.js
checksum: d249d89361870a29b20e8b268cb09e908490b8c9e21f70393d12a213701f29ba7e95b7f9ce0ad63929c16ce475176742481911737ae3da4a498873e4a3b90990
checksum: 92c6c9f4b87eba1f28466edee57dd18c80d00b858edda77d46d1950d20e6e302b68ee255fc91133ba931e63c4577b5ae30da194d9626a8f3c0177778b91bf056
languageName: node
linkType: hard

Expand Down

0 comments on commit fec4a13

Please sign in to comment.