diff --git a/CHANGELOG.md b/CHANGELOG.md index 96b12e157..cfd4ad5eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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]) @@ -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 @@ -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 diff --git a/src/core/importType.js b/src/core/importType.js index 311fd1e28..df60575c0 100644 --- a/src/core/importType.js +++ b/src/core/importType.js @@ -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) } diff --git a/tests/src/rules/extensions.js b/tests/src/rules/extensions.js index 562802eef..8cdb3399d 100644 --- a/tests/src/rules/extensions.js +++ b/tests/src/rules/extensions.js @@ -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({