Skip to content

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

Closed
@garyking

Description

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.

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions