@@ -34,6 +34,7 @@ const getPackages = require('./getPackages');
|
||||
* @property {'value' | 'type'} kind
|
||||
* @property {string} path
|
||||
* @property {import('./getPackages').ExtendedPackage} package
|
||||
* @property {string} packageName
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -160,6 +161,7 @@ module.exports = function visitImports(context, visitor) {
|
||||
kind: info.kind,
|
||||
path: subPath,
|
||||
package: pkg,
|
||||
packageName,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -151,11 +151,13 @@ module.exports = {
|
||||
}
|
||||
|
||||
return visitImports(context, (node, imp) => {
|
||||
if (imp.type !== 'external') {
|
||||
return;
|
||||
}
|
||||
// We leave checking of type imports to the repo-tools check
|
||||
if (imp.kind === 'type') {
|
||||
// We leave checking of type imports to the repo-tools check,
|
||||
// and we skip builtins and local imports
|
||||
if (
|
||||
imp.kind === 'type' ||
|
||||
imp.type === 'builtin' ||
|
||||
imp.type === 'local'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,5 +236,16 @@ ruleTester.run(RULE, rule, {
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
code: `import '@internal/foo'`,
|
||||
filename: joinPath(FIXTURE, 'packages/bar/src/index.ts'),
|
||||
errors: [
|
||||
ERR_UNDECLARED(
|
||||
'@internal/foo',
|
||||
'dependencies',
|
||||
joinPath('packages', 'bar'),
|
||||
),
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user