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
ES6 modules: TypeError: Cannot read property 'type' of undefined #2042
Comments
Stack trace for Stack trace for |
I'm seeing the |
@benmosher one big report per issue, please. |
Working on this. |
The
{
"env": {
"es6": true
},
"ecmaFeatures": {
"modules": true
},
"rules": {
"no-undef": 2,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
}
} // test.js
import foo from 'foo'; $ eslint --reset --no-eslintrc -c config.json test.js
~/code/eslint/eslint/lib/rules/no-unused-vars.js:43
if (definition.type === "VariableDeclarator") {
^
TypeError: Cannot read property 'type' of undefined
at isExported (~/code/eslint/eslint/lib/rules/no-unused-vars.js:43:27)
at EventEmitter.Program:exit (~/code/eslint/eslint/lib/rules/no-unused-vars.js:120:70)
at EventEmitter.emit (events.js:129:20)
at Controller.controller.traverse.leave (~/code/eslint/eslint/lib/eslint.js:743:25)
at Controller.__execute (~/code/eslint/eslint/node_modules/estraverse/estraverse.js:393:31)
at Controller.traverse (~/code/eslint/eslint/node_modules/estraverse/estraverse.js:481:28)
at EventEmitter.module.exports.api.verify (~/code/eslint/eslint/lib/eslint.js:728:24)
at processFile (~/code/eslint/eslint/lib/cli-engine.js:193:27)
at ~/code/eslint/eslint/lib/cli-engine.js:293:26
at walk (~/code/eslint/eslint/lib/util/traverse.js:81:9) Removing either of the rules from |
The |
Fix: no-unused-vars crash from escope workaround (fixes #2042)
Thanks! I've tested this change with 0.17.1 and it's now working as expected 👍 |
I am also not seeing a crash anymore, but (I thought about opening a new issue, but I'm not clear on whether this is understood behavior.) FWIW: updating to escope 2.0.7 does seem to fix it, but breaks the "Edge cases should not crash when parsing destructured assignment" test. |
Please file a new issue and provide sample code plus console output. |
Done: #2114 |
Hi.
I'm using 0.17.0, and I have the following code in a file
test.js
:I have the following eslint config:
When running eslint on that file I get the following error:
TypeError: Cannot read property 'type' of undefined
Exporting or referencing that object fixes the error:
Setting a property now causes a different error
TypeError: Cannot read property 'name' of undefined
:Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: