{"id":19705,"library":"eslint-plugin-cdk","title":"eslint-plugin-cdk","description":"ESLint plugin with rules for AWS CDK projects. Version 1.8.0, experimental and subject to breaking changes. Offers rules like banning deprecated Lambda runtimes, enforcing construct patterns, and preventing static imports. Differentiates from other CDK linters by focusing on CDK-specific conventions and JSII compliance. Requires peer dependency @typescript-eslint/eslint-plugin >=3.9.0 and Node >=10.","status":"active","version":"1.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/hupe1980/cdkdx","tags":["javascript"],"install":[{"cmd":"npm install eslint-plugin-cdk","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-cdk","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-cdk","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for TypeScript AST parsing and rule support","package":"@typescript-eslint/eslint-plugin","optional":false}],"imports":[{"note":"In ESLint config, omit the 'eslint-plugin-' prefix","wrong":"\"plugins\": [\"eslint-plugin-cdk\"]","symbol":"plugins.cdk","correct":"\"plugins\": [\"cdk\"]"},{"note":"Must prefix rule names with 'cdk/'","wrong":"\"ban-lambda-runtimes\": \"error\"","symbol":"rules.*","correct":"\"cdk/ban-lambda-runtimes\": \"error\""},{"note":"Simple string in plugins array is sufficient; object syntax not needed","wrong":"const cdkPlugin = require('eslint-plugin-cdk'); module.exports = { plugins: { cdk: cdkPlugin } }","symbol":"module.exports.plugins","correct":"module.exports = { plugins: ['cdk'] }"}],"quickstart":{"code":"// Install: yarn add -D eslint-plugin-cdk @typescript-eslint/eslint-plugin\n// .eslintrc.json\n{\n  \"plugins\": [\"cdk\"],\n  \"rules\": {\n    \"cdk/ban-lambda-runtimes\": [\"error\", {\n      \"bannedRuntimes\": [\n        \"NODEJS\",\n        \"NODEJS_4_3\",\n        \"NODEJS_6_10\",\n        \"NODEJS_8_10\",\n        \"NODEJS_10_X\",\n        \"NODEJS_12_X\"\n      ]\n    }],\n    \"cdk/construct-ctor\": \"error\",\n    \"cdk/no-static-import\": \"error\"\n  }\n}","lang":"javascript","description":"Configures ESLint with cdk/ban-lambda-runtimes, cdk/construct-ctor, and cdk/no-static-import rules."},"warnings":[{"fix":"Pin to exact version or review changelog before upgrading.","message":"Plugin is experimental and subject to breaking changes at any time.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Use rule 'cdk/no-static-imports' instead.","message":"Rule 'no-static-import' may be removed in future major versions; recommended to use 'no-static-imports' (plural) instead.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set 'jsiiOnly: true' in rule options if using JSII.","message":"Rules like 'ban-reserved-words' require 'jsiiOnly: true' to activate; without it, rule does nothing.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'yarn add -D eslint-plugin-cdk' and ensure plugins array uses 'cdk' not 'eslint-plugin-cdk'.","cause":"Missing npm install or incorrect plugin name.","error":"ESLint couldn't find the plugin \"eslint-plugin-cdk\"."},{"fix":"Add '\"plugins\": [\"cdk\"]' to your ESLint config.","cause":"ESLint not configured to use plugin 'cdk'.","error":"Definition for rule 'cdk/ban-lambda-runtimes' was not found."},{"fix":"Use array syntax: [\"error\", { \"bannedRuntimes\": [\"NODEJS_10_X\"] }]","cause":"Rule options not passed as second element of array.","error":"Cannot read property 'bannedRuntimes' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}