Closed
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
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ljharb commentedon 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 commentedon Feb 24, 2020
Hey! Is this part of any new release?
ljharb commentedon Feb 24, 2020
@skjnldsv yes, if you click on the closing commit, you can see that it's in v2.20.1.
[Fix] `no-absolute-path`: fix a crash with invalid import syntax