{"id":7438,"date":"2016-05-25T09:07:22","date_gmt":"2016-05-25T00:07:22","guid":{"rendered":"http:\/\/www.gesource.jp\/weblog\/?p=7438"},"modified":"2017-09-29T18:28:58","modified_gmt":"2017-09-29T09:28:58","slug":"visual-studio-code%e3%81%a7eslint%e3%82%92%e4%bd%bf%e3%81%86","status":"publish","type":"post","link":"https:\/\/www.gesource.jp\/weblog\/?p=7438","title":{"rendered":"Visual Studio Code\u3067ESLint\u3092\u4f7f\u3046"},"content":{"rendered":"<h2>eslint\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n<p>ESLint\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304b\u3089\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3001ESLint\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre><code>npm install -g eslint\n<\/code><\/pre>\n<p>ESLint\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>eslint -v\n<\/code><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308c\u3070\u3001ESLint\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre><code>v3.3.1\n<\/code><\/pre>\n<h2><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=dbaeumer.vscode-eslint\">VS Code ESLint extension<\/a>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n<p>Visual Studio Code\u3067\u300cCtrl+P\u300d\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3001Enter\u30ad\u30fc\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n<pre><code>ext install vscode-eslint\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/weblog\/wp-content\/uploads\/2016\/05\/eslint01-300x214.png\" alt=\"eslint01\" width=\"300\" height=\"214\" class=\"alignnone size-medium wp-image-7439\" srcset=\"https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint01.png?resize=300%2C214&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint01.png?resize=768%2C547&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint01.png?resize=730%2C520&amp;ssl=1 730w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint01.png?w=870&amp;ssl=1 870w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/weblog\/wp-content\/uploads\/2016\/05\/eslint02-300x214.png\" alt=\"eslint02\" width=\"300\" height=\"214\" class=\"alignnone size-medium wp-image-7440\" srcset=\"https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint02.png?resize=300%2C214&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint02.png?resize=768%2C547&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint02.png?resize=730%2C520&amp;ssl=1 730w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint02.png?w=870&amp;ssl=1 870w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=dbaeumer.vscode-eslint\">VS Code ESLint extension<\/a>\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=dbaeumer.vscode-eslint\">VS Code ESLint extension<\/a>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(settings.json)\u306e&#8221;eslint.enable&#8221;\u304ctrue\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5ff5\u306e\u305f\u3081\u3001\u6a19\u6e96\u306eJavaScript\u306e\u691c\u8a3c\u6a5f\u80fd\u3092\u7121\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u30e1\u30cb\u30e5\u30fc\u306e\u300c\u30d5\u30a1\u30a4\u30eb\u300d\u2192\u300c\u57fa\u672c\u8a2d\u5b9a\u300d\u2192\u300c\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<p>\u53f3\u5074\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u300c&#8221;javascript.validate.enable&#8221;: false\u300d\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre><code>\/\/ \u65e2\u5b9a\u306e\u8a2d\u5b9a\u3092\u4e0a\u66f8\u304d\u3059\u308b\u306b\u306f\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u8a2d\u5b9a\u3092\u633f\u5165\u3057\u307e\u3059\n{\n    \/\/ JavaScript \u306e\u691c\u8a3c\u3092\u6709\u52b9\/\u7121\u52b9\u306b\u3057\u307e\u3059\n    \"javascript.validate.enable\": false\n}\n<\/code><\/pre>\n<h2>npm init<\/h2>\n<p>\u300cnpm init\u300d\u3092\u5b9f\u884c\u3057\u3066\u300cpackage.json\u300d\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code>npm init\n<\/code><\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u8cea\u554f\u304c\u3042\u308a\u307e\u3059\u3002\u9069\u5f53\u306b\u7b54\u3048\u307e\u3059\u3002<\/p>\n<h2>eslint\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u3067\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304b\u3089\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code>eslint --init\n<\/code><\/pre>\n<p>\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306e\u8cea\u554f\u304c\u59cb\u307e\u308a\u307e\u3059\u3002<br \/>\n\u77e2\u5370\u30ad\u30fc\u3067\u56de\u7b54\u3092\u9078\u629e\u3057\u3066\u3001Enter\u30ad\u30fc\u3067\u78ba\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><code>? How would you like to configure ESLint? Use a popular style guide\n? Which style guide do you want to follow? Google\n? What format do you want your config file to be in? JavaScript\nLocal ESLint installation not found.\nInstalling eslint, eslint-config-google\n<\/code><\/pre>\n<p>\u8cea\u554f\u304c\u7d42\u4e86\u3059\u308b\u3068\u3001node_modules\u30d5\u30a9\u30eb\u30c0\u30fc\u304c\u4f5c\u6210\u3055\u308c\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3059\u3002<br \/>\n\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(.eslintrc.js)\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>Style Guide\u306bGoogle\u3092\u9078\u629e\u3057\u305f\u306e\u3067\u3001\u300ceslint-config-google\u300d\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre><code>npm install --save-dev eslint-config-google\n<\/code><\/pre>\n<h2>eslint\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3059\u308b<\/h2>\n<p>\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre><code>module.exports = {\n    \"extends\": \"google\",\n    \"installedESLint\": true,\n    \"env\": {\n        \/\/ browser \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u4f7f\u7528\u3059\u308b\n        \"browser\": true,\n    },\n    \"rules\": {\n        \/\/ \u30a4\u30f3\u30c7\u30f3\u30c8\u30b9\u30bf\u30a4\u30eb\u306f4\u30b9\u30da\u30fc\u30b9\u306b\u5f37\u5236\n        \"indent\": [\"error\", 4],\n        \/\/ \u6539\u884c\u30b3\u30fc\u30c9\u306fWindows\n        \"linebreak-style\": [\"error\", \"windows\"],\n    },\n};\n<\/code><\/pre>\n<h2>ESLint\u3067\u691c\u8a3c\u3059\u308b<\/h2>\n<p>\u3053\u3053\u307e\u3067\u8a2d\u5b9a\u304c\u3067\u304d\u3066\u3044\u308c\u3070\u3001Visual Studio Code\u306fJavaScript\u306e\u30b3\u30fc\u30c9\u3092ESLint\u3067\u691c\u8a3c\u3057\u307e\u3059\u3002<\/p>\n<p>JavaScript\u30d5\u30a1\u30a4\u30eb\u3092Visual Studio Code\u3067\u958b\u304d\u307e\u3059\u3002<br \/>\nESLint\u3067\u691c\u8a3c\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/weblog\/wp-content\/uploads\/2016\/05\/eslint03-300x257.png\" alt=\"eslint03\" width=\"300\" height=\"257\" class=\"alignnone size-medium wp-image-7441\" srcset=\"https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint03.png?resize=300%2C257&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/05\/eslint03.png?w=576&amp;ssl=1 576w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/rcm-fe.amazon-adsystem.com\/e\/cm?t=gesource-22&#038;o=9&#038;p=15&#038;l=st1&#038;mode=books-jp&#038;search=JavaScript&#038;fc1=000000&#038;lt1=_blank&#038;lc1=3366FF&#038;bg1=FFFFFF&#038;f=ifr\" marginwidth=\"0\" marginheight=\"0\" width=\"468\" height=\"240\" border=\"0\" frameborder=\"0\" style=\"border:none;\" scrolling=\"no\"><\/iframe><\/p>\n<h2>\u5909\u66f4\u5c65\u6b74<\/h2>\n<ul>\n<li>2016\/08\/20 \u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>eslint\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b ESLint\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304b\u3089\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3001ESLint\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002 npm install -g eslint ESLint\u304c\u30a4 &#8230;<\/p>\n<p><a href=\"https:\/\/www.gesource.jp\/weblog\/?p=7438\" class=\"more-link\">Continue reading &lsquo;Visual Studio Code\u3067ESLint\u3092\u4f7f\u3046&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_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}},"categories":[14],"tags":[147,166],"class_list":["post-7438","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-javascript","tag-visualstudiocode"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/7438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7438"}],"version-history":[{"count":0,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/7438\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}