Skip to content

Commit

Permalink
Merge 2b59539 into 843055c
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Tagisow committed Jul 13, 2020
2 parents 843055c + 2b59539 commit a48f51a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function typeTest(name, settings, path) {
}

export function isScopedModule(name) {
return name.indexOf('@') === 0
return name.indexOf('@') === 0 && !name.startsWith('@/')
}

export default function resolveImportType(name, context) {
Expand Down
7 changes: 6 additions & 1 deletion tests/src/core/importType.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai'
import * as path from 'path'

import importType, {isExternalModule} from 'core/importType'
import importType, {isExternalModule, isScopedModule} from 'core/importType'

import { testContext, testFilePath } from '../utils'

Expand Down Expand Up @@ -237,4 +237,9 @@ describe('importType(name)', function () {
'import/external-module-folders': ['E:\\path\\to\\node_modules'],
}, 'E:\\path\\to\\node_modules\\foo')).to.equal(true)
})

it('correctly identifies scoped modules with `isScopedModule`', () => {
expect(isScopedModule('@/abc')).to.equal(false);
expect(isScopedModule('@a/abc')).to.equal(true);
})
})
10 changes: 10 additions & 0 deletions tests/src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,5 +444,15 @@ ruleTester.run('extensions', rule, {
},
],
}),
test({
code: 'import foo from "@/ImNotAScopedModule"',
options: ['always'],
errors: [
{
message: 'Missing file extension for "@/ImNotAScopedModule"',
line: 1,
},
],
}),
],
})

0 comments on commit a48f51a

Please sign in to comment.