Registry / aws / eslint-plugin-cdk

eslint-plugin-cdk

JSON →
library1.8.0jsnpmunverified

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.

npm install eslint-plugin-cdk
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-CDK
E
eslint-plugin-cdk
awsjavascriptv1.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugins.cdk
"plugins": ["cdk"]
"plugins": ["eslint-plugin-cdk"]
In ESLint config, omit the 'eslint-plugin-' prefix
rules.*
"cdk/ban-lambda-runtimes": "error"
"ban-lambda-runtimes": "error"
Must prefix rule names with 'cdk/'
module.exports.plugins
module.exports = { plugins: ['cdk'] }
const cdkPlugin = require('eslint-plugin-cdk'); module.exports = { plugins: { cdk: cdkPlugin } }
Simple string in plugins array is sufficient; object syntax not needed

Configures ESLint with cdk/ban-lambda-runtimes, cdk/construct-ctor, and cdk/no-static-import rules.

// Install: yarn add -D eslint-plugin-cdk @typescript-eslint/eslint-plugin // .eslintrc.json { "plugins": ["cdk"], "rules": { "cdk/ban-lambda-runtimes": ["error", { "bannedRuntimes": [ "NODEJS", "NODEJS_4_3", "NODEJS_6_10", "NODEJS_8_10", "NODEJS_10_X", "NODEJS_12_X" ] }], "cdk/construct-ctor": "error", "cdk/no-static-import": "error" } }
Debug
Known issues
breakingPlugin is experimental and subject to breaking changes at any time.
fix
Pin to exact version or review changelog before upgrading.
affects: <2.0.0
deprecatedRule 'no-static-import' may be removed in future major versions; recommended to use 'no-static-imports' (plural) instead.
fix
Use rule 'cdk/no-static-imports' instead.
affects: >=1.0.0
gotchaRules like 'ban-reserved-words' require 'jsiiOnly: true' to activate; without it, rule does nothing.
fix
Set 'jsiiOnly: true' in rule options if using JSII.
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-cdk".
Missing npm install or incorrect plugin name.
fix
Run 'yarn add -D eslint-plugin-cdk' and ensure plugins array uses 'cdk' not 'eslint-plugin-cdk'.
Definition for rule 'cdk/ban-lambda-runtimes' was not found.
ESLint not configured to use plugin 'cdk'.
fix
Add '"plugins": ["cdk"]' to your ESLint config.
Cannot read property 'bannedRuntimes' of undefined
Rule options not passed as second element of array.
fix
Use array syntax: ["error", { "bannedRuntimes": ["NODEJS_10_X"] }]
Upgrade
Version history
1.8.0latest on npm
Audit
Dependencies
@typescript-eslint/eslint-pluginrequiredPeer dependency required for TypeScript AST parsing and rule support
Agent activity
9 hits · last 30 days
node
8
Resources
eslint-plugin-cdk — npm install eslint-plugin-cdk · libregistry