Skip to content

Commit 4665ec5

Browse files
committed
[Fix] no-absolute-path: fix a crash with invalid import syntax
Fixes #1616
1 parent 392c6b9 commit 4665ec5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
66

77
## [Unreleased]
88
### Fixed
9+
- [`no-absolute-path`]: fix a crash with invalid import syntax ([#1616], thanks [@ljharb])
910
- [`import/external-module-folders` setting] now correctly works with directories containing modules symlinked from `node_modules` ([#1605], thanks [@skozin])
1011
- [`extensions`]: for invalid code where `name` does not exist, do not crash ([#1613], thanks [@ljharb])
1112
- [`extentions`]: Fix scope regex ([#1611], thanks [@yordis])
@@ -649,6 +650,7 @@ for info on changes for earlier releases.
649650

650651
[#1635]: https://github.com/benmosher/eslint-plugin-import/issues/1635
651652
[#1620]: https://github.com/benmosher/eslint-plugin-import/pull/1620
653+
[#1616]: https://github.com/benmosher/eslint-plugin-import/issues/1616
652654
[#1613]: https://github.com/benmosher/eslint-plugin-import/issues/1613
653655
[#1612]: https://github.com/benmosher/eslint-plugin-import/pull/1612
654656
[#1611]: https://github.com/benmosher/eslint-plugin-import/pull/1611

src/rules/no-absolute-path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313

1414
create: function (context) {
1515
function reportIfAbsolute(source) {
16-
if (isAbsolute(source.value)) {
16+
if (typeof source.value === 'string' && isAbsolute(source.value)) {
1717
context.report(source, 'Do not import modules using an absolute path')
1818
}
1919
}

0 commit comments

Comments
 (0)