Skip to content

ren-yamanashi/eslint-cdk-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

44ecd90 Β· Feb 5, 2025

History

88 Commits
Dec 26, 2024
Dec 28, 2024
Dec 28, 2024
Jan 23, 2025
Jan 25, 2025
Jan 25, 2025
Nov 16, 2024
Nov 16, 2024
Jan 24, 2025
Nov 20, 2024
Dec 7, 2024
Nov 16, 2024
Dec 28, 2024
Dec 7, 2024
Dec 28, 2024
Dec 28, 2024
Feb 5, 2025
Feb 5, 2025
Dec 5, 2024
Dec 28, 2024
Nov 16, 2024

Repository files navigation

ESLint plugin for AWS CDK logo

eslint-cdk-plugin

ESLint plugin for AWS CDK

NPM

πŸ“” Documentation

Please refer to the website.

πŸ“¦ 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 eslintCdkPlugin from "eslint-cdk-plugin";
import tsEslint from "typescript-eslint";

export default [
  ...tsEslint.configs.recommended,
  {
    files: ["lib/**/*.ts", "bin/*.ts"],
    languageOptions: {
      parserOptions: {
        projectService: true,
        project: "./tsconfig.json",
      },
    },
    // βœ… Add plugins
    plugins: {
      cdk: eslintCdkPlugin,
    },
    // βœ… Add rules (use recommended rules)
    rules: {
      ...eslintCdkPlugin.configs.recommended.rules,
    },
  },
];

When using custom config

// eslint.config.mjs
import tsEslint from "typescript-eslint";
import eslintCdkPlugin from "eslint-cdk-plugin";

export default [
  ...tsEslint.configs.recommended,
  {
    files: ["lib/**/*.ts", "bin/*.ts"],
    languageOptions: {
      parserOptions: {
        projectService: true,
        project: "./tsconfig.json",
      },
    },
    // βœ… Add plugins
    plugins: {
      cdk: eslintCdkPlugin,
    },
    // βœ… Add rules (use custom rules)
    rules: {
      "cdk/no-class-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.

©️ License

MIT