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

Type Casting appears to consistently cause errors #20

Closed
low-ghost opened this issue Mar 4, 2016 · 3 comments
Closed

Type Casting appears to consistently cause errors #20

low-ghost opened this issue Mar 4, 2016 · 3 comments
Labels

Comments

@low-ghost
Copy link

I'm using eslint 2.2 and this repo from master. It seems like several rules thow errors due to type casting.

For instance this code:

<any>sinon.stub()

results in this stack trace:

...some removed things.../node_modules/eslint/lib/rules/key-spacing.js:242
            property.key.range[1], property.value.range[0]
                                                 ^

TypeError: Cannot read property 'range' of null
    at getPropertyWhitespace (...some removed things.../node_modules/eslint/lib/rules/key-spacing.js:242:50)
    at verifySpacing (...some removed things.../node_modules/eslint/lib/rules/key-spacing.js:333:22)
    at EventEmitter.Property (...some removed things.../node_modules/eslint/lib/rules/key-spacing.js:373:17)
    at emitOne (events.js:95:20)
    at EventEmitter.emit (events.js:182:7)
    at NodeEventGenerator.enterNode (...some removed things.../node_modules/eslint/lib/util/node-event-generator.js:42:22)
    at CodePathAnalyzer.enterNode (...some removed things.../node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:591:23)
    at CommentEventGenerator.enterNode (...some removed things.../node_modules/eslint/lib/util/comment-event-generator.js:98:23)
    at Controller.controller.traverse.enter (...some removed things.../node_modules/eslint/lib/eslint.js:839:36)
    at Controller.__execute (...some removed things.../node_modules/eslint/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (...some removed things.../node_modules/eslint/node_modules/estraverse/estraverse.js:495:28)

while removing the casting (and jumping through a few typescript hoops) allows the linter to execute and report normal errors. Can give more info if it'd be helpful. Thanks!

@low-ghost
Copy link
Author

on other occasions, different rules have thrown, presumably before this one and due to an underlying problem with the AST.

@nzakas
Copy link
Member

nzakas commented Mar 5, 2016

Type casting is not yet supported by this parser, so this is expected.

@nzakas
Copy link
Member

nzakas commented Mar 5, 2016

Please see #13 for the development plan.

@nzakas nzakas closed this as completed Mar 5, 2016
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