{"id":14054,"date":"2021-08-16T21:59:24","date_gmt":"2021-08-16T12:59:24","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=14054"},"modified":"2023-05-27T20:52:36","modified_gmt":"2023-05-27T11:52:36","slug":"%e3%80%90javascript%e3%80%91%e3%80%8ctypescript%e3%80%8d%e3%81%a7eslint%e3%82%92%e4%bd%bf%e3%81%86%e3%81%9f%e3%82%81%e3%81%ae%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=14054","title":{"rendered":"\u3010JavaScript\u3011\u300cTypeScript\u300d\u3067ESlint\u3092\u4f7f\u3046\u305f\u3081\u306e\u8a2d\u5b9a"},"content":{"rendered":"<h2>\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<pre class=\"lang:default decode:true \">npm install @typescript-eslint\/eslint-plugin@latest --save-dev\r\n<\/pre>\n<h2>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(.eslintrc.json)<\/h2>\n<pre class=\"lang:default decode:true\">{\r\n  \"extends\": [\r\n    \"eslint:recommended\",\r\n    \"plugin:@typescript-eslint\/eslint-recommended\", \/\/ eslint:recommended\u306b\u542b\u307e\u308c\u308b\u30eb\u30fc\u30eb\u3092\u578b\u30c1\u30a7\u30c3\u30af\u3067\u30ab\u30d0\u30fc\u3067\u304d\u308b\u3082\u306e\u306f\u7121\u52b9\u5316\r\n    \"plugin:@typescript-eslint\/recommended\", \/\/ \u578b\u30c1\u30a7\u30c3\u30af\u304c\u4e0d\u8981\u306a\u30eb\u30fc\u30eb\u3092\u9069\u7528\r\n    \"plugin:@typescript-eslint\/recommended-requiring-type-checking\" \/\/ \u578b\u30c1\u30a7\u30c3\u30af\u304c\u5fc5\u8981\u306a\u30eb\u30fc\u30eb\u3092\u9069\u7528\r\n  ],\r\n  \"plugins\": [\r\n    \"@typescript-eslint\" \/\/ ESLint\u306eTypeScript\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30eb\u30fc\u30eb\u3092\u9069\u7528\u3067\u304d\u308b\u69d8\u306b\u3059\u308b\uff08\/eslint-plugin\u306f\u7701\u7565\u53ef\uff09\r\n  ],\r\n  \"parserOptions\": {\r\n    \"ecmaVersion\": 6,\r\n    \"project\": \".\/tsconfig.json\" \/\/ tsconfig.json\u306e\u5834\u6240\u3092\u6307\u5b9a\r\n  },\r\n  \"parser\": \"@typescript-eslint\/parser\", \/\/ ESLint\u306bTypeScript\u3092\u7406\u89e3\u3055\u305b\u308b\r\n  \"env\": { \"browser\": true, \"es6\": true },\r\n  \"globals\": {},\r\n  \"rules\": {}\r\n}<\/pre>\n<h3>parserOptions<\/h3>\n<p>TypeScript\u30b3\u30f3\u30d1\u30a4\u30eb\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002(\u4e0a\u306e\u4f8b\u3067\u8a00\u3048\u3070\u3001\u300ctsconfig.json\u300d)<\/p>\n<h4>\u6ce8\u610f\u70b9<\/h4>\n<p>tsconfig.json\u3092\u305d\u306e\u307e\u307e\u6307\u5b9a\u3057\u3066\u3057\u307e\u3046\u3068node_modules\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3082\u30d1\u30fc\u30b9\u3055\u308c\u3066\u3057\u307e\u3044\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u4f4e\u4e0b\u3059\u308b\u3089\u3057\u3044\u306e\u3067\u3001\u300ctsconfig.eslint.json\u300d\u307f\u305f\u3044\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u5225\u9014\u6307\u5b9a\u3057\u3066\u3042\u3052\u308b\u65b9\u304c\u826f\u3044\u305d\u3046\u3067\u3059\u3002<\/p>\n<h2>\u5b9f\u884c<\/h2>\n<pre class=\"lang:default decode:true\">eslint hello.ts<\/pre>\n<h2>rules<\/h2>\n<p>\u5b9f\u969b\u306e\u958b\u767a\u3067\u306f\u958b\u767a\u30e1\u30f3\u30d0\u30fc\u306b\u3088\u3063\u3066\u8a8d\u8b58\u306e\u5dee\u304c\u751f\u307e\u308c\u308b\u3053\u3068\u304c\u7d50\u69cb\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u4e00\u90e8\u306elint\u3092off\u306b\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true  \">rules{\r\n  '@typescript-eslint\/explicit-function-return-type': off\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb npm install @typescript-eslint\/eslint-plugin@latest --save-dev \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(.eslintrc.json) { \"exten [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14054"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14054"}],"version-history":[{"count":5,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14054\/revisions"}],"predecessor-version":[{"id":20271,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14054\/revisions\/20271"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14054"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}