Cause
|
node.superClass.object.name === 'cdk' && |
This line of code ⬆️ enforces we use the name cdk to import "all" from aws-cdk-lib.
e.g.
import * as cdk from "aws-cdk-lib" // ✅ works!
import * as Cdk from "aws-cdk-lib" // ❌ doesn't work!
Reason
You might be curious why I would wanna use other import names like Cdk.
Well, let's take a look at React:
// 😌
import * as React from "react"
<React.Fragment />
React.useState()
// 🥴
import * as react from "react"
<react.Fragment />
react.useState()
From the above example, we can see that capitalizing the name of import "all" makes more sense.
Workaround
import { Stack } from "aws-cdk-lib", or
- Patch
eslint-plugin-cdk@1.8.0 with ⬇️
- node.superClass.object.name === 'cdk' &&
+ node.superClass.object.name.toLowerCase() === 'cdk' &&
Cause
cdkdx/packages/eslint-plugin-cdk/src/utils/cdk.ts
Line 20 in 28df1ba
This line of code ⬆️ enforces we use the name
cdkto import "all" fromaws-cdk-lib.e.g.
Reason
You might be curious why I would wanna use other import names like
Cdk.Well, let's take a look at React:
From the above example, we can see that capitalizing the name of import "all" makes more sense.
Workaround
import { Stack } from "aws-cdk-lib", oreslint-plugin-cdk@1.8.0with ⬇️