Skip to content

Commit

Permalink
[Fix] extensions: avoid crashing on partially typed import/export s…
Browse files Browse the repository at this point in the history
…tatements

Fixes #2118.
  • Loading branch information
ljharb committed Jun 4, 2021
1 parent 7aea664 commit 4079482
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

### Fixed
- [`no-duplicates`]: ensure autofix avoids excessive newlines ([#2028], thanks [@ertrzyiks])
- [`extensions`]: avoid crashing on partially typed import/export statements ([#2118], thanks [@ljharb])

## [2.23.4] - 2021-05-29

Expand Down Expand Up @@ -1043,6 +1044,7 @@ for info on changes for earlier releases.
[#211]: https://github.com/benmosher/eslint-plugin-import/pull/211
[#164]: https://github.com/benmosher/eslint-plugin-import/pull/164
[#157]: https://github.com/benmosher/eslint-plugin-import/pull/157
[#2118]: https://github.com/benmosher/eslint-plugin-import/issues/2118
[#2067]: https://github.com/benmosher/eslint-plugin-import/issues/2067
[#2056]: https://github.com/benmosher/eslint-plugin-import/issues/2056
[#2063]: https://github.com/benmosher/eslint-plugin-import/issues/2063
Expand Down
4 changes: 2 additions & 2 deletions src/rules/extensions.js
Expand Up @@ -136,8 +136,8 @@ module.exports = {
}

function checkFileExtension(source) {
// bail if the declaration doesn't have a source, e.g. "export { foo };"
if (!source) return;
// bail if the declaration doesn't have a source, e.g. "export { foo };", or if it's only partially typed like in an editor
if (!source || !source.value) return;

const importPathWithQueryString = source.value;

Expand Down

0 comments on commit 4079482

Please sign in to comment.