{"id":19697,"library":"eslint-plugin-awscdk","title":"ESLint Plugin for AWS CDK","description":"An ESLint plugin providing custom lint rules for AWS CDK projects, including rules like 'require-jsdoc', 'no-unused-props', 'prevent-construct-id-collision', and 'no-construct-in-interface'. Current stable version is 4.3.2, released under an active development cadence. It requires TypeScript and leverages type information via typescript-eslint. Differentiates from generic CDK linting by being specifically tailored to CDK constructs and patterns, offering both recommended and strict configs. Supports ESLint 8/9/10 and TypeScript 4.8+ to 6.x, and ships its own TypeScript type definitions.","status":"active","version":"4.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/ren-yamanashi/eslint-plugin-awscdk","tags":["javascript","aws","aws-cdk","eslint","eslint-plugin","eslint-plugin-awscdk","typescript"],"install":[{"cmd":"npm install eslint-plugin-awscdk","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-awscdk","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-awscdk","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: ESLint versions 8.57.0 or 9.x or 10.x required for plugin to function.","package":"eslint","optional":true},{"reason":"Peer dependency: TypeScript >=4.8.4 <6.1.0 required for type-aware rules.","package":"typescript","optional":true}],"imports":[{"note":"Plugin is ESM-first. Use import syntax. CommonJS require works but is not recommended; if used, you may need dynamic import or a CJS wrapper.","wrong":"const cdkPlugin = require('eslint-plugin-awscdk');","symbol":"default (cdkPlugin)","correct":"import cdkPlugin from 'eslint-plugin-awscdk';"},{"note":"Config objects are exported under cdkPlugin.configs. Do not use separate path imports; they are not guaranteed to exist.","wrong":"require('eslint-plugin-awscdk/configs/recommended')","symbol":"configs.recommended","correct":"cdkPlugin.configs.recommended"},{"note":"Rule names are prefixed with 'awscdk/', not '@awscdk/'. Common mistake when copy-pasting from other plugins.","wrong":"\"@awscdk/require-jsdoc\": \"warn\"","symbol":"rules (e.g., 'awscdk/require-jsdoc')","correct":"\"awscdk/require-jsdoc\": \"warn\""}],"quickstart":{"code":"// eslint.config.mjs\nimport eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport cdkPlugin from \"eslint-plugin-awscdk\";\n\nexport default defineConfig([\n  {\n    files: [\"lib/**/*.ts\", \"bin/*.ts\"],\n    extends: [\n      eslint.configs.recommended,\n      ...tseslint.configs.recommended,\n      cdkPlugin.configs.recommended,\n    ],\n    rules: {\n      \"awscdk/require-jsdoc\": \"warn\",\n    },\n  },\n]);","lang":"typescript","description":"Shows flat ESLint config using the plugin with typescript-eslint, extending the recommended config and adding a custom rule."},"warnings":[{"fix":"Upgrade ESLint to ^8.57.0 || ^9.0.0 || ^10.0.0.","message":"Since v4, the plugin requires ESLint 8.57.0 or later, dropping support for earlier ESLint 8 versions.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"For classic .eslintrc, use 'plugin:awscdk/classicRecommended' instead of 'plugin:awscdk/recommended'. For flat config, use cdkPlugin.configs.recommended.","message":"Config names changed in v4: classic configs are now under 'plugin:awscdk/classicRecommended' and 'plugin:awscdk/classicStrict', not 'plugin:awscdk/recommended'.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Uninstall eslint-cdk-plugin and install eslint-plugin-awscdk@4. Update imports and config accordingly.","message":"The package 'eslint-cdk-plugin' (v3.x) has been renamed to 'eslint-plugin-awscdk' (v4.x). v3.x is no longer maintained.","severity":"deprecated","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Configure parserOptions.project in .eslintrc or use typescript-eslint's typed configs in flat config.","message":"The plugin uses TypeScript type information. Ensure you have parserOptions.project set in classic config or use typed linting with typescript-eslint.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Ensure you are using @typescript-eslint/parser with project option, or use only rules that do not require types.","message":"Some rules require type information and will not work without it, causing false positives or errors.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use 'awscdk/no-construct-in-public-property' instead.","message":"Rule 'no-construct-in-public-property-of-construct' renamed to 'no-construct-in-public-property' in v4.","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install -D eslint-plugin-awscdk` or `pnpm install -D eslint-plugin-awscdk`.","cause":"Plugin not installed or not in node_modules.","error":"Error: Failed to load plugin 'awscdk' declared in '.eslintrc': Cannot find module 'eslint-plugin-awscdk'"},{"fix":"Use `import cdkPlugin from 'eslint-plugin-awscdk'` and then `cdkPlugin.configs.recommended`. Do not use destructured import.","cause":"Trying to access configs.recommended from a default import that is not the plugin object (e.g., wrong import style).","error":"TypeError: Cannot read properties of undefined (reading 'recommended')"},{"fix":"Use the correct config format: for flat config, import the plugin; for classic config, use the string 'eslint-plugin-awscdk' in plugins array.","cause":"ESLint version mismatch or plugin not found due to flat config vs classic config confusion.","error":"Error: 'eslint-plugin-awscdk' resolved in ESLint configuration to an unexpected value."},{"fix":"Set parserOptions.project to './tsconfig.json' (or the correct path) in your ESLint config.","cause":"parserOptions.project is not set or tsconfig.json path is incorrect.","error":"Parsing error: ESLint was configured to run on `<tsconfigRootDir>/file.ts` using `parserOptions.project` but it was not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}