Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

ESLint throws: Cannot read property 'loc' of undefined #144

Closed
zaggino opened this issue Jan 14, 2017 · 2 comments
Closed

ESLint throws: Cannot read property 'loc' of undefined #144

zaggino opened this issue Jan 14, 2017 · 2 comments
Labels

Comments

@zaggino
Copy link

zaggino commented Jan 14, 2017

What version of TypeScript are you using? 2.1.5
What version of typescript-eslint-parser are you using? 1.0.2

Not sure which part of code is to blame but TypeScript & TSLint work fine on the code.

git clone https://github.com/zaggino/brackets-git
cd brackets-git
npm install
npm run eslint

fails with:

$ npm run eslint

> brackets-git@1.0.0 eslint D:\dev\test\brackets-git
> eslint . || true

Cannot read property 'loc' of undefined
TypeError: Cannot read property 'loc' of undefined
    at getNodeIndent (D:\dev\test\brackets-git\node_modules\eslint\lib\rules\indent.js:322:71)
    at EventEmitter.Program (D:\dev\test\brackets-git\node_modules\eslint\lib\rules\indent.js:974:49)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode (D:\dev\test\brackets-git\node_modules\eslint\lib\util\node-event-generator.js:39:22)
    at CodePathAnalyzer.enterNode (D:\dev\test\brackets-git\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:607:23)
    at CommentEventGenerator.enterNode (D:\dev\test\brackets-git\node_modules\eslint\lib\util\comment-event-generator.js:97:23)
    at Controller.enter (D:\dev\test\brackets-git\node_modules\eslint\lib\eslint.js:928:36)
    at Controller.__execute (D:\dev\test\brackets-git\node_modules\estraverse\estraverse.js:397:31)
    at Controller.traverse (D:\dev\test\brackets-git\node_modules\estraverse\estraverse.js:501:28)
@JamesHenry
Copy link
Member

Thanks for reporting, @zaggino!

This is down to the changes in JSDoc nodes in TypeScript 2.1.x

Handling this is the remaining action item for supporting TS 2.1.x in this parser #128 (comment)

If you roll back to some TypeScript 2.0.x version then the error should go away.

@zaggino
Copy link
Author

zaggino commented Jan 14, 2017

Or I can strip the JSDoc stuff, I actually had comments like this

/**
 * comment
 */

and changing to this also works

/*
 * comment
 */

Thanks for the pointer!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants