Registry / aws / eslint-cdk-plugin

eslint-cdk-plugin

JSON →
library3.4.9jsnpmunverified

ESLint plugin for AWS CDK projects that enforces best practices and prevents common mistakes. Current stable version is 3.4.9. It is being renamed to eslint-plugin-awscdk starting from v4.0.0 to follow ESLint's naming convention. The package provides lint rules specific to CDK constructs, such as preventing construct ID collisions, ensuring proper use of stacks, and avoiding constructs in interfaces. It requires Node.js ^18.18.0 || ^20.9.0 || >=21.1.0, ESLint ^8.57.0 || ^9.0.0 || ^10.0.0, and TypeScript >=4.8.4 <6.1.0. Ships TypeScript types. Key differentiators: type-aware rules for CDK constructs, migration path from old package name, recommended config integration with typescript-eslint.

awstesting
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.

ESM-only since v3. Requires flat config (eslint.config.mjs). For require, use dynamic import or upgrade to v4 with eslint-plugin-awscdk.

import cdkPlugin from 'eslint-cdk-plugin'

For v3.x, use old package name. v4+ uses eslint-plugin-awscdk. Ensure correct import to avoid 'plugin not found' errors.

import cdkPlugin from 'eslint-cdk-plugin'

refer to the plugin object itself, not its config, when setting up custom rules.

plugins: { cdk: cdkPlugin }

config is an object, not a string. Use object spread or reference directly.

extends: [cdkPlugin.configs.recommended]

Sets up flat config with recommended CDK rules using typescript-eslint. Files scope limits to CDK sources.

import eslint from "@eslint/js"; import { defineConfig } from "eslint/config"; import tseslint from "typescript-eslint"; import cdkPlugin from "eslint-cdk-plugin"; export default defineConfig([ eslint.configs.recommended, ...tseslint.configs.recommended, { files: ["lib/**/*.ts", "bin/*.ts"], extends: [cdkPlugin.configs.recommended], }, ]);
Debug
Known footguns
breakingPackage renamed from eslint-cdk-plugin to eslint-plugin-awscdk in v4.0.0.
gotchaPlugin requires typescript-eslint for type-aware rules. Missing it will cause runtime errors on type-dependent rules.
deprecatedLegacy eslintrc format ( .eslintrc ) is not supported in v3+.
gotchaThe plugin's TypeScript version peer requirement is <6.1.0. Using TypeScript >=6.1.0 will cause peer dep conflicts or runtime errors.
breakingESLint v8 support removed in v4.0.0; only ESLint v9+ is supported.
deprecatedThe old package name eslint-cdk-plugin will stop receiving updates after a while and will be deprecated.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
gptbot
4
ahrefsbot
4
amazonbot
2
script
1
Resources