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

no-absolute-path: TypeError: Cannot read property 'indexOf' of undefined #1616

Closed
garyking opened this issue Jan 19, 2020 · 3 comments
Closed
Assignees
Labels

Comments

@garyking
Copy link

With this rule: 'import/no-absolute-path': 'error'

Type this code:

import eslint from e

The following error occurs:

[Error - 6:13:04 PM] ESLint stack trace:
[Error - 6:13:04 PM] TypeError: Cannot read property 'indexOf' of undefined
Occurred while linting test.ts:1
    at isAbsolute (node_modules/eslint-plugin-import/lib/core/importType.js:50:15)
    at reportIfAbsolute (node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js:26:38)
    at checkSourceValue (node_modules/eslint-module-utils/moduleVisitor.js:29:5)
    at checkSource (node_modules/eslint-module-utils/moduleVisitor.js:34:5)
    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)

Should be an easy fix? I know that the error is probably because the from source should be quoted, but still, it shouldn't throw an error like that.

@ljharb ljharb self-assigned this Feb 1, 2020
@ljharb ljharb added the bug label Feb 1, 2020
@ljharb ljharb closed this as completed in 4665ec5 Feb 1, 2020
@ljharb
Copy link
Member

ljharb commented Feb 2, 2020

Looks like this is actually a bug in the typescript parser, which shouldn’t parse this to begin with. Would you mind filing an issue with them?

@skjnldsv
Copy link

Hey! Is this part of any new release?

@ljharb
Copy link
Member

ljharb commented Feb 24, 2020

@skjnldsv yes, if you click on the closing commit, you can see that it's in v2.20.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants