Support private properties in no-invalid-this (babel/eslint-plugin-babel#183)
* add failing test * support ClassPrivateProperty
This commit is contained in:
parent
693fa1aa0d
commit
f3e2752df3
@ -11,7 +11,8 @@ module.exports = ruleComposer.filterReports(
|
||||
let node = problem.node;
|
||||
|
||||
while (node) {
|
||||
if (node.type === "ClassProperty") {
|
||||
if (node.type === "ClassProperty" ||
|
||||
node.type === "ClassPrivateProperty") {
|
||||
inClassProperty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -602,6 +602,21 @@ const patterns = [
|
||||
valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES],
|
||||
invalid: []
|
||||
},
|
||||
|
||||
// Class Private Instance Properties.
|
||||
{
|
||||
code: "class A {#a = this.b;};",
|
||||
parserOptions: { ecmaVersion: 6 },
|
||||
valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES],
|
||||
invalid: []
|
||||
},
|
||||
|
||||
{
|
||||
code: "class A {#a = () => {return this.b;};};",
|
||||
parserOptions: { ecmaVersion: 6 },
|
||||
valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES],
|
||||
invalid: []
|
||||
},
|
||||
];
|
||||
|
||||
const ruleTester = new RuleTester();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user