Skip to content

Rules

Currently we support the following rules:
You can check the details of the rules on each page.

Using recommended makes it easy to set up.

js
// eslint.config.mjs
import eslintCdkPlugin from "eslint-cdk-plugin";
export default [
  {
    plugins: {
      cdk: eslintCdkPlugin,
    },
    rules: {
      ...eslintCdkPlugin.configs.recommended.rules,
    },
  },
];

When using recommended, the actual content set is as follows.

js
// eslint.config.mjs
import eslintCdkPlugin from "eslint-cdk-plugin";
export default [
  {
    plugins: {
      cdk: eslintCdkPlugin,
    },
    rules: {
      "cdk/no-class-in-interface": "error",
      "cdk/no-construct-stack-suffix": "error",
      "cdk/no-parent-name-construct-id-match": "error",
      "cdk/no-public-class-fields": "error",
      "cdk/pascal-case-construct-id": "error",
      "cdk/require-passing-this": "error",
      "cdk/no-variable-construct-id": "error",
      "cdk/no-mutable-public-fields": "warn",
      "cdk/no-mutable-props-interface": "warn",
    },
  },
];