{"id":3643,"date":"2026-10-30T10:31:00","date_gmt":"2026-10-30T01:31:00","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=3643"},"modified":"2026-10-30T10:31:00","modified_gmt":"2026-10-30T01:31:00","slug":"20261024-00mvlm0d-3","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2026\/10\/30\/20261024-00mvlm0d-3\/","title":{"rendered":"ESLint + Prettier + TypeScript \u304c\u7af6\u5408\u3057\u306a\u3044\u8a2d\u5b9a\u8853"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>ESLint\u30fbPrettier\u30fbTypeScript \u3092\u540c\u3058\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u5165\u308c\u308b\u3068\u3001\u300c\u4fdd\u5b58\u306e\u305f\u3073\u306b\u6574\u5f62\u304c\u66b4\u308c\u308b\u300d\u300c<code>npm run lint<\/code> \u3068 <code>npm run format<\/code> \u304c\u9006\u65b9\u5411\u306e\u4fee\u6b63\u3092\u51fa\u3059\u300d\u300c<code>eslint --fix<\/code> \u304c\u5ef6\u3005\u3068\u5dee\u5206\u3092\u751f\u3080\u300d\u3068\u3044\u3063\u305f\u7af6\u5408\u304c\u8d77\u304d\u307e\u3059\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u306f\u3001\u3053\u306e\u7af6\u5408\u306e\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u3001ESLint \u306e Flat Config\uff08<code>eslint.config.js<\/code>\uff09\u3067\u7af6\u5408\u3057\u306a\u3044\u69cb\u6210\u3092\u4f5c\u308b\u624b\u9806\u3092\u307e\u3068\u3081\u305f\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c8\u8a18\u4e8b\u3067\u3059\u3002\u7d50\u8ad6\u306f\u6b21\u306e3\u70b9\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u6574\u5f62\u306f Prettier\u3001\u30b3\u30fc\u30c9\u54c1\u8cea\u306f ESLint \u3068\u8cac\u52d9\u3092\u5206\u3051\u308b<\/li>\n<li>ESLint \u306e\u6574\u5f62\u7cfb\u30eb\u30fc\u30eb\u3092 <code>eslint-config-prettier<\/code> \u3067\u7121\u52b9\u5316\u3059\u308b<\/li>\n<li><code>eslint-plugin-prettier<\/code>\uff08ESLint \u304b\u3089 Prettier \u3092\u56de\u3059\uff09\u306f\u539f\u5247\u3084\u3081\u308b<\/li>\n<\/ol>\n<p>&gt; \u306a\u304a ESLint \u306f v10.0.0\uff082026-02\uff09\u3067\u5f93\u6765\u306e <code>.eslintrc<\/code> \u8a2d\u5b9a\u30b7\u30b9\u30c6\u30e0\u304c\u5b8c\u5168\u306b\u524a\u9664\u3055\u308c\u307e\u3057\u305f\u3002<code>.eslintrc.*<\/code> \/ <code>.eslintignore<\/code> \u3084 <code>--no-eslintrc<\/code> \u306a\u3069\u306f v10 \u3067\u306f\u8aad\u307e\u308c\u305a\u3001\u8a2d\u5b9a\u306f Flat Config \u306e\u307f\u304c\u6b63\u3068\u306a\u308a\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3082 Flat Config \u3092\u6b63\u3068\u3057\u3066\u6271\u3044\u3001<code>.eslintrc<\/code> \u306f v9 \u4ee5\u524d\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306e\u53c2\u8003\u306b\u7559\u3081\u307e\u3059\u3002<\/p>\n<h2>\u74b0\u5883<\/h2>\n<ul>\n<li>Node.js 24.x\uff08LTS\uff09\/ TypeScript 7.x<\/li>\n<li>ESLint 10.x\uff08Flat Config\uff09\/ typescript-eslint 8.x<\/li>\n<li>Prettier 3.x \/ eslint-config-prettier 10.x<\/li>\n<\/ul>\n<h2>\u767a\u751f\u3057\u305f\u554f\u984c<\/h2>\n<p>\u5178\u578b\u7684\u306a\u75c7\u72b6\u306f3\u3064\u3067\u3059\u3002<\/p>\n<ol>\n<li><strong>\u6574\u5f62\u306e\u5f80\u5fa9<\/strong>: \u4fdd\u5b58\u306e\u305f\u3073\u306b ESLint \u306e <code>--fix<\/code> \u3068 Prettier \u306e format \u304c\u5225\u3005\u306b\u8d70\u308a\u3001\u30a4\u30f3\u30c7\u30f3\u30c8\u3084\u30af\u30a9\u30fc\u30c8\u304c\u4ea4\u4e92\u306b\u66f8\u304d\u63db\u308f\u308b\u3002<\/li>\n<li><strong>lint \u3068 format \u304c\u9006<\/strong>: ESLint \u306f\u300c\u30bb\u30df\u30b3\u30ed\u30f3\u3092\u6d88\u305b\u300d\u3001Prettier \u306f\u300c\u30bb\u30df\u30b3\u30ed\u30f3\u3092\u4ed8\u3051\u308d\u300d\u3002\u3069\u3061\u3089\u3092\u6b63\u3068\u3057\u3066\u3082\u7247\u65b9\u304c\u6012\u308b\u3002<\/li>\n<li><strong><code>eslint --fix<\/code> \u304c\u9045\u3044\u30fb\u5dee\u5206\u304c\u3046\u308b\u3055\u3044<\/strong>: <code>eslint-plugin-prettier<\/code> \u3092\u5165\u308c\u3066\u3044\u308b\u3068\u3001Prettier \u306e\u6574\u5f62\u5dee\u5206\u304c ESLint \u30a8\u30e9\u30fc\u3068\u3057\u30661\u884c\u305a\u3064\u5831\u544a\u3055\u308c\u3001lint \u304c\u91cd\u304f\u306a\u308b\u3002<\/li>\n<\/ol>\n<h2>\u539f\u56e0<\/h2>\n<p>\u6839\u672c\u539f\u56e0\u306f\u3001<strong>\u300c\u6574\u5f62\u300d\u3068\u3044\u3046\u540c\u3058\u4ed5\u4e8b\u3092 ESLint \u3068 Prettier \u306e\u4e21\u65b9\u304c\u62c5\u5f53\u3057\u3066\u3044\u308b\u3053\u3068<\/strong>\u3067\u3059\u3002<\/p>\n<p>ESLint \u306b\u306f <code>indent<\/code> \/ <code>quotes<\/code> \/ <code>semi<\/code> \/ <code>comma-dangle<\/code> \u306a\u3069\u6574\u5f62\u7cfb\u30eb\u30fc\u30eb\u304c\u3042\u308a\u3001Prettier \u306e\u6574\u5f62\u3068\u885d\u7a81\u3057\u307e\u3059\u3002\u3055\u3089\u306b <code>eslint-plugin-prettier<\/code> \u3092\u4f7f\u3046\u3068\u3001ESLint \u5b9f\u884c\u4e2d\u306b Prettier \u3092\u547c\u3073\u51fa\u3057\u3066\u300c\u6574\u5f62\u3055\u308c\u3066\u3044\u306a\u3044\u7b87\u6240\u300d\u3092\u3059\u3079\u3066\u30a8\u30e9\u30fc\u5316\u3059\u308b\u305f\u3081\u3001\u672c\u8cea\u7684\u306a\u30d0\u30b0\u3068\u6574\u5f62\u5dee\u5206\u304c\u30ed\u30b0\u4e0a\u3067\u6df7\u3056\u308a\u307e\u3059\u3002<\/p>\n<h2>\u5bfe\u5fdc\u65b9\u6cd5<\/h2>\n<p>\u65b9\u91dd\u306f\u8cac\u52d9\u5206\u96e2\u3067\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u30c4\u30fc\u30eb<\/th>\n<th>\u62c5\u5f53<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Prettier<\/td>\n<td>\u30b3\u30fc\u30c9\u306e\u6574\u5f62\uff08\u898b\u305f\u76ee\uff09<\/td>\n<\/tr>\n<tr>\n<td>ESLint<\/td>\n<td>\u30b3\u30fc\u30c9\u54c1\u8cea\uff08\u30d0\u30b0\u306e\u82bd\u30fb\u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\uff09<\/td>\n<\/tr>\n<tr>\n<td>TypeScript<\/td>\n<td>\u578b\u30c1\u30a7\u30c3\u30af<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol>\n<li>ESLint \u306e\u6574\u5f62\u7cfb\u30eb\u30fc\u30eb\u3092 <code>eslint-config-prettier<\/code> \u3067\u7121\u52b9\u5316\u3059\u308b<\/li>\n<li>\u6574\u5f62\u306f <code>prettier --write<\/code> \u306b\u4e00\u672c\u5316\u3059\u308b<\/li>\n<li><code>eslint-plugin-prettier<\/code> \u306f\u539f\u5247\u4f7f\u308f\u306a\u3044<\/li>\n<\/ol>\n<h2>\u5b9f\u88c5\u4f8b<\/h2>\n<h3>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<pre class=\"lang:default decode:true\">npm i -D eslint prettier typescript \\\n  typescript-eslint eslint-config-prettier<\/pre>\n<h3>ESLint Flat Config\uff08<code>eslint.config.js<\/code>\uff09<\/h3>\n<p>ESLint v9 \u4ee5\u964d\u306e\u6a19\u6e96\u3067\u3042\u308a\u3001v10 \u3067\u306f\u552f\u4e00\u306e\u8a2d\u5b9a\u65b9\u5f0f\u3067\u3059\u3002<code>eslintConfigPrettier<\/code> \u3092\u914d\u5217\u306e\u6700\u5f8c\u306b\u7f6e\u304f\u3053\u3068\u3067\u3001\u5f8c\u52dd\u3061\u3067\u6574\u5f62\u7cfb\u30eb\u30fc\u30eb\u3092\u7121\u52b9\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">import js from \"@eslint\/js\";\nimport tseslint from \"typescript-eslint\";\nimport eslintConfigPrettier from \"eslint-config-prettier\";\n\nexport default [\n  js.configs.recommended,\n  ...tseslint.configs.recommended,\n  {\n    rules: {\n      \"@typescript-eslint\/no-unused-vars\": [\n        \"warn\",\n        { argsIgnorePattern: \"^_\" },\n      ],\n      \"no-console\": \"warn\",\n    },\n  },\n  eslintConfigPrettier, \/\/ \u5fc5\u305a\u6700\u5f8c\n];<\/pre>\n<h3>\u5f93\u6765\u306e <code>.eslintrc<\/code>\uff08v9 \u4ee5\u524d\u5411\u3051\u30fbv10 \u3067\u306f\u5229\u7528\u4e0d\u53ef\uff09<\/h3>\n<p>ESLint v9 \u4ee5\u524d\u3067 <code>.eslintrc<\/code> \u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u3001<code>extends<\/code> \u306e\u6700\u5f8c\u306b <code>\"prettier\"<\/code> \u3092\u7f6e\u304f\u306e\u304c\u9244\u5247\u3067\u3059\u3002\u305f\u3060\u3057 v10 \u3067\u306f <code>.eslintrc<\/code> \u81ea\u4f53\u304c\u8aad\u307e\u308c\u306a\u304f\u306a\u3063\u305f\u305f\u3081\u3001\u3053\u306e\u5f62\u5f0f\u306f\u4f7f\u3048\u307e\u305b\u3093\u3002v10 \u3078\u4e0a\u3052\u308b\u5834\u5408\u306f <code>npx @eslint\/migrate-config .eslintrc.json<\/code> \u3067 Flat Config \u3078\u79fb\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"lang:default decode:true\">{\n  \"root\": true,\n  \"parser\": \"@typescript-eslint\/parser\",\n  \"plugins\": [\"@typescript-eslint\"],\n  \"extends\": [\n    \"eslint:recommended\",\n    \"plugin:@typescript-eslint\/recommended\",\n    \"prettier\"\n  ]\n}<\/pre>\n<h3>Prettier \u8a2d\u5b9a\uff08<code>.prettierrc.json<\/code>\uff09<\/h3>\n<pre class=\"lang:default decode:true\">{\n  \"semi\": true,\n  \"singleQuote\": false,\n  \"printWidth\": 100,\n  \"tabWidth\": 2,\n  \"trailingComma\": \"all\"\n}<\/pre>\n<h3>npm scripts<\/h3>\n<pre class=\"lang:default decode:true\">{\n  \"scripts\": {\n    \"lint\": \"eslint .\",\n    \"lint:fix\": \"eslint . --fix\",\n    \"format\": \"prettier --write .\",\n    \"format:check\": \"prettier --check .\"\n  }\n}<\/pre>\n<h3>VSCode\uff08<code>.vscode\/settings.json<\/code>\uff09<\/h3>\n<pre class=\"lang:default decode:true\">{\n  \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n  \"editor.formatOnSave\": true,\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": \"explicit\"\n  }\n}<\/pre>\n<h2>\u78ba\u8a8d\u65b9\u6cd5<\/h2>\n<h3>\u7af6\u5408\u30eb\u30fc\u30eb\u306e\u6b8b\u5b58\u30c1\u30a7\u30c3\u30af<\/h3>\n<pre class=\"lang:default decode:true\">npx eslint-config-prettier eslint.config.js<\/pre>\n<p>\u300cNo rules that are unnecessary or conflict with Prettier were found.\u300d\u3068\u51fa\u308c\u3070\u3001ESLint \u5074\u306b\u6574\u5f62\u7cfb\u30eb\u30fc\u30eb\u304c\u6b8b\u3063\u3066\u3044\u306a\u3044\u8a3c\u62e0\u3067\u3059\u3002\u6b8b\u3063\u3066\u3044\u308c\u3070\u30eb\u30fc\u30eb\u540d\u304c\u5217\u6319\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>\u6574\u5f62\u5f8c\u306b\u5dee\u5206\u304c\u5897\u3048\u306a\u3044\u3053\u3068<\/h3>\n<pre class=\"lang:default decode:true\">npm run format\nnpm run lint\ngit diff --stat   # \u6574\u5f62\u7531\u6765\u306e\u5dee\u5206\u304c\u51fa\u306a\u3044\u3053\u3068<\/pre>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<ul>\n<li><strong><code>eslintConfigPrettier<\/code> \u306f\u5fc5\u305a\u6700\u5f8c<\/strong>\u306b\u7f6e\u304f\u3002\u9014\u4e2d\u306b\u7f6e\u304f\u3068\u5f8c\u7d9a\u8a2d\u5b9a\u304c\u6574\u5f62\u30eb\u30fc\u30eb\u3092\u5fa9\u6d3b\u3055\u305b\u3001\u7af6\u5408\u304c\u518d\u767a\u3059\u308b\u3002<\/li>\n<li><strong><code>eslint-plugin-prettier<\/code>\uff08ESLint \u304b\u3089 Prettier \u5b9f\u884c\uff09\u3068 <code>eslint-config-prettier<\/code>\uff08\u6574\u5f62\u30eb\u30fc\u30eb\u7121\u52b9\u5316\uff09\u306f\u5225\u7269<\/strong>\u3002\u672c\u69cb\u6210\u3067\u5fc5\u9808\u306a\u306e\u306f\u5f8c\u8005\u3060\u3051\u3002<\/li>\n<li>CI \u306f <code>lint<\/code> \u3068 <code>format:check<\/code> \u3092\u5225\u30b9\u30c6\u30c3\u30d7\u306b\u3059\u308b\u3068\u3001\u5931\u6557\u7406\u7531\u304c\u300c\u30d0\u30b0\u300d\u304b\u300c\u6574\u5f62\u300d\u304b\u3067\u8aad\u307f\u5206\u3051\u3084\u3059\u3044\u3002<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>\u7af6\u5408\u306e\u539f\u56e0\u306f\u300c\u6574\u5f62\u3092 ESLint \u3068 Prettier \u304c\u4e8c\u91cd\u306b\u62c5\u5f53\u3059\u308b\u300d\u3053\u3068<\/li>\n<li>\u6574\u5f62\u306f Prettier\u3001\u54c1\u8cea\u306f ESLint\u3001\u578b\u306f TypeScript \u3068\u8cac\u52d9\u3092\u5206\u3051\u308b<\/li>\n<li><code>eslint-config-prettier<\/code> \u3092\u8a2d\u5b9a\u306e\u6700\u5f8c\u306b\u7f6e\u304d\u3001ESLint \u306e\u6574\u5f62\u30eb\u30fc\u30eb\u3092\u7121\u52b9\u5316\u3059\u308b<\/li>\n<li>\u6574\u5f62\u306f <code>prettier --write<\/code> \u306b\u4e00\u672c\u5316\u3057\u3001<code>npx eslint-config-prettier<\/code> \u3067\u6b8b\u5b58\u7af6\u5408\u3092\u78ba\u8a8d\u3059\u308b<\/li>\n<\/ul>\n<p>\u3053\u306e3\u70b9\u3092\u62bc\u3055\u3048\u308b\u3060\u3051\u3067\u3001\u300c\u4fdd\u5b58\u306e\u305f\u3073\u306b\u5dee\u5206\u304c\u66b4\u308c\u308b\u300d\u554f\u984c\u306f\u307b\u307c\u89e3\u6d88\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ESLint\u30fbPrettier\u30fbTypeScript \u3092\u540c\u3058\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u5165\u308c\u308b\u3068\u3001\u300c\u4fdd\u5b58\u306e\u305f\u3073\u306b\u6574\u5f62\u304c\u66b4\u308c\u308b\u300d\u300cnpm run lint \u3068 npm run format \u304c\u9006\u65b9\u5411\u306e\u4fee\u6b63\u3092\u51fa\u3059\u300d\u300ceslint --fix \u304c\u5ef6\u3005\u3068\u5dee\u5206\u3092\u751f\u2026<\/p>\n","protected":false},"author":1,"featured_media":3642,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_lightning_design_setting":[],"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[36],"tags":[1192,1191],"class_list":["post-3643","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-memorandum","tag-eslint","tag-typescript"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2026\/10\/20261024-00mvlm0d-thumbnail-2.jpg","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=3643"}],"version-history":[{"count":1,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3643\/revisions"}],"predecessor-version":[{"id":3644,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3643\/revisions\/3644"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/3642"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=3643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=3643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=3643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}