Skip to content
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

TypeError for E012 - Cannot read property 'value' of undefined #3455

Closed
stvcisco opened this issue Mar 27, 2020 · 2 comments
Closed

TypeError for E012 - Cannot read property 'value' of undefined #3455

stvcisco opened this issue Mar 27, 2020 · 2 comments

Comments

@stvcisco
Copy link
Contributor

Will get a TypeError accessing undefined if you type the following Javascript code:

for (const)

The console shows this message:

/Users/user1/.atom/packages/linter/lib/linter-registry.js:154 [Linter] Error running JSHint Error: /Users/user1/.atom/packages/linter-jshint/node_modules/jshint/src/jshint.js:6534
        throw err;
        ^

TypeError: Cannot read property 'value' of undefined
    at Object.fud (/Users/user1/.atom/packages/linter-jshint/node_modules/jshint/src/jshint.js:5224)
stvcisco added a commit to stvcisco/jshint that referenced this issue Mar 27, 2020
Only issue error E012 if a variable name has been given in the for-loop
@stvcisco stvcisco mentioned this issue Mar 27, 2020
@jugglinmike
Copy link
Member

Crash confirmed, though the failure conditions are slightly different than reported (note the semicolon):

$ echo 'for(const;)' | ./bin/jshint -
./src/jshint.js:6534
        throw err;
        ^

TypeError: Cannot read property 'value' of undefined

@stvcisco
Copy link
Contributor Author

interesting - I didn't need the semicolon to see the crash within the Atom editor (using linter-jshint), but either way it's a crash.

stvcisco pushed a commit to stvcisco/jshint that referenced this issue Mar 29, 2020
jugglinmike pushed a commit to jugglinmike/jshint that referenced this issue May 4, 2020
Make sure that 'decl.first[0]' is defined before accessing its 'value'
attribute.

No breaking changes.

Fixes jshint#3455
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants