Skip to content

Commit

Permalink
[Fix] no-absolute-path: fix a crash with invalid import syntax
Browse files Browse the repository at this point in the history
Fixes #1616
  • Loading branch information
ljharb committed Feb 1, 2020
1 parent 392c6b9 commit 4665ec5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

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

[#1635]: https://github.com/benmosher/eslint-plugin-import/issues/1635
[#1620]: https://github.com/benmosher/eslint-plugin-import/pull/1620
[#1616]: https://github.com/benmosher/eslint-plugin-import/issues/1616
[#1613]: https://github.com/benmosher/eslint-plugin-import/issues/1613
[#1612]: https://github.com/benmosher/eslint-plugin-import/pull/1612
[#1611]: https://github.com/benmosher/eslint-plugin-import/pull/1611
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-absolute-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {

create: function (context) {
function reportIfAbsolute(source) {
if (isAbsolute(source.value)) {
if (typeof source.value === 'string' && isAbsolute(source.value)) {
context.report(source, 'Do not import modules using an absolute path')
}
}
Expand Down

0 comments on commit 4665ec5

Please sign in to comment.