Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
This seems to be the same issue as#15.
What code were you trying to parse?
// src/foo.tsclassFoo{constructor();constructor(obj:any);constructor(obj?:any){console.log(obj);}}
This also happens with both examples from the other issue,
declareclassFoo{constructor();}
and
classFoo{constructor();}
When the ESLintno-useless-constructor
rule is disabled, the issue doesn't show.
What did you expect to happen?
ESLint sees the code as correct.
What actually happened?
ESLint gives an error, because the body of some constructors can't be found.
TypeError: Cannot read property 'body' of nullOccurred while linting /home/sebastiaanyn/Projects/Syntek/src/foo.ts:2 at checkForConstructor (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/rules/no-useless-constructor.js:169:42) at listeners.(anonymous function).forEach.listener (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/util/safe-emitter.js:45:58) at Array.forEach (<anonymous>) at Object.emit (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/util/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/util/node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/util/node-event-generator.js:280:22) at NodeEventGenerator.enterNode (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/util/node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23) at nodeQueue.forEach.traversalInfo (/home/sebastiaanyn/Projects/Syntek/node_modules/eslint/lib/linter.js:752:32) at Array.forEach (<anonymous>)
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 1.6.0 |
@typescript-eslint/parser | 1.6.0 |
TypeScript | 3.4.2 |
ESLint | 5.16.0 |
node | 11.8.0 |
npm | 6.9.0 |