{"id":938,"date":"2018-10-20T23:10:02","date_gmt":"2018-10-20T14:10:02","guid":{"rendered":"http:\/\/168.138.214.208\/?p=938"},"modified":"2018-10-20T23:10:02","modified_gmt":"2018-10-20T14:10:02","slug":"post-938","status":"publish","type":"post","link":"https:\/\/nobunobu1717.site\/?p=938","title":{"rendered":"VSCode\u3067Node.js Typescript\u74b0\u5883\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210"},"content":{"rendered":"<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u6982\u8981<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_1\">2<\/span> \u524d\u63d0<\/a><\/li><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_1\">3<\/span> \u7a7a\u306e\u30d5\u30a9\u30eb\u30c0\u306e\u751f\u6210<\/a><\/li><li><a href=\"#npm\"><span class=\"toc_number toc_depth_1\">4<\/span> npm\u306e\u521d\u671f\u5316<\/a><\/li><li><a href=\"#i-4\"><span class=\"toc_number toc_depth_1\">5<\/span> \u8ffd\u52a0\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u6210<\/a><\/li><li><a href=\"#typescript\"><span class=\"toc_number toc_depth_1\">6<\/span> typescript<\/a><\/li><li><a href=\"#i-5\"><span class=\"toc_number toc_depth_1\">7<\/span> \u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u3092\u8a66\u3059<\/a><\/li><li><a href=\"#i-6\"><span class=\"toc_number toc_depth_1\">8<\/span> \u30c7\u30d0\u30c3\u30b0\u5b9f\u884c<\/a><\/li><li><a href=\"#TSLint\"><span class=\"toc_number toc_depth_1\">9<\/span> TSLint\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li><\/ul><\/div>\n<h2><span id=\"i\">\u6982\u8981<\/span><\/h2>\n<p>VSCode\u3067Typescript\u3092\u4f7f\u3063\u3066\u30c7\u30d0\u30c3\u30b0\u3067\u304d\u308b\u6240\u307e\u3067\u3092\u5fd8\u5099\u9332\u3068\u3057\u3066\u30e1\u30e2\u306b\u3002<\/p>\n<h2><span id=\"i-2\">\u524d\u63d0<\/span><\/h2>\n<p>Mac\u4e0a\u3067VSCode\u53ca\u3073Node.js\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u306e\u74b0\u5883\u3002<br \/>\nVSCode 1.28.0<br \/>\nNode.js 8.12<\/p>\n<p>\u305d\u308c\u4ee5\u5916\u306bVS\u62e1\u5f35\u3068\u3057\u3066<br \/>\nnom 0.3.5<br \/>\nTSLint 1.0.4.0<\/p>\n<p>\u306a\u3069\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\t<p style=\"color:#666;margin-bottom:5px;\">\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af<\/p>\n\t<div class=\"middle-ad\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\n\n<h2><span id=\"i-3\">\u7a7a\u306e\u30d5\u30a9\u30eb\u30c0\u306e\u751f\u6210<\/span><\/h2>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30eb\u30fc\u30c8\u3068\u306a\u308b\u3001\u7a7a\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3001VSCode\u3067\u958b\u304f\u3002<\/p>\n<h2><span id=\"npm\">npm\u306e\u521d\u671f\u5316<\/span><\/h2>\n<p>\u753b\u9762\u4e0a\u90e8\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u2192\u65b0\u3057\u3044\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u9078\u629e\u3059\u308b\u3002<br \/>\n\u30bf\u30fc\u30df\u30ca\u30eb\u304c\u8868\u793a\u3055\u308c\u3089\u3001\u304b\u3089\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002<br \/>\nnpm init -y<\/p>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306apackage.json\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"package.json\" >{\r\n  \"name\": \"nodeTest\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"\",\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n  },\r\n  \"keywords\": [],\r\n  \"author\": \"\",\r\n  \"license\": \"ISC\"\r\n}\r\n<\/pre>\n<p>\u4e0d\u7528\u306a\u8a2d\u5b9a\u3092\u30ab\u30c3\u30c8\u3057\u3001private\u9805\u76ee\u3092\u8ffd\u52a0\u3057true\u3068\u3059\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"package.json\" >{\r\n  \"name\": \"nodeTest\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"\",\r\n  \"main\": \"src\/index.js\",\r\n  \"private\": true\r\n}\r\n<\/pre>\n<h2><span id=\"i-4\">\u8ffd\u52a0\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u6210<\/span><\/h2>\n<p>\u30eb\u30fc\u30c8\u306b\u4ee5\u4e0b\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u8ffd\u52a0<br \/>\n.vscode<br \/>\nsrc<br \/>\nbuild<\/p>\n<p>src\u304ctypescript\u30d5\u30a1\u30a4\u30eb\u3001build\u304c\u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u7d50\u679c\u306ejs\u30d5\u30a1\u30a4\u30eb\u3092\u683c\u7d0d\u3059\u308b\u5834\u6240\u3068\u3057\u3066\u5229\u7528\u3002<\/p>\n<h2><span id=\"typescript\">typescript<\/span><\/h2>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002devDependencies\u306bTypescript\u304c\u8ffd\u52a0\u3055\u308c\u308b\u3002<br \/>\nnpm i -DE typescript ts-node <\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u306b\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002<br \/>\nnode_modules\/.bin\/tsc --init<\/p>\n<p>tsconfig.json\u304c\u30eb\u30fc\u30c8\u306b\u4f5c\u6210\u3055\u308c\u308b\u3002<br \/>\n\u8a2d\u5b9a\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"tsconfig.json\" >{\r\n  \"compilerOptions\": {\r\n    \"target\": \"ES2017\",\r\n    \"module\": \"commonjs\",\r\n    \"sourceMap\": true,\r\n    \"outDir\": \"build\",\r\n    \"strict\": true\r\n  },\r\n  \"include\": [\r\n    \"src\/**\/*\"\r\n  ]\r\n}<\/pre>\n<h2><span id=\"i-5\">\u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u3092\u8a66\u3059<\/span><\/h2>\n<p>src\u30d5\u30a9\u30eb\u30c0\u4ee5\u4e0b\u306bindex.ts\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u6253\u3061\u8fbc\u3080\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"index.ts\" >console.log(\"hello typescript!!\");\r\n<\/pre>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u2192\u30d3\u30eb\u30c9\u30bf\u30b9\u30af\u306e\u5b9f\u884c\u3000\u3092\u9078\u629e\u3057\u3066\u3001tsc:\u30d3\u30eb\u30c9\u3000\u3092\u9078\u629e\u3002<br \/>\nbuild\u30d5\u30a9\u30eb\u30c0\u4ee5\u4e0b\u306bindex.js\u304c\u51fa\u529b\u3055\u308c\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"index.js\" >\"use strict\";\r\nconsole.log(\"hello typescript!!\");\r\n\/\/# sourceMappingURL=index.js.map<\/pre>\n<h2><span id=\"i-6\">\u30c7\u30d0\u30c3\u30b0\u5b9f\u884c<\/span><\/h2>\n<p>.vscode\/lunch.josn\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"lunch.json\" >{\r\n    \"version\": \"0.2.0\",\r\n    \"configurations\": [\r\n        {\r\n            \"type\": \"node\",\r\n            \"request\": \"launch\",\r\n            \"name\": \"\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u8d77\u52d5\",\r\n            \"program\": \"${workspaceFolder}\/build\/index.js\",\r\n            \"preLaunchTask\": \"tsc: build - tsconfig.json\",\r\n            \"outFiles\": [\r\n                \"${workspaceFolder}\/build\/**\/*.js\"\r\n            ]\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n<p>\u4f5c\u6210\u5f8c\u3001\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u3092\u5f35\u3063\u3066\u30c7\u30d0\u30c3\u30b0\u5b9f\u884c\u3092\u884c\u3044\u3001\u6b62\u307e\u308b\u4e8b\u3092\u78ba\u8a8d\u3059\u308b\u3002<br \/>\n<a href=\"http:\/\/168.138.214.208\/wp-content\/uploads\/2018\/10\/lunchvscode.png\"><img src=\"http:\/\/168.138.214.208\/wp-content\/uploads\/2018\/10\/lunchvscode-300x98.png\" alt=\"\" width=\"300\" height=\"98\" class=\"aligncenter size-medium wp-image-943\" srcset=\"https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/lunchvscode-300x98.png 300w, https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/lunchvscode-768x252.png 768w, https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/lunchvscode-1024x336.png 1024w, https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/lunchvscode.png 1870w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2><span id=\"TSLint\">TSLint\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/span><\/h2>\n<p>\u9759\u7684\u89e3\u6790\u3068\u3057\u3066TSLint\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u30bf\u30fc\u30df\u30ca\u30eb\u304b\u3089\u4e0b\u8a18\u3092\u5b9f\u884c\u3059\u308b<br \/>\nnpm i -DE tslint<\/p>\n<p>\u5b9f\u884c\u5f8c\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u521d\u671f\u5316\u3092\u5b9f\u65bd\u3059\u308b\u3002<br \/>\nnode_modules\/.bin\/tslint --init<\/p>\n<p>\u5b9f\u65bd\u3059\u308b\u3068\u3001tslint.json\u304c\u751f\u6210\u3055\u308c\u308b\u3002<br \/>\n\u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b\u3002<br \/>\n\u2460rules\u3092\u8ffd\u8a18\u3002(console.log\u3067\u30a8\u30e9\u30fc\u3092\u51fa\u3059\u30eb\u30fc\u30eb\u3092\u9664\u5916)<br \/>\n\u2461defaultSeverity\u3092error\u304b\u3089warn\u306b\u5909\u66f4\u3002(TSLint\u3067\u691c\u51fa\u4e8b\u9805\u3092error\u3067\u306f\u306a\u304fwarn\u3068\u3057\u3066\u6271\u3046\uff09<\/p>\n<pre class=\"lang:default decode:true \" title=\"tslint.json\" >{\r\n    \"defaultSeverity\": \"warn\",\r\n    \"extends\": [\r\n        \"tslint:recommended\"\r\n    ],\r\n    \"jsRules\": {},\r\n    \"rules\": {\r\n        \"no-console\": false\r\n    },\r\n    \"rulesDirectory\": []\r\n}<\/pre>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8b66\u544a\u304c\u51fa\u308b\u3088\u3046\u306b\u306a\u308b\u4e8b\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<p><a href=\"http:\/\/168.138.214.208\/wp-content\/uploads\/2018\/10\/tslint.png\"><img src=\"http:\/\/168.138.214.208\/wp-content\/uploads\/2018\/10\/tslint-300x253.png\" alt=\"\" width=\"300\" height=\"253\" class=\"aligncenter size-medium wp-image-948\" srcset=\"https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/tslint-300x253.png 300w, https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/tslint-768x647.png 768w, https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/tslint-1024x863.png 1024w, https:\/\/nobunobu1717.site\/wp-content\/uploads\/2018\/10\/tslint.png 1217w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 \u6982\u89812 \u524d\u63d03 \u7a7a\u306e\u30d5\u30a9\u30eb\u30c0\u306e\u751f\u62104 npm\u306e\u521d\u671f\u53165 \u8ffd\u52a0\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u62106 typescript7 \u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u3092\u8a66\u30598 \u30c7\u30d0\u30c3\u30b0\u5b9f\u884c9 TSLint\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb \u6982\u8981 VSC &#8230; <\/p>\n","protected":false},"author":1,"featured_media":944,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22,16],"tags":[],"_links":{"self":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts\/938"}],"collection":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=938"}],"version-history":[{"count":9,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts\/938\/revisions"}],"predecessor-version":[{"id":950,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts\/938\/revisions\/950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/media\/944"}],"wp:attachment":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}