Skip to content

no-mutable-props-interface

✅ Using recommended in an ESLint configuration enables this rule.
🔧 Some problems reported by this rule are automatically fixable by the --fix ESLint command line option

This rule disallow making public properties of constructs or stack props (interfaces) mutable.

It is not a good to specify mutable public properties in props, as this can lead to unintended side effects.

✅ Correct Example

ts
import { IBucket } from "aws-cdk-lib/aws-s3";

interface MyConstructProps {
  // ✅ Can use readonly
  readonly bucket: IBucket;
}

❌ Incorrect Example

ts
import { IBucket } from "aws-cdk-lib/aws-s3";

interface MyConstructProps {
  // ❌ Shouldn't use mutable
  bucket: IBucket;
}