{"id":3472,"date":"2026-09-26T09:21:34","date_gmt":"2026-09-26T00:21:34","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=3472"},"modified":"2026-09-26T09:21:34","modified_gmt":"2026-09-26T00:21:34","slug":"20260828-00mtcftc","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2026\/09\/26\/20260828-00mtcftc\/","title":{"rendered":"ESLint + Prettier \u306e\u8a2d\u5b9a\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\uff08React \/ TypeScript\uff09"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>React \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067 ESLint \u3068 Prettier \u3092\u4f75\u7528\u3059\u308b\u3068\u3001\u300c\u4fdd\u5b58\u306e\u305f\u3073\u306b\u6574\u5f62\u304c\u7af6\u5408\u3057\u3066\u6012\u3089\u308c\u308b\u300d\u300c\u3069\u3061\u3089\u304c\u4f55\u3092\u62c5\u5f53\u3057\u3066\u3044\u308b\u306e\u304b\u66d6\u6627\u306a\u307e\u307e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c\u80a5\u5927\u5316\u3059\u308b\u300d\u3068\u3044\u3046\u554f\u984c\u304c\u8d77\u304d\u304c\u3061\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<strong>ESLint \u306f\u30b3\u30fc\u30c9\u306e\u54c1\u8cea\uff08\u30d0\u30b0\u306e\u82bd\u30fb\u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\uff09\u3092\u3001Prettier \u306f\u898b\u305f\u76ee\uff08\u6574\u5f62\uff09\u3092\u62c5\u5f53\u3059\u308b<\/strong>\u3068\u3044\u3046\u5f79\u5272\u5206\u62c5\u3092\u8ef8\u306b\u3001\u4e21\u8005\u3092\u7af6\u5408\u3055\u305b\u305a\u306b\u5171\u5b58\u3055\u305b\u308b\u8a2d\u5b9a\u3092\u30cf\u30f3\u30ba\u30aa\u30f3\u3067\u7d44\u307f\u7acb\u3066\u307e\u3059\u3002ESLint v9 \u306e Flat Config\uff08<code>eslint.config.js<\/code>\uff09\u3092\u524d\u63d0\u306b\u3057\u307e\u3059\u3002<\/p>\n<h2>\u74b0\u5883<\/h2>\n<ul>\n<li>Node.js 20 \u4ee5\u4e0a<\/li>\n<li>React 18 \/ 19<\/li>\n<li>TypeScript 5 \u7cfb<\/li>\n<li>ESLint 9 \u7cfb\uff08Flat Config\uff09<\/li>\n<li>Prettier 3 \u7cfb<\/li>\n<\/ul>\n<h2>\u305d\u3082\u305d\u3082\u306e\u5f79\u5272\u5206\u62c5<\/h2>\n<p>\u6700\u521d\u306b\u62bc\u3055\u3048\u308b\u3079\u304d\u306f\u3001<strong>ESLint \u3068 Prettier \u306e\u8cac\u52d9\u3092\u91cd\u306d\u306a\u3044<\/strong>\u3068\u3044\u3046\u539f\u5247\u3067\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u30c4\u30fc\u30eb<\/th>\n<th>\u62c5\u5f53<\/th>\n<th>\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ESLint<\/td>\n<td>\u30b3\u30fc\u30c9\u54c1\u8cea\u30fb\u30ed\u30b8\u30c3\u30af<\/td>\n<td>\u672a\u4f7f\u7528\u5909\u6570\u3001<code>useEffect<\/code> \u306e\u4f9d\u5b58\u6f0f\u308c\u3001<code>==<\/code> \u306e\u8aa4\u7528<\/td>\n<\/tr>\n<tr>\n<td>Prettier<\/td>\n<td>\u6574\u5f62\uff08\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\uff09<\/td>\n<td>\u30a4\u30f3\u30c7\u30f3\u30c8\u3001\u30af\u30a9\u30fc\u30c8\u3001\u30bb\u30df\u30b3\u30ed\u30f3\u3001\u884c\u5e45<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u304b\u3064\u3066\u306f ESLint \u5074\u306b\u3082\u30a4\u30f3\u30c7\u30f3\u30c8\u3084\u30af\u30a9\u30fc\u30c8\u3092\u6574\u3048\u308b\u300c\u30b9\u30bf\u30a4\u30eb\u7cfb\u30eb\u30fc\u30eb\u300d\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u3092\u6709\u52b9\u306b\u3059\u308b\u3068 Prettier \u3068\u885d\u7a81\u3057\u307e\u3059\u3002\u305d\u3053\u3067 <strong>\u6574\u5f62\u306f Prettier \u306b\u4e00\u4efb\u3057\u3001ESLint \u5074\u306e\u6574\u5f62\u30eb\u30fc\u30eb\u306f\u7121\u52b9\u5316\u3059\u308b<\/strong>\u306e\u304c\u5b9a\u77f3\u3067\u3059\u3002\u3053\u306e\u7121\u52b9\u5316\u3092\u62c5\u3046\u306e\u304c <code>eslint-config-prettier<\/code> \u3067\u3059\u3002<\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<pre class=\"lang:default decode:true\">pnpm add -D eslint @eslint\/js typescript-eslint \\\n  eslint-plugin-react eslint-plugin-react-hooks \\\n  eslint-config-prettier prettier<\/pre>\n<ul>\n<li><code>@eslint\/js<\/code> \u2014 ESLint \u516c\u5f0f\u306e\u63a8\u5968\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8<\/li>\n<li><code>typescript-eslint<\/code> \u2014 TS \u7528\u30d1\u30fc\u30b5\uff0b\u30eb\u30fc\u30eb<\/li>\n<li><code>eslint-plugin-react<\/code> \/ <code>eslint-plugin-react-hooks<\/code> \u2014 React \u56fa\u6709\u30eb\u30fc\u30eb<\/li>\n<li><code>eslint-config-prettier<\/code> \u2014 Prettier \u3068\u885d\u7a81\u3059\u308b\u6574\u5f62\u30eb\u30fc\u30eb\u3092\u307e\u3068\u3081\u3066\u7121\u52b9\u5316<\/li>\n<li><code>prettier<\/code> \u2014 \u6574\u5f62\u672c\u4f53<\/li>\n<\/ul>\n<h2>Prettier \u306e\u8a2d\u5b9a<\/h2>\n<p><code>.prettierrc.json<\/code> \u3092\u7528\u610f\u3057\u307e\u3059\u3002\u8a2d\u5b9a\u306f\u300c\u30c1\u30fc\u30e0\u3067\u63c9\u3081\u305d\u3046\u306a\u9805\u76ee\u3060\u3051\u300d\u660e\u793a\u3057\u3001\u3042\u3068\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u5f93\u3046\u306e\u304c\u4fdd\u5b88\u7684\u3067\u697d\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">{\n  \"semi\": true,\n  \"singleQuote\": true,\n  \"trailingComma\": \"all\",\n  \"printWidth\": 100,\n  \"tabWidth\": 2,\n  \"arrowParens\": \"always\"\n}<\/pre>\n<p>\u6574\u5f62\u5bfe\u8c61\u5916\u306b\u3057\u305f\u3044\u3082\u306e\u306f <code>.prettierignore<\/code> \u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">dist\nbuild\ncoverage\npnpm-lock.yaml<\/pre>\n<h2>ESLint Flat Config \u3092\u7d44\u307f\u7acb\u3066\u308b<\/h2>\n<p><code>eslint.config.js<\/code> \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<strong>\u914d\u5217\u306f\u4e0a\u304b\u3089\u9806\u306b\u9069\u7528\u3055\u308c\u3001\u5f8c\u306e\u8981\u7d20\u304c\u524d\u306e\u8981\u7d20\u3092\u4e0a\u66f8\u304d\u3059\u308b<\/strong>\u306e\u304c\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002\u305d\u306e\u305f\u3081 <code>eslint-config-prettier<\/code> \u306f\u5fc5\u305a<strong>\u6700\u5f8c<\/strong>\u306b\u7f6e\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">\/\/ eslint.config.js\nimport js from '@eslint\/js';\nimport tseslint from 'typescript-eslint';\nimport react from 'eslint-plugin-react';\nimport reactHooks from 'eslint-plugin-react-hooks';\nimport prettier from 'eslint-config-prettier';\n\nexport default tseslint.config(\n  { ignores: ['dist', 'build', 'coverage'] },\n\n  js.configs.recommended,\n  ...tseslint.configs.recommended,\n\n  {\n    files: ['**\/*.{ts,tsx}'],\n    plugins: {\n      react,\n      'react-hooks': reactHooks,\n    },\n    languageOptions: {\n      parserOptions: {\n        ecmaFeatures: { jsx: true },\n      },\n    },\n    settings: {\n      react: { version: 'detect' },\n    },\n    rules: {\n      ...react.configs.recommended.rules,\n      ...reactHooks.configs.recommended.rules,\n      'react\/react-in-jsx-scope': 'off', \/\/ React 17+ \u306e\u65b0 JSX Transform\n      'react\/prop-types': 'off',         \/\/ TypeScript \u3067\u578b\u3092\u4ed8\u3051\u308b\u306e\u3067\u4e0d\u8981\n    },\n  },\n\n  {\n    rules: {\n      '@typescript-eslint\/no-unused-vars': [\n        'warn',\n        { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },\n      ],\n    },\n  },\n\n  prettier, \/\/ \u2605\u5fc5\u305a\u6700\u5f8c\u2605\n);<\/pre>\n<h2>\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6574\u3048\u308b<\/h2>\n<p><code>package.json<\/code> \u306b\u3001lint \u3068 format \u3092\u5206\u3051\u3066\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\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<p>CI \u3067\u306f\u691c\u67fb\u3060\u3051\u3057\u305f\u3044\u306e\u3067 <code>lint<\/code> \u3068 <code>format:check<\/code> \u3092\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u306f <code>lint:fix<\/code> \u3068 <code>format<\/code> \u3092\u4f7f\u3046\u3001\u3068\u3044\u3046\u5207\u308a\u5206\u3051\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30a8\u30c7\u30a3\u30bf\u9023\u643a\uff08VS Code\uff09<\/h2>\n<p><code>.vscode\/settings.json<\/code> \u306b\u7f6e\u304f\u3068\u30c1\u30fc\u30e0\u5168\u4f53\u3067\u63c3\u3044\u307e\u3059\u3002<\/p>\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<ol>\n<li>\u308f\u3056\u3068\u6574\u5f62\u304c\u5d29\u308c\u305f TSX \u3092\u66f8\u304f<\/li>\n<li><code>pnpm lint<\/code> \u3092\u5b9f\u884c \u2192 <strong>\u6574\u5f62\u306e\u4e71\u308c\u3067\u306f\u6012\u3089\u308c\u306a\u3044<\/strong>\u3053\u3068\u3092\u78ba\u8a8d<\/li>\n<li><code>pnpm format<\/code> \u3092\u5b9f\u884c \u2192 \u6574\u5f62\u304c\u76f4\u308b\u3053\u3068\u3092\u78ba\u8a8d<\/li>\n<li>\u7af6\u5408\u30c1\u30a7\u30c3\u30af\u3092\u5b9f\u884c\uff1a<\/li>\n<\/ol>\n<pre class=\"lang:default decode:true\">npx eslint-config-prettier eslint.config.js<\/pre>\n<p><code>No rules that are unnecessary or conflict with Prettier were found.<\/code> \u3068\u51fa\u308c\u3070\u6b63\u5e38\u3067\u3059\u3002<\/p>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<ul>\n<li><strong><code>eslint-config-prettier<\/code> \u306f\u6700\u5f8c\u306b\u7f6e\u304f<\/strong>\u3002\u9806\u756a\u3092\u9593\u9055\u3048\u308b\u3068\u6574\u5f62\u30eb\u30fc\u30eb\u304c\u5fa9\u6d3b\u3057\u307e\u3059\u3002<\/li>\n<li><strong><code>eslint-plugin-prettier<\/code> \u306f\u539f\u5247\u4e0d\u8981<\/strong>\u3002\u6574\u5f62\u30ba\u30ec\u304c lint \u30a8\u30e9\u30fc\u306b\u306a\u308a\u7169\u96d1\u30fb\u4f4e\u901f\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<li><strong><code>react\/react-in-jsx-scope<\/code> \u306f React 17 \u4ee5\u964d\u30aa\u30d5\u3067\u3088\u3044<\/strong>\u3002\u6709\u52b9\u306e\u307e\u307e\u3060\u3068\u8aa4\u691c\u77e5\u3057\u307e\u3059\u3002<\/li>\n<li><strong>\u30eb\u30fc\u30eb\u3092\u76db\u308a\u3059\u304e\u306a\u3044<\/strong>\u3002recommended \uff0b\u6570\u500b\u3067\u59cb\u3081\u3001\u6469\u64e6\u306e\u51fa\u305f\u9805\u76ee\u3060\u3051\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>ESLint = \u54c1\u8cea\u3001Prettier = \u6574\u5f62\u3001\u3068<strong>\u8cac\u52d9\u3092\u91cd\u306d\u306a\u3044<\/strong>\u306e\u304c\u51fa\u767a\u70b9<\/li>\n<li>\u7af6\u5408\u306f <code>eslint-config-prettier<\/code> \u3092 <strong>Flat Config \u306e\u6700\u5f8c<\/strong>\u306b\u7f6e\u304f\u3060\u3051\u3067\u89e3\u6d88<\/li>\n<li><code>eslint-plugin-prettier<\/code> \u306f\u4f7f\u308f\u305a\u3001lint \u3068 format \u3092<strong>\u5225\u30b3\u30de\u30f3\u30c9<\/strong>\u3067\u56de\u3059<\/li>\n<li>\u8ff7\u3063\u305f\u3089 recommended \u304b\u3089\u59cb\u3081\u3001\u6469\u64e6\u306e\u51fa\u305f\u7b87\u6240\u3060\u3051\u8db3\u3059<\/li>\n<\/ul>\n<p>\u3053\u306e\u5206\u62c5\u3092\u6700\u521d\u306b\u6c7a\u3081\u3066\u304a\u304f\u3068\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u5927\u304d\u304f\u306a\u3063\u3066\u3082\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c\u7834\u7dbb\u3057\u306b\u304f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>React \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067 ESLint \u3068 Prettier \u3092\u4f75\u7528\u3059\u308b\u3068\u3001\u300c\u4fdd\u5b58\u306e\u305f\u3073\u306b\u6574\u5f62\u304c\u7af6\u5408\u3057\u3066\u6012\u3089\u308c\u308b\u300d\u300c\u3069\u3061\u3089\u304c\u4f55\u3092\u62c5\u5f53\u3057\u3066\u3044\u308b\u306e\u304b\u66d6\u6627\u306a\u307e\u307e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c\u80a5\u5927\u5316\u3059\u308b\u300d\u3068\u3044\u3046\u554f\u984c\u304c\u8d77\u304d\u304c\u3061\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":3471,"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":"","_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,1161,1191],"class_list":["post-3472","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-memorandum","tag-eslint","tag-react","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\/09\/20260828-00mtcftc-thumbnail.png","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3472","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=3472"}],"version-history":[{"count":1,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3472\/revisions"}],"predecessor-version":[{"id":3473,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3472\/revisions\/3473"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/3471"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=3472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=3472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=3472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}