diff --git a/tools/awslint/lib/cfn-resources.ts b/tools/awslint/lib/cfn-resources.ts index 838a56978b9d5..a1ecda07eac8e 100644 --- a/tools/awslint/lib/cfn-resources.ts +++ b/tools/awslint/lib/cfn-resources.ts @@ -64,7 +64,11 @@ export function findCfnResources(assembly: reflect.Assembly): CfnResourceSpec[] } function isCfnResource(c: reflect.ClassType) { - const resourceBaseClass = c.system.findFqn('@aws-cdk/cdk.Resource'); + const cdkAssembly = '@aws-cdk/cdk'; + if (!c.system.includesAssembly(cdkAssembly)) { + return false; + } + const resourceBaseClass = c.system.findFqn(`${cdkAssembly}.Resource`); if (!isConstruct(c)) { return false; diff --git a/tools/awslint/lib/util.ts b/tools/awslint/lib/util.ts index 59b13085074ae..6302a19001770 100644 --- a/tools/awslint/lib/util.ts +++ b/tools/awslint/lib/util.ts @@ -1,9 +1,13 @@ import reflect = require('jsii-reflect'); -export const CONSTRUCT_FQN = '@aws-cdk/cdk.Construct'; -export const CONSTRUCT_INTERFACE_FQN = '@aws-cdk/cdk.IConstruct'; +export const CONSTRUCT_ASSEMBLY = '@aws-cdk/cdk'; +export const CONSTRUCT_FQN = `${CONSTRUCT_ASSEMBLY}.Construct`; +export const CONSTRUCT_INTERFACE_FQN = `${CONSTRUCT_ASSEMBLY}.IConstruct`; export function isConstruct(c: reflect.ClassType) { + if (!c.system.includesAssembly(CONSTRUCT_ASSEMBLY)) { + return false; + } const constructClass = c.system.findFqn(CONSTRUCT_FQN); const bases = c.getAncestors(); const root = bases[bases.length - 1];