{"id":28782,"date":"2025-04-24T09:45:55","date_gmt":"2025-04-24T00:45:55","guid":{"rendered":"https:\/\/www.skyarch.net\/blog\/?p=28782"},"modified":"2025-04-30T09:37:22","modified_gmt":"2025-04-30T00:37:22","slug":"eslint-cdk-plugin%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6aws-cdk%e3%81%ae%e3%83%99%e3%82%b9%e3%83%88%e3%83%97%e3%83%a9%e3%82%af%e3%83%86%e3%82%a3%e3%82%b9%e3%82%92%e8%87%aa%e5%8b%95%e3%83%81","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/eslint-cdk-plugin%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6aws-cdk%e3%81%ae%e3%83%99%e3%82%b9%e3%83%88%e3%83%97%e3%83%a9%e3%82%af%e3%83%86%e3%82%a3%e3%82%b9%e3%82%92%e8%87%aa%e5%8b%95%e3%83%81\/","title":{"rendered":"eslint-cdk-plugin\u3092\u4f7f\u7528\u3057\u3066AWS CDK\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u81ea\u52d5\u30c1\u30a7\u30c3\u30af\u3059\u308b"},"content":{"rendered":"<h1>\u306f\u3058\u3081\u306b<\/h1>\n<p>ESLint\u3067CDK\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u81ea\u52d5\u3067\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3001<br \/>\neslint-cdk-plugin\u306b\u3064\u3044\u3066\u8abf\u67fb\u30fb\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>\u691c\u8a3c\u74b0\u5883<\/h2>\n<p>\u4eca\u56de\u306fCDK\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u521d\u671f\u5316\u3057\u305f\u3068\u3053\u308d\u304b\u3089\u3001\u691c\u8a3c\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u4f7f\u7528\u3057\u305f\u4e3b\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<p><strong>VSCode:1.99.3<br \/>\nNode.js\uff1a22.12.0<br \/>\neslint\uff1a9.25.1<br \/>\ntypescript-eslint\uff1a8.31.0<br \/>\neslint-cdk-plugin\uff1a2.2.0<\/strong><\/p>\n<h2>ESLint\u3068\u306f<\/h2>\n<p><a href=\"https:\/\/eslint.org\/docs\/latest\/use\/getting-started\" title=\"ESLint\">ESLint<\/a>\u306f\u3001JavaScript\u3084TypeScript\u306e\u30b3\u30fc\u30c9\u3092\u9759\u7684\u306b\u89e3\u6790\u3057\u3066\u3001<br \/>\n\u69cb\u6587\u30a8\u30e9\u30fc\u3084\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u898f\u7d04\u306e\u9055\u53cd\u3092\u691c\u51fa\u3057\u3066\u304f\u308c\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30fc\u30c9\u306e\u54c1\u8cea\u3092\u4fdd\u3061\u3001\u30c1\u30fc\u30e0\u5185\u3067\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30b9\u30bf\u30a4\u30eb\u306e\u7d71\u4e00\u3092\u56f3\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>eslint-cdk-plugin\u3068\u306f<\/h2>\n<p><a href=\"https:\/\/eslint-cdk-plugin.dev\/ja\/\" title=\"eslint-cdk-plugin\">eslint-cdk-plugin<\/a>\u306f\u3001ESLint\u306bCDK\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306e\u89e3\u6790\u30eb\u30fc\u30eb\u3092\u52a0\u3048\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3059\u3002<\/p>\n<p>\u30d7\u30ea\u30bb\u30c3\u30c8\u306e\u8a2d\u5b9a\u3068\u3057\u3066\u3001recommended\u3068strict\u304c\u3042\u308a\u3001<br \/>\nrecommended\u306f\u63a8\u5968\u30eb\u30fc\u30eb\u306e\u307f\u3001strict\u3067\u306f\u5168\u3066\u306e\u30eb\u30fc\u30eb\u304c\u9069\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>ESLint\u306e\u5c0e\u5165<\/h2>\n<p>\u3067\u306f\u65e9\u901f\u3001ESLint\u3068eslint-cdk-plugin\u3092\u5c0e\u5165\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\neslint-cdk-plugin\u306fESLint\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u305f\u3081\u3001ESLint\u304b\u3089\u5148\u306b\u5c0e\u5165\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h3>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>eslint\u3068typescript-eslint\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u3066\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n<code>npm install  -D eslint typescript-eslint<\/code><\/p>\n<h3>package.json\u306b\u30b3\u30de\u30f3\u30c9\u3092\u8ffd\u8a18<\/h3>\n<p>ESLint\u3092\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u306eCLI\u304b\u3089\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3001<br \/>\npackage.json\u306escripts\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<pre>\n\"scripts\": {\n    \"build\": \"tsc\",\n    \"watch\": \"tsc -w\",\n    \"test\": \"jest\",\n    \"cdk\": \"cdk\"\n    +\"lint\": \"eslint .\",\n    +\"lint:fix\": \"eslint . --fix\"\n  },\n<\/pre>\n<h3>ESLint\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210<\/h3>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30eb\u30fc\u30c8\u306b\u3001eslint.config.mjs\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre>\n\/\/eslint.config.mjs\nimport eslint from \"@eslint\/js\";\nimport tsEslint from \"typescript-eslint\";\n\nexport default tsEslint.config(\n  \/\/ ESLint\u306e\u63a8\u5968\u8a2d\u5b9a\u3092\u9069\u7528\n  eslint.configs.recommended,\n  tsEslint.configs.recommended,\n  \/\/ \u7121\u8996\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u30fb\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u6307\u5b9a\n  {\n    ignores: [\"cdk.out\", \"node_modules\", \"*.js\"],\n  }\n);\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u8a2d\u5b9a\u306f\u3001<br \/>\nESLint 9 \u304b\u3089\u6a19\u6e96\u3068\u306a\u3063\u305f\u3001FlatConfig\u3068\u3044\u3046\u5f62\u5f0f\u3067\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>FlatConfig\u3067\u306f\u3001\u4e0a\u306e\u884c\u3067\u8a18\u8ff0\u3057\u305f\u8a2d\u5b9a\u3088\u308a\u3082\u3001\u4e0b\u306e\u884c\u3067\u8a18\u8ff0\u3057\u305f\u8a2d\u5b9a\u304c\u512a\u5148\u3055\u308c\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001\u30eb\u30fc\u30ebA\u306b\u3064\u3044\u3066\u306e\u8a2d\u5b9a\u3092\u91cd\u8907\u3057\u306610\u884c\u76ee\u306820\u884c\u76ee\u306e\u3069\u3061\u3089\u3067\u3082\u884c\u306a\u3063\u3066\u3044\u305f\u5834\u5408\u3001<br \/>\n20\u884c\u76ee\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u8a2d\u5b9a\u304c\u512a\u5148\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>FlatConfig\u306b\u3064\u3044\u3066\u306e\u8a73\u7d30\u306a\u8a2d\u5b9a\u65b9\u6cd5\u306f\u3001\u4ee5\u4e0b\u30ea\u30f3\u30af\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"https:\/\/eslint.org\/docs\/latest\/use\/configure\/configuration-files\">https:\/\/eslint.org\/docs\/latest\/use\/configure\/configuration-files<\/a><\/p>\n<h3>\u52d5\u4f5c\u78ba\u8a8d<\/h3>\n<p>ESLint\u306e\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h4>\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210<\/h4>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30eb\u30fc\u30c8\u306b\u3001sample.ts\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre>\n\/\/sample.ts\nconst sample: any = \"sampleString\"\n\nconsole.log(sample);\n<\/pre>\n<h4>\u9759\u7684\u89e3\u6790\u3092\u5b9f\u884c<\/h4>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u5b9f\u884c\u3057\u3001ESLint\u306e\u9759\u7684\u89e3\u6790\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n<code>npm run lint<\/code><\/p>\n<p><strong>\u5b9f\u884c\u7d50\u679c<\/strong><br \/>\n<a href=\"https:\/\/typescript-eslint.io\/rules\/no-explicit-any\" title=\"typescript-eslint\/no-explicit-any\u30eb\u30fc\u30eb\">typescript-eslint\/no-explicit-any\u30eb\u30fc\u30eb<\/a>\u3092\u3001\u9055\u53cd\u3068\u3057\u3066\u691c\u77e5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/no-explicit-any.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/no-explicit-any.png\" alt=\"\" \/><\/a><\/p>\n<h4>\u4fee\u6b63\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d<\/h4>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306bsample.ts\u3092\u4fee\u6b63\u3057\u3001\u518d\u5ea6<code>npm run lint<\/code>\u3092\u5b9f\u884c\u3057\u307e\u3059<\/p>\n<pre>\nconst sample: string = \"sampleString\"\u3000\/\/any\u578b\u3067\u306f\u306a\u304f\u3001string\u578b\u3092\u6307\u5b9a\n\nconsole.log(sample);\n<\/pre>\n<p><strong>\u5b9f\u884c\u7d50\u679c<\/strong><br \/>\n\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u3044\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/noErrorOnFix-1.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/noErrorOnFix-1.png\" alt=\"\" \/><\/a><\/p>\n<h3>VSCode\u4e0a\u3067ESLint\u306e\u9055\u53cd\u30eb\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n<p>VSCode\u306e\u30a8\u30c7\u30a3\u30bf\u4e0a\u3067\u3082\u3001<br \/>\n\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3053\u3068\u3067ESLint\u306e\u30eb\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h4>ESLint\u62e1\u5f35\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>\u4ee5\u4e0b\u30ea\u30f3\u30af\u304b\u3089VSCode\u306bESLint\u62e1\u5f35\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=dbaeumer.vscode-eslint\">https:\/\/marketplace.visualstudio.com\/items?itemName=dbaeumer.vscode-eslint<\/a><\/p>\n<h4>Flat-Config\u306e\u5229\u7528\u8a2d\u5b9a<\/h4>\n<p>VSCode\u306eSettings\u3088\u308a\u3001Eslint: Use Flat Config\u306e\u8a2d\u5b9a\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3066\u304f\u3060\u3055\u3044<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/enableFlatConfig.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/enableFlatConfig.png\" alt=\"\" \/><\/a><\/p>\n<h4>\u9055\u53cd\u7b87\u6240\u306e\u78ba\u8a8d<\/h4>\n<p>\u9055\u53cd\u7b87\u6240\u304c\u3042\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8d64\u8272\u306e\u6ce2\u7dda\u51fa\u3066\u304d\u307e\u3059\u3002<br \/>\n\u9055\u53cd\u7b87\u6240\u306b\u30ab\u30fc\u30bd\u30eb\u3092\u5408\u308f\u305b\u308b\u3068\u3001\u9055\u53cd\u3057\u305f\u30eb\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/ruleErrorOnVscode.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/ruleErrorOnVscode.png\" alt=\"\" \/><\/a><\/p>\n<h2>eslint-cdk-plugin\u306e\u5c0e\u5165<\/h2>\n<p>\u7d9a\u3044\u3066eslint-cdk-plugin\u3092\u5c0e\u5165\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>\u4ee5\u4e0b\u30b3\u30de\u30f3\u30c9\u3092\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u5b9f\u884c\u3057\u3001<br \/>\neslint-cdk-plugin\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p><code>npm install -D eslint-cdk-plugin<\/code><\/p>\n<h3>eslint.config.mjs\u3092\u7de8\u96c6<\/h3>\n<p>eslint.config.mjs\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7de8\u96c6\u3057\u3066\u3001<br \/>\neslint-cdk-plugin\u306e\u63a8\u5968\u30eb\u30fc\u30eb\u3092\u9069\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre>\n\/\/eslint.config.mjs\nimport eslint from \"@eslint\/js\";\nimport tsEslint from \"typescript-eslint\";\nimport cdkPlugin from \"eslint-cdk-plugin\"; \/\/ \u8ffd\u52a0\uff1aeslint-cdk-plugin\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\n\nexport default tsEslint.config(\n  eslint.configs.recommended,\n  tsEslint.configs.recommended,\n  cdkPlugin.configs.recommended, \/\/ \u8ffd\u52a0\uff1a eslint-cdk-plugin\u306e\u63a8\u5968\u30eb\u30fc\u30eb\u3092\u9069\u7528\n  {\n    ignores: [\"cdk.out\", \"node_modules\", \"*.js\"],\n  }\n);\n<\/pre>\n<p>eslint-cdk-plugin\u306e\u63a8\u5968\u30eb\u30fc\u30eb\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"https:\/\/eslint-cdk-plugin.dev\/ja\/rules\/\">https:\/\/eslint-cdk-plugin.dev\/ja\/rules\/<\/a><\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210<\/h3>\n<p>\u52d5\u4f5c\u78ba\u8a8d\u7528\u306e\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u3001<br \/>\nlib\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306avpc.ts\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre>\n\/\/ lib\/vpc.ts\nimport * as ec2 from 'aws-cdk-lib\/aws-ec2';\nimport {Construct} from 'constructs';\n\ninterface VpcProps {\n    readonly vpcName: string\n}\n\nexport class MyVpc extends Construct {\n    private readonly vpc: ec2.Vpc\n\n    constructor(scope: Construct, id: string, props: VpcProps) {\n        super(scope, id);\n\n           this.vpc = new ec2.Vpc(this, 'myVpc', {\n            vpcName: props.vpcName,\n        });\n    }\n}\n<\/pre>\n<p>\u4e0a\u8a18\u306evpc.ts\u3067\u306f\u3001<br \/>\neslint-cdk-plugin\u306e<a href=\"https:\/\/eslint-cdk-plugin.dev\/ja\/rules\/pascal-case-construct-id.html\" title=\"pascal-case-construct-id\">pascal-case-construct-id<\/a>\u3068\u3044\u3046\u30eb\u30fc\u30eb\u306b15\u884c\u76ee\u304c\u9055\u53cd\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306e\u30eb\u30fc\u30eb\u306fConstructID\u304c\u3001PascalCase\u3067\u306a\u3044\u3053\u3068\u3092\u691c\u77e5\u3059\u308b\u30eb\u30fc\u30eb\u3067\u3059\u3002<\/p>\n<h3>\u52d5\u4f5c\u78ba\u8a8d<\/h3>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067<code>npm run lint<\/code>\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u9055\u53cd\u306e\u691c\u77e5\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/detectViolationByCLI.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/detectViolationByCLI.png\" alt=\"\" \/><\/a><\/p>\n<p>VSCode\u4e0a\u3067\u3082\u3001\u9055\u53cd\u3092\u691c\u77e5\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/detectViolation.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/detectViolation.png\" alt=\"\" \/><\/a><\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306eConstructID\u3092PascalCase\u306b\u4fee\u6b63\u3059\u308b\u3053\u3068\u3067\u3001<br \/>\n\u8a72\u5f53\u7b87\u6240\u306e\u8d64\u6ce2\u7dda\u304c\u6d88\u3048\u3066\u3001\u30eb\u30fc\u30eb\u9055\u53cd\u306e\u89e3\u6d88\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\uff01<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/noViolation.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/noViolation.png\" alt=\"\" \/><\/a><\/p>\n<h4>CLI\u3067\u3082VSCode\u4e0a\u3067\u3082\u9055\u53cd\u3092\u691c\u77e5\u3067\u304d\u306a\u3044\u5834\u5408<\/h4>\n<p>\u4e0a\u8a18\u306e\u52d5\u4f5c\u78ba\u8a8d\u306b\u304a\u3044\u3066\u3001\u9055\u53cd\u3092\u691c\u77e5\u3067\u304d\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3053\u3061\u3089\u306ftypescript\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4e0a\u3052\u308b\u3053\u3068\u3067\u3001\u9055\u53cd\u306e\u691c\u77e5\u3092\u6b63\u5e38\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u4ed6ESLint\u306b\u4e0d\u5177\u5408\u304c\u3042\u308b\u5834\u5408\u306f\u3001VSCode\u306e\u30b3\u30de\u30f3\u30c9\u30d1\u30ec\u30c3\u30c8\u304b\u3089ESLint: Show Output Channel\u3092\u5b9f\u884c\u3057\u3066\u3001\u30a8\u30e9\u30fc\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/ESLintShow.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/ESLintShow.png\" alt=\"\" \/><\/a><\/p>\n<h3>\u30eb\u30fc\u30eb\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b<\/h3>\n<p>eslint-cdk-plugin\u306e\u63a8\u5968\u30eb\u30fc\u30eb\u306b\u52a0\u3048\u3066\u3001<br \/>\nstrict\u30eb\u30fc\u30eb\u3092\u500b\u5225\u3067\u8ffd\u52a0\u3059\u308b\u969b\u306e\u8a2d\u5b9a\u4f8b\u3092\u4ee5\u4e0b\u3067\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h4>eslint.config.mjs\u3092\u7de8\u96c6<\/h4>\n<p>\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3067\u306f\u3001lib\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068bin\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306ets\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3001<br \/>\n\u63a8\u5968\u30eb\u30fc\u30eb\u306b\u52a0\u3048\u3066\u3001<a href=\"https:\/\/eslint-cdk-plugin.dev\/ja\/rules\/no-import-private.html\" title=\"eslint-cdk-plugin\/no-import-private\u30eb\u30fc\u30eb\">eslint-cdk-plugin\/no-import-private\u30eb\u30fc\u30eb<\/a>\u3092\u9069\u7528\u3059\u308b\u3088\u3046\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>\nimport eslint from \"@eslint\/js\";\nimport tsEslint from \"typescript-eslint\";\nimport cdkPlugin from \"eslint-cdk-plugin\";\n\nexport default tsEslint.config(\n  \/\/\u63a8\u5968\u8a2d\u5b9a\u3092\u9069\u7528(\u5168\u4f53)\n  eslint.configs.recommended,\n  tsEslint.configs.recommended,\n  cdkPlugin.configs.recommended, \/\/plugins: {cdk:cdkPlugin}\u3092\u8a2d\u5b9a\u306b\u542b\u3080\u305f\u3081\u3001\u5f8c\u7d9a\u3067\u8a2d\u5b9a\u3057\u306a\u3044\n\n  \/\/cdk\/no-import-private\u30eb\u30fc\u30eb\u3092\u9069\u7528(lib\u3068bin\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306ets\u30d5\u30a1\u30a4\u30eb)\n  {\n    files: [\"lib\/**\/*.ts\", \"bin\/*.ts\"], \/\/\u9069\u7528\u7bc4\u56f2\u3092\u6307\u5b9a\n    rules: {\n          \"cdk\/no-import-private\": \"error\", \/\/\u30eb\u30fc\u30eb\u3092\u8ffd\u52a0\n    },\n  },\n\n  \/\/\u7121\u8996\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u30fb\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u6307\u5b9a(\u5168\u4f53)\n  {\n    ignores: [\"cdk.out\", \"node_modules\", \"*.js\"],\n  }\n);\n<\/pre>\n<h4>\u8ffd\u52a0\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u30eb\u30fc\u30eb\u306e\u52d5\u4f5c\u3092\u691c\u8a3c<\/h4>\n<p>\u5148\u307b\u3069\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9(lib\/vpc.ts)\u306b\u3001<br \/>\n\u8ffd\u52a0\u3057\u305fstrict\u30eb\u30fc\u30eb\u306b\u9055\u53cd\u3059\u308b\u3088\u3046\u8a18\u8ff0\u3092\u52a0\u3048\u3001\u691c\u8a3c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><strong>no-import-private\u30eb\u30fc\u30eb\u8a2d\u5b9a\u524d<\/strong><br \/>\n\u8d64\u67a0\u306e\u7b87\u6240\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/NoErrorDueToNoRule.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/NoErrorDueToNoRule.png\" alt=\"\" \/><\/a><\/p>\n<p><strong>no-import-private\u30eb\u30fc\u30eb\u8a2d\u5b9a\u5f8c<\/strong><br \/>\n\u8d64\u8272\u306e\u6ce2\u7dda\u304c\u51fa\u3066\u3001\u30a8\u30e9\u30fc\u304c\u691c\u77e5\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/errorDueToPrivateDirectory.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/errorDueToPrivateDirectory.png\" alt=\"\" \/><\/a><br \/>\n\u30ab\u30fc\u30bd\u30eb\u3092\u5f53\u3066\u308b\u3053\u3068\u3067\u3001\u30a8\u30e9\u30fc\u306e\u8a73\u7d30\u3082\u3057\u3063\u304b\u308a\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\uff01<br \/>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/errorDueToPrivateDirectoryDetail.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/04\/errorDueToPrivateDirectoryDetail.png\" alt=\"\" \/><\/a><\/p>\n<p>\u63a8\u5968\u30eb\u30fc\u30eb\u3092\u500b\u5225\u9069\u7528\u3059\u308b\u5834\u5408\u306f\u3001<br \/>\neslint-cdk-plugin\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b<a href=\"https:\/\/eslint-cdk-plugin.dev\/ja\/getting-started\/#%E3%83%AB%E3%83%BC%E3%83%AB%E3%81%AE%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%9E%E3%82%A4%E3%82%B9%E3%82%99\" title=\"\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u4f8b\">\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u4f8b<\/a>\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3082\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u3000\u307e\u3068\u3081<\/h2>\n<p>ESLint\u3068eslint-cdk-plugin\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001<br \/>\nAWS CDK\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u958b\u767a\u8005\u306e\u9593\u3067\u30eb\u30fc\u30eb\u3068\u3057\u3066\u5171\u6709\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u63a8\u5968\u30eb\u30fc\u30eb\u306e\u9069\u7528\u304b\u3089\u904b\u7528\u3092\u59cb\u3081\u3066\u3001<br \/>\n\u305d\u306e\u5f8c\u306b\u81ea\u5206\u305f\u3061\u306e\u30c1\u30fc\u30e0\u306e\u5b9f\u60c5\u306b\u5373\u3057\u305f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3092\u3057\u3066\u3044\u3051\u308c\u3070\u826f\u3044\u306e\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u307e\u3067\u76ee\u3092\u901a\u3057\u3066\u3044\u305f\u3060\u304d\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b ESLint\u3067CDK\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u81ea\u52d5\u3067\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3001 eslint-cdk-plugin\u306b\u3064\u3044\u3066\u8abf\u67fb\u30fb\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u691c\u8a3c\u74b0\u5883 \u4eca\u56de\u306fCDK\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u521d\u671f\u5316\u3057\u305f\u3068\u3053\u308d\u304b\u3089\u3001\u691c\u8a3c\u3092&#8230;<\/p>\n","protected":false},"author":232,"featured_media":28841,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/www.skyarch.net\/blog\/?p=28782","footnotes":""},"categories":[20,829],"tags":[706,1329],"class_list":{"0":"post-28782","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws","8":"category-cdk","9":"tag-aws-cdk","10":"tag-eslint","11":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/28782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/232"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=28782"}],"version-history":[{"count":69,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/28782\/revisions"}],"predecessor-version":[{"id":28842,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/28782\/revisions\/28842"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/28841"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=28782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=28782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=28782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}