ESLint plugin for AWS CDK
Please refer to the website.
# npm
npm install -D eslint-cdk-plugin
# yarn
yarn add -D eslint-cdk-plugin
# pnpm
pnpm install -D eslint-cdk-plugin
Note: This plugin uses typescript type information and must be used in conjunction with typescript-eslint.
// eslint.config.mjs
import eslintCdkPlugin from "eslint-cdk-plugin";
import tsEslint from "typescript-eslint";
export default [
...tsEslint.configs.recommended,
{
files: ["lib/**/*.ts", "bin/*.ts"],
languageOptions: {
parserOptions: {
projectService: true,
project: "./tsconfig.json",
},
},
// ✅ Add plugins
plugins: {
cdk: eslintCdkPlugin,
},
// ✅ Add rules (use recommended rules)
rules: {
...eslintCdkPlugin.configs.recommended.rules,
},
},
];
// eslint.config.mjs
import tsEslint from "typescript-eslint";
import eslintCdkPlugin from "eslint-cdk-plugin";
export default [
...tsEslint.configs.recommended,
{
files: ["lib/**/*.ts", "bin/*.ts"],
languageOptions: {
parserOptions: {
projectService: true,
project: "./tsconfig.json",
},
},
// ✅ Add plugins
plugins: {
cdk: eslintCdkPlugin,
},
// ✅ Add rules (use custom rules)
rules: {
"cdk/no-class-in-interface": "error",
"cdk/no-construct-stack-suffix": "error",
"cdk/no-parent-name-construct-id-match": "error",
},
},
];
If you have any questions or suggestions, please open an issue.
Contributions are welcome! Please see Contribution Guide for more details.
Please see Versioning Policy.