Skip to content

Commit fec4a13

Browse files
1 parent 6e9a174 commit fec4a13

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"lint-staged": "^9.2.0",
5959
"lodash": "^4.17.20",
6060
"mergeiterator": "^1.2.5",
61-
"prettier": "^2.0.5",
61+
"prettier": "^2.2.1",
6262
"rollup": "^2.26.5",
6363
"rollup-plugin-dts": "^2.0.0",
6464
"rollup-plugin-node-polyfills": "^0.2.1",

packages/babel-core/test/api.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,17 @@ describe("api", function () {
167167
babelrc: false,
168168
};
169169
Object.freeze(options);
170-
transformFile(__dirname + "/fixtures/api/file.js", options, function (
171-
err,
172-
res,
173-
) {
174-
if (err) return done(err);
175-
expect(res.code).toBe("foo();");
176-
// keep user options untouched
177-
expect(options).toEqual({ babelrc: false });
178-
done();
179-
});
170+
transformFile(
171+
__dirname + "/fixtures/api/file.js",
172+
options,
173+
function (err, res) {
174+
if (err) return done(err);
175+
expect(res.code).toBe("foo();");
176+
// keep user options untouched
177+
expect(options).toEqual({ babelrc: false });
178+
done();
179+
},
180+
);
180181
});
181182

182183
it("transformFileSync", function () {

packages/babel-traverse/src/path/ancestry.js

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -78,43 +78,42 @@ export function getStatementParent(): NodePath {
7878
export function getEarliestCommonAncestorFrom(
7979
paths: Array<NodePath>,
8080
): NodePath {
81-
return this.getDeepestCommonAncestorFrom(paths, function (
82-
deepest,
83-
i,
84-
ancestries,
85-
) {
86-
let earliest;
87-
const keys = t.VISITOR_KEYS[deepest.type];
81+
return this.getDeepestCommonAncestorFrom(
82+
paths,
83+
function (deepest, i, ancestries) {
84+
let earliest;
85+
const keys = t.VISITOR_KEYS[deepest.type];
8886

89-
for (const ancestry of (ancestries: Array)) {
90-
const path = ancestry[i + 1];
91-
92-
// first path
93-
if (!earliest) {
94-
earliest = path;
95-
continue;
96-
}
87+
for (const ancestry of (ancestries: Array)) {
88+
const path = ancestry[i + 1];
9789

98-
// handle containers
99-
if (path.listKey && earliest.listKey === path.listKey) {
100-
// we're in the same container so check if we're earlier
101-
if (path.key < earliest.key) {
90+
// first path
91+
if (!earliest) {
10292
earliest = path;
10393
continue;
10494
}
105-
}
10695

107-
// handle keys
108-
const earliestKeyIndex = keys.indexOf(earliest.parentKey);
109-
const currentKeyIndex = keys.indexOf(path.parentKey);
110-
if (earliestKeyIndex > currentKeyIndex) {
111-
// key appears before so it's earlier
112-
earliest = path;
96+
// handle containers
97+
if (path.listKey && earliest.listKey === path.listKey) {
98+
// we're in the same container so check if we're earlier
99+
if (path.key < earliest.key) {
100+
earliest = path;
101+
continue;
102+
}
103+
}
104+
105+
// handle keys
106+
const earliestKeyIndex = keys.indexOf(earliest.parentKey);
107+
const currentKeyIndex = keys.indexOf(path.parentKey);
108+
if (earliestKeyIndex > currentKeyIndex) {
109+
// key appears before so it's earlier
110+
earliest = path;
111+
}
113112
}
114-
}
115113

116-
return earliest;
117-
});
114+
return earliest;
115+
},
116+
);
118117
}
119118

120119
/**

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4857,7 +4857,7 @@ __metadata:
48574857
lint-staged: ^9.2.0
48584858
lodash: ^4.17.20
48594859
mergeiterator: ^1.2.5
4860-
prettier: ^2.0.5
4860+
prettier: ^2.2.1
48614861
rollup: ^2.26.5
48624862
rollup-plugin-dts: ^2.0.0
48634863
rollup-plugin-node-polyfills: ^0.2.1
@@ -10860,12 +10860,12 @@ fsevents@^1.2.7:
1086010860
languageName: node
1086110861
linkType: hard
1086210862

10863-
"prettier@npm:^2.0.5":
10864-
version: 2.0.5
10865-
resolution: "prettier@npm:2.0.5"
10863+
"prettier@npm:^2.2.1":
10864+
version: 2.2.1
10865+
resolution: "prettier@npm:2.2.1"
1086610866
bin:
1086710867
prettier: bin-prettier.js
10868-
checksum: d249d89361870a29b20e8b268cb09e908490b8c9e21f70393d12a213701f29ba7e95b7f9ce0ad63929c16ce475176742481911737ae3da4a498873e4a3b90990
10868+
checksum: 92c6c9f4b87eba1f28466edee57dd18c80d00b858edda77d46d1950d20e6e302b68ee255fc91133ba931e63c4577b5ae30da194d9626a8f3c0177778b91bf056
1086910869
languageName: node
1087010870
linkType: hard
1087110871

0 commit comments

Comments
 (0)