Rules
Currently we support the following rules:
You can check the details of the rules on each page.
- pascal-case-construct-id
- require-passing-this
- no-variable-construct-id
- no-parent-name-construct-id-match
- no-construct-stack-suffix
- no-class-in-interface
- no-public-class-fields
- no-mutable-public-fields
- no-mutable-props-interface
- no-import-private
recommended
rules
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",
},
},
];