Skip to content

[eslint] no-extra-semi rule crashes on class declaration #9

Open

Description

@wcjohnson

The following code crashes the no-extra-semi rule:

EntityStore(identify, equalityTest) ->
  class z extends ReduxComponent:
    constructor() -> super()

with the following stacktrace:

Cannot read property 'type' of null
TypeError: Cannot read property 'type' of null
    at checkForPartOfClassBody (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/rules/no-extra-semi.js:63:22)
    at EventEmitter.MethodDefinition (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/rules/no-extra-semi.js:112:17)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.applySelector (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/util/node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/util/node-event-generator.js:308:14)
    at CodePathAnalyzer.enterNode (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:602:23)
    at CommentEventGenerator.enterNode (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/util/comment-event-generator.js:98:23)
    at Traverser.enter (/Users/wcj/dev/node_modules/lightscript-eslint/node_modules/eslint/lib/eslint.js:928:36)

Disabling the rule bypasses the problem.

Activity

  1. rattrayalex commented on Mar 26, 2017

    @rattrayalex
    Contributor

    I saw this as well. Using curly braces instead of : for the class declaration dodges the bug too. Problem is it's looking for a closing } in the tokens list. Will probably require monkeypatching. Not sure how to tell it "you're not in a class anymore" based purely on tokens though...

  2. changed the title [-]`lightscript-eslint`: `no-extra-semi` rule crashes on class declaration[/-] [+][eslint] `no-extra-semi` rule crashes on class declaration[/+] on Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions