Skip to content
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

TypeError: Cannot read property 'split' of undefined #1613

Closed
garyking opened this issue Jan 15, 2020 · 1 comment
Closed

TypeError: Cannot read property 'split' of undefined #1613

garyking opened this issue Jan 15, 2020 · 1 comment

Comments

@garyking
Copy link

eslint-plugin-import@2.20.0

I use VS Code and enable ESLint while typing.

If I type the following, with the cursor after the from, then I get the error below:

Code:

import test from 

main()

Error:

[Error - 12:44:32 PM] ESLint stack trace:
[Error - 12:44:32 PM] TypeError: Cannot read property 'split' of undefined
Occurred while linting /src/test2.ts:1
    at baseModule (/node_modules/eslint-plugin-import/lib/core/importType.js:41:27)
    at isBuiltIn (/node_modules/eslint-plugin-import/lib/core/importType.js:56:16)
    at checkFileExtension (/node_modules/eslint-plugin-import/lib/rules/extensions.js:147:37)
    at /node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)
@ljharb
Copy link
Member

ljharb commented Jan 15, 2020

Generally speaking, code that's not valid isn't something that an eslint plugin needs to handle, but this is likely an easy enough workaround.

@ljharb ljharb closed this as completed in 3908e6d Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants