Require semicolons before class props named 'in' or 'instanceof' (#1878)
parent
78b99329bf
commit
4915e0228e
|
@ -4591,6 +4591,10 @@ function classChildNeedsASIProtection(node) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!node.computed) {
|
||||||
|
const name = node.key && node.key.name;
|
||||||
|
if (name === "in" || name === "instanceof") return true;
|
||||||
|
}
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
case "ClassProperty":
|
case "ClassProperty":
|
||||||
case "TSAbstractClassProperty":
|
case "TSAbstractClassProperty":
|
||||||
|
|
|
@ -3,17 +3,53 @@
|
||||||
exports[`no-semi.js 1`] = `
|
exports[`no-semi.js 1`] = `
|
||||||
a
|
a
|
||||||
;::b.c
|
;::b.c
|
||||||
|
|
||||||
|
class A {
|
||||||
|
a = b;
|
||||||
|
in
|
||||||
|
c
|
||||||
|
|
||||||
|
a = b;
|
||||||
|
instanceof(){}
|
||||||
|
}
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
a;
|
a;
|
||||||
::b.c;
|
::b.c;
|
||||||
|
|
||||||
|
class A {
|
||||||
|
a = b;
|
||||||
|
in;
|
||||||
|
c;
|
||||||
|
|
||||||
|
a = b;
|
||||||
|
instanceof() {}
|
||||||
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`no-semi.js 2`] = `
|
exports[`no-semi.js 2`] = `
|
||||||
a
|
a
|
||||||
;::b.c
|
;::b.c
|
||||||
|
|
||||||
|
class A {
|
||||||
|
a = b;
|
||||||
|
in
|
||||||
|
c
|
||||||
|
|
||||||
|
a = b;
|
||||||
|
instanceof(){}
|
||||||
|
}
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
a
|
a
|
||||||
;::b.c
|
;::b.c
|
||||||
|
|
||||||
|
class A {
|
||||||
|
a = b;
|
||||||
|
in
|
||||||
|
c
|
||||||
|
|
||||||
|
a = b;
|
||||||
|
instanceof() {}
|
||||||
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1,2 +1,11 @@
|
||||||
a
|
a
|
||||||
;::b.c
|
;::b.c
|
||||||
|
|
||||||
|
class A {
|
||||||
|
a = b;
|
||||||
|
in
|
||||||
|
c
|
||||||
|
|
||||||
|
a = b;
|
||||||
|
instanceof(){}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue