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

[body null]eslint scan .ts #496

Closed
cyw3 opened this issue Jun 29, 2018 · 3 comments
Closed

[body null]eslint scan .ts #496

cyw3 opened this issue Jun 29, 2018 · 3 comments

Comments

@cyw3
Copy link

cyw3 commented Jun 29, 2018

What version of TypeScript are you using?
[email protected]

What version of typescript-eslint-parser are you using?
[email protected]

What code were you trying to parse?

declare module chrome {
    class Driver extends webdriver.WebDriver {
        constructor(opt_config?: webdriver.Capabilities, opt_service?: any, opt_flow?: webdriver.promise.ControlFlow);
        constructor(opt_config?: Options, opt_service?: any, opt_flow?: webdriver.promise.ControlFlow);
    }
}

What did you expect to happen?
eslint can work well.

What happened?
but eslint crash:

$ eslint --ext .ts test.ts

Cannot read property 'body' of null
TypeError: Cannot read property 'body' of null
    at checkForConstructor (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/rules/no-useless-constructor.js:167:42)
    at listeners.(anonymous function).forEach.listener (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
    at nodeQueue.forEach.traversalInfo (/Users/xxx/node-v8.9.1/lib/node_modules/eslint/lib/linter.js:861:28)
    at Array.forEach (<anonymous>)
@jorgegonzalez
Copy link

Were you able to solve this @cyw3?

@infctr
Copy link

infctr commented Aug 27, 2018

Ran into same issue with code

declare class Foo {
  constructor(params: IFooParams);

  public setUserID(userId: string): void;

  public reachGoal(goal: string, object);
}

and debug info

  eslint:linter An error occurred while traversing +20ms
  eslint:linter Filename: /Users/infctr/Projects/itv-smarttv/app/modules/analytics/service/ymTransmitter/defines.d.ts +0ms
  eslint:linter Parser Options: { ecmaFeatures:
   { globalReturn: false,
     generators: false,
     objectLiteralDuplicateProperties: false,
     jsx: true },
  ecmaVersion: 9,
  sourceType: 'module' } +0ms
  eslint:linter Parser Path: typescript-eslint-parser +0ms
  eslint:linter Settings: { 'import/resolver': { node: { extensions: [Array], moduleDirectory: [Array] } },
  'import/ignore': [ 'node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$' ],
  react: { pragma: 'React', version: '16.0' },
  propWrapperFunctions: [ 'forbidExtraProps', 'exact', 'Object.freeze' ] } +0ms
Cannot read property 'body' of null

@mysticatea
Copy link
Member

Closing as a duplicate of #485. Thank you.

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

5 participants