New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Computed properties failing #2120
Comments
This is in the key-spacing rule. As a workaround, you should disable that rule. |
We will get this fixed soon. |
I think it gives this error on .eslintrc {
"env": {
"node": true
},
"ecmaFeatures": {
"objectLiteralComputedProperties": true
},
"rules": {
"key-spacing": [2, {
"beforeColon": false,
"afterColon": true
}]
}
} app.js var suffix = " name";
var person = {
["first" + suffix] : "Nicholas",
["last" + suffix]: "Zakas"
};
console.log(person["first name"]); // "Nicholas"
console.log(person["last name"]); // "Zakas" I would expect 1 error under this scenario. UPADTE: It throws error on So this tells us that there is potentially 2 problems. |
@gyandeeps what makes you think this is related to Node version? The problem is that we're expecting an identifier or string. |
@nzakas Yup, it throws error regardless of the node version. I did update my comment.
.eslintrc {
"env": {
"node": true
},
"ecmaFeatures": {
"objectLiteralComputedProperties": true
},
"rules": {
"key-spacing": [2, {
"beforeColon": false,
"afterColon": true
}]
}
} app.js var suffix = " name";
var person = {
["first" + suffix] : "Nicholas",
["last" + suffix]: "Zakas"
};
console.log(person["first name"]); // "Nicholas"
console.log(person["last name"]); // "Zakas" I would expect 1 error under this scenario. |
Yeah, we're just not handling computed properties at all, so everything is haywire. |
Working on this. |
Fix: key-spacing crash on computed properties (fixes #2120)
The text was updated successfully, but these errors were encountered: