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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.