Skip to content

Cannot read property 'indexOf' of undefined while writing import statement #1616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
crystalfp opened this issue Feb 18, 2020 · 3 comments
Closed
Labels
external This issue is with another package, not typescript-eslint itself package: parser Issues related to @typescript-eslint/parser

Comments

@crystalfp
Copy link

crystalfp commented Feb 18, 2020

Moved here from microsoft/vscode-eslint#897 to mysticatea/eslint-plugin-node#207 to here. Hope this is the last hop...

What code were you trying to parse?

  1. Have a types.d.ts file defining and exporting the interface MyInterface.
export interface MyInterface {
  blaBla: string;
}
  1. In VS Code create a ts file in the same directory. For me it was called east-viewmodel.ts.
  2. Inside this file start writing the import statement import {MyInterface} from At this point a notification appears in VS Code with the following text:
ESLint: Cannot read property 'indexOf' of undefined
Occurred while linting D:\Projects\IdeaIgniterEnvironment\client\east-viewmodel.ts:3.
Please see the 'ESLint' output channel for details.

The output channel shows the following stack trace:

[Error - 6:05:10 AM] TypeError: Cannot read property 'indexOf' of undefined
Occurred while linting D:\Projects\IdeaIgniterEnvironment\client\east-viewmodel.ts:3
    at stripImportPathParams (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint-plugin-node\lib\util\strip-import-path-params.js:8:20)
    at ExportAllDeclaration,ExportNamedDeclaration,ImportDeclaration,ImportExpression (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint-plugin-node\lib\util\visit-import.js:55:40)
    at D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:634:23)
    at D:\Projects\IdeaIgniterEnvironment\node_modules\eslint\lib\linter\linter.js:936:32

Not critical, but annoying.
Thanks for looking!
mario

Versions

package version
@typescript-eslint/parser 2.20.0
TypeScript 3.7.5
ESLint 6.8.0
node 12.15.0
npm 6.13.7
@crystalfp crystalfp added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Feb 18, 2020
@armano2 armano2 added external This issue is with another package, not typescript-eslint itself and removed triage Waiting for team members to take a look labels Feb 18, 2020
@armano2
Copy link
Collaborator

armano2 commented Feb 18, 2020

@mysticatea this seems to be issue with eslint-plugin-node

eslint-plugin-node\lib\util\visit-import.js:55:40

@bradzacher
Copy link
Member

Please file an issue with eslint-plugin-node

@crystalfp
Copy link
Author

Done

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external This issue is with another package, not typescript-eslint itself package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

No branches or pull requests

3 participants