{"id":7442,"date":"2016-06-02T08:28:02","date_gmt":"2016-06-01T23:28:02","guid":{"rendered":"http:\/\/www.gesource.jp\/weblog\/?p=7442"},"modified":"2017-09-29T18:28:28","modified_gmt":"2017-09-29T09:28:28","slug":"strict%e3%83%a2%e3%83%bc%e3%83%89%e3%81%af%e3%82%b0%e3%83%ad%e3%83%bc%e3%83%90%e3%83%ab%e3%82%b9%e3%82%b3%e3%83%bc%e3%83%97%e3%81%a7%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%aa%e3%81%84","status":"publish","type":"post","link":"https:\/\/www.gesource.jp\/weblog\/?p=7442","title":{"rendered":"strict\u30e2\u30fc\u30c9\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u6307\u5b9a\u3057\u306a\u3044"},"content":{"rendered":"<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u306b&#8221;use strict&#8221;\u3092\u6307\u5b9a\u3059\u308b\u306e\u306f\u4e00\u822c\u306b\u306f\u907f\u3051\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u300e<a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4873116104\/ref=as_li_ss_tl?ie=UTF8&amp;camp=247&amp;creative=7399&amp;creativeASIN=4873116104&amp;linkCode=as2&amp;tag=gesource-22\" title=\"\u30e1\u30f3\u30c6\u30ca\u30d6\u30ebJavaScript \u2015\u8aad\u307f\u3084\u3059\u304f\u4fdd\u5b88\u3057\u3084\u3059\u3044JavaScript\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306e\u4f5c\u6cd5\">\u30e1\u30f3\u30c6\u30ca\u30d6\u30ebJavaScript \u2015\u8aad\u307f\u3084\u3059\u304f\u4fdd\u5b88\u3057\u3084\u3059\u3044JavaScript\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306e\u4f5c\u6cd5<\/a>\u300f\u3088\u308a\u3002<\/p>\n<p>&#8220;use strict&#8221;\u30d7\u30e9\u30b0\u30de\u306f\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3060\u3051\u3067\u306a\u304f\u3001\u95a2\u6570\u306e\u4e2d\u3067\u30ed\u30fc\u30ab\u30eb\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u65e2\u5b58\u306e\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3059\u308b\u5834\u5408\u3001strict\u30e2\u30fc\u30c9\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u6307\u5b9a\u3059\u308b\u3068\u3001\u65e2\u5b58\u306e\u30b3\u30fc\u30c9\u306bstrict\u30e2\u30fc\u30c9\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u30b3\u30fc\u30c9\u304c\u3042\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<pre><code>\/\/ Bad: \u30b0\u30ed\u30fc\u30d0\u30ebstrict\u30e2\u30fc\u30c9\n\"use strict\";\n<\/code><\/pre>\n<p>\u95a2\u6570\u306a\u3044\u3067\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001strict\u30e2\u30fc\u30c9\u306e\u9069\u7528\u7bc4\u56f2\u3092\u9650\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>function doSomething() {\n    \"use strict\";\n    \/\/\u30b3\u30fc\u30c9\n}\n<\/code><\/pre>\n<p>\u8907\u6570\u306e\u95a2\u6570\u306bstrict\u30e2\u30fc\u30c9\u3092\u9069\u7528\u3057\u305f\u3044\u3068\u304d\u306f\u3001\u5373\u6642\u95a2\u6570\u547c\u3073\u51fa\u3057\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre><code>(function() {\n    \"use strict\";\n\n    function doSomething() {\n        \/\/ \u30b3\u30fc\u30c9\n    }\n\n    function doSomethingElse() {\n        \/\/ \u30b3\u30fc\u30c9\n    }\n})();\n<\/code><\/pre>\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u306astrict\u30e2\u30fc\u30c9\u3092ESLint\u3067\u691c\u67fb\u3057\u305f\u3044\u5834\u5408\u306f\u3001&#8221;rules&#8221;\u306b\u6b21\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br \/>\n(\u53c2\u8003\uff1a<a href=\"http:\/\/eslint.org\/docs\/rules\/strict\" title=\"Rule strict - ESLint - Pluggable JavaScript linter\">Rule strict &#8211; ESLint &#8211; Pluggable JavaScript linter<\/a>)<\/p>\n<pre><code>\"strict\": [\"error\", \"function\"]\n<\/code><\/pre>\n<p>Visual Studio Code\u3067ESLint\u3092\u4f7f\u3063\u305f\u3068\u304d\u306e\u753b\u9762\u3067\u3059\u3002<br \/>\n\u30b0\u30ed\u30fc\u30d0\u30eb\u306astrict\u30e2\u30fc\u30c9\u3092\u30a8\u30e9\u30fc\u3068\u3057\u3066\u691c\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"\/weblog\/wp-content\/uploads\/2016\/06\/eslint-global-strict-mode.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/weblog\/wp-content\/uploads\/2016\/06\/eslint-global-strict-mode-300x171.png\" alt=\"eslint-global-strict-mode\" width=\"300\" height=\"171\" class=\"alignnone size-medium wp-image-7448\" srcset=\"https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/06\/eslint-global-strict-mode.png?resize=300%2C171&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.gesource.jp\/weblog\/wp-content\/uploads\/2016\/06\/eslint-global-strict-mode.png?w=700&amp;ssl=1 700w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u300e<a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4873116104\/ref=as_li_ss_tl?ie=UTF8&amp;camp=247&amp;creative=7399&amp;creativeASIN=4873116104&amp;linkCode=as2&amp;tag=gesource-22\" title=\"\u30e1\u30f3\u30c6\u30ca\u30d6\u30ebJavaScript \u2015\u8aad\u307f\u3084\u3059\u304f\u4fdd\u5b88\u3057\u3084\u3059\u3044JavaScript\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306e\u4f5c\u6cd5\">\u30e1\u30f3\u30c6\u30ca\u30d6\u30ebJavaScript \u2015\u8aad\u307f\u3084\u3059\u304f\u4fdd\u5b88\u3057\u3084\u3059\u3044JavaScript\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306e\u4f5c\u6cd5<\/a>\u300f\u52c9\u5f37\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><iframe src=\"http:\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=FFFFFF&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=gesource-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=4873116104\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u306b&#8221;use strict&#8221;\u3092\u6307\u5b9a\u3059\u308b\u306e\u306f\u4e00\u822c\u306b\u306f\u907f\u3051\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u3059\u3002 \u300e\u30e1\u30f3\u30c6\u30ca\u30d6\u30ebJavaScript \u2015\u8aad\u307f\u3084\u3059\u304f\u4fdd\u5b88\u3057\u3084\u3059\u3044JavaScript\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306e\u4f5c\u6cd5 &#8230;<\/p>\n<p><a href=\"https:\/\/www.gesource.jp\/weblog\/?p=7442\" class=\"more-link\">Continue reading &lsquo;strict\u30e2\u30fc\u30c9\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u6307\u5b9a\u3057\u306a\u3044&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],"class_list":["post-7442","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-javascript"],"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\/7442","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=7442"}],"version-history":[{"count":0,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/7442\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gesource.jp\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}