From b3bbc7fe6eb7211dc70e9c1cea8a5ad4e94f71bc Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Mon, 25 Sep 2023 14:16:37 +0100 Subject: [PATCH] chore(awslint): fix nested submodule L1 type not recognized as L1 (#27273) Previously a type from a submodule with a FQN like `aws_service.CfnTheResource.SubType` was not identified as an L1 type, and subjected to stricter L2 rules. Fixes failing integration tests in https://github.com/cdklabs/awscdk-service-spec E.g. https://github.com/cdklabs/awscdk-service-spec/actions/runs/6293221129/job/17097529390 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/awslint/lib/rules/core-types.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/awslint/lib/rules/core-types.ts b/packages/awslint/lib/rules/core-types.ts index 42a8af9dcb23a..1c86ba2a60eab 100644 --- a/packages/awslint/lib/rules/core-types.ts +++ b/packages/awslint/lib/rules/core-types.ts @@ -89,7 +89,10 @@ export class CoreTypes { * Return true if the given interface type is a CFN class or prop type */ public static isCfnType(interfaceType: reflect.Type) { - return interfaceType.name.startsWith('Cfn') || (interfaceType.namespace && interfaceType.namespace.startsWith('Cfn')); + return interfaceType.name.startsWith('Cfn') + || (interfaceType.namespace && interfaceType.namespace.startsWith('Cfn')) + // aws_service.CfnTheResource.SubType + || (interfaceType.namespace && interfaceType.namespace.split('.', 2).at(1)?.startsWith('Cfn')); } /**