Require semicolons before class props named 'in' or 'instanceof' (#1878)

This commit is contained in:
Kevin Gibbons authored and Christopher Chedeau committed 2017-06-02 10:52:11 -07:00
1 parent 78b99329bf
commit 4915e0228e
3 files changed
+49

No files matched your search

+4
View File
@@ -4591,6 +4591,10 @@ function classChildNeedsASIProtection(node) {
return;
}
if (!node.computed) {
const name = node.key && node.key.name;
if (name === "in" || name === "instanceof") return true;
}
switch (node.type) {
case "ClassProperty":
case "TSAbstractClassProperty":
@@ -3,17 +3,53 @@
exports[`no-semi.js 1`] = `
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof(){}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a;
::b.c;
class A {
a = b;
in;
c;
a = b;
instanceof() {}
}
`;
exports[`no-semi.js 2`] = `
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof(){}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof() {}
}
`;
@@ -1,2 +1,11 @@
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof(){}
}