Skip to content

Commit

Permalink
[Fix] extensions: Fix scope regex
Browse files Browse the repository at this point in the history
Fixes #1598.
  • Loading branch information
yordis authored and ljharb committed Jan 14, 2020
1 parent 3908e6d commit 7e71b50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
### Fixed
- [`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])

### Changed
- [`import/external-module-folders` setting] behavior is more strict now: it will only match complete path segments ([#1605], thanks [@skozin])
Expand Down Expand Up @@ -643,6 +644,7 @@ for info on changes for earlier releases.
[`memo-parser`]: ./memo-parser/README.md

[#1613]: https://github.com/benmosher/eslint-plugin-import/issues/1613
[#1611]: https://github.com/benmosher/eslint-plugin-import/pull/1611
[#1605]: https://github.com/benmosher/eslint-plugin-import/pull/1605
[#1589]: https://github.com/benmosher/eslint-plugin-import/issues/1589
[#1586]: https://github.com/benmosher/eslint-plugin-import/pull/1586
Expand Down Expand Up @@ -1078,3 +1080,4 @@ for info on changes for earlier releases.
[@joaovieira]: https://github.com/joaovieira
[@ivo-stefchev]: https://github.com/ivo-stefchev
[@skozin]: https://github.com/skozin
[@yordis]: https://github.com/yordis
2 changes: 1 addition & 1 deletion src/core/importType.js
Expand Up @@ -50,7 +50,7 @@ export function isExternalModuleMain(name, settings, path) {
return externalModuleMainRegExp.test(name) && isExternalPath(path, name, settings)
}

const scopedRegExp = /^@[^/]+\/?[^/]+/
const scopedRegExp = /^@[^/]*\/?[^/]+/
export function isScoped(name) {
return name && scopedRegExp.test(name)
}
Expand Down
1 change: 1 addition & 0 deletions tests/src/rules/extensions.js
Expand Up @@ -6,6 +6,7 @@ const ruleTester = new RuleTester()

ruleTester.run('extensions', rule, {
valid: [
test({ code: 'import a from "@/a"' }),
test({ code: 'import a from "a"' }),
test({ code: 'import dot from "./file.with.dot"' }),
test({
Expand Down

0 comments on commit 7e71b50

Please sign in to comment.