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

no-useless-constructor: class declaration with constructor throws exception #485

Closed
OliverJAsh opened this issue Jun 11, 2018 · 2 comments
Closed

Comments

@OliverJAsh
Copy link

What version of TypeScript are you using?
2.9.1

What version of typescript-eslint-parser are you using?
16.0.0

What code were you trying to parse?

// foo.ts
declare class Foo {
  constructor();
}

or

// foo.d.ts
class Foo {
  constructor();
}

What did you expect to happen?
No exception.

What happened?

TypeError: Cannot read property 'body' of null
    at checkForConstructor (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/rules/no-useless-constructor.js:167:41)
    at listeners.(anonymous function).forEach.listener (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (native)
    at Object.emit (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at Traverser.enter [as _enter] (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/linter.js:865:28)
    at Traverser._traverse (/Users/OliverJAsh/Development/unsplash-web/node_modules/eslint/lib/util/traverser.js:132:14)

Possibly related to #384?

@OliverJAsh OliverJAsh changed the title Class declaration with constructor throws exception no-useless-constructor: class declaration with constructor throws exception Jun 11, 2018
@YMZ1903
Copy link

YMZ1903 commented Nov 27, 2018

I have the same issue with typescript 3.1.1 and typescript-eslint-parser 21.0.1

@JamesHenry
Copy link
Member

This issue has been migrated to the new project here: typescript-eslint/typescript-eslint#15

Thanks!

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

No branches or pull requests

3 participants