eslint-cdk-plugin
v3.4.7
Published
eslint plugin for AWS CDK projects
Downloads
17,257
Maintainers
Readme
📔 Documentation
Please refer to the website.
⚠️ Package Name Migration Notice
Important: This package was previously published as
eslint-cdk-plugin. Starting from v4.0.0, it has been renamed toeslint-plugin-awscdkto follow ESLint's official naming convention.
Migration Steps
1. Update eslint-cdk-plugin to latest version
# npm
npm install -D eslint-cdk-plugin@latest
# yarn
yarn add -D eslint-cdk-plugin@latest
# pnpm
pnpm install -D eslint-cdk-plugin@latest2. execute migration command
npx migrate-cdk-pluginThe old package name will continue to receive updates until for a while , after which it will be deprecated.
📦 Installation
# npm
npm install -D eslint-cdk-plugin
# yarn
yarn add -D eslint-cdk-plugin
# pnpm
pnpm install -D eslint-cdk-plugin🚀 Usage
Note: This plugin uses typescript type information and must be used in conjunction with typescript-eslint.
When using recommended config
// eslint.config.mjs
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"],
// ✅ Add plugins
extends: [cdkPlugin.configs.recommended],
},
]);When using custom config
// eslint.config.mjs
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"],
languageOptions: {
parserOptions: {
projectService: true,
project: "./tsconfig.json",
},
},
// ✅ Add plugins
plugins: {
cdk: cdkPlugin,
},
// ✅ Add rules (use custom rules)
rules: {
"cdk/no-construct-in-interface": "error",
"cdk/no-construct-stack-suffix": "error",
"cdk/no-parent-name-construct-id-match": "error",
},
},
]);❗ Issue
If you have any questions or suggestions, please open an issue.
💪 Contribution
Contributions are welcome! Please see Contribution Guide for more details.
⚓ Versioning Policy
Please see Versioning Policy.
