Skip to content

Commit

Permalink
chore(eslint-plugin): linter chokes on aws-cdk-lib/core import (#26022)
Browse files Browse the repository at this point in the history
#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*
  • Loading branch information
kaizencc authored Jun 19, 2023
1 parent 0737b4e commit a278fa7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ function getCdkRootDir(filename: string): string | undefined {
}

function isAlphaPackage(packageDir: string): boolean {
if (packageDir.endsWith('aws-cdk-lib/core')) {
return false; // special case for core because it does not have a package.json
}

const pkg = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), { encoding: 'utf-8' }));

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

return right ?? left ?? undefined;
}
}

0 comments on commit a278fa7

Please sign in to comment.