Skip to content

Commit a278fa7

Browse files
authored
chore(eslint-plugin): linter chokes on aws-cdk-lib/core import (#26022)
#25802 changed imports in alpha modules from `aws-cdk-lib` to `aws-cdk-lib/core`. Not sure how that got past the linter in the first place, but my linter is choking on this because `aws-cdk-lib/core` does not have a `package.json`. ```bash Error: ENOENT: no such file or directory, open '<path>/aws-cdk/packages/aws-cdk-lib/core/package.json' ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 0737b4e commit a278fa7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/@aws-cdk/eslint-plugin/lib/rules/invalid-cfn-imports.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ function getCdkRootDir(filename: string): string | undefined {
143143
}
144144

145145
function isAlphaPackage(packageDir: string): boolean {
146+
if (packageDir.endsWith('aws-cdk-lib/core')) {
147+
return false; // special case for core because it does not have a package.json
148+
}
149+
146150
const pkg = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), { encoding: 'utf-8' }));
147151

148152
const separateModule = pkg['separate-module'];
@@ -182,4 +186,4 @@ function checkLeftAndRightForCfn(node: any): { name: string, location: string }
182186
const left = checkLeftAndRightForCfn(node.left);
183187

184188
return right ?? left ?? undefined;
185-
}
189+
}

0 commit comments

Comments
 (0)