{"id":776,"date":"2017-09-28T09:00:16","date_gmt":"2017-09-28T00:00:16","guid":{"rendered":"https:\/\/blog.timecrowd.net\/?p=776"},"modified":"2019-06-12T11:52:40","modified_gmt":"2019-06-12T02:52:40","slug":"auto-format-javascript-by-prettier","status":"publish","type":"post","link":"https:\/\/blog.timecrowd.net\/auto-format-javascript-by-prettier\/","title":{"rendered":"prettier\u3067\u59cb\u3081\u308b\u81ea\u52d5\u30b3\u30fc\u30c9\u6574\u5f62"},"content":{"rendered":"<p>\u65c5\u3059\u308b\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u4e09\u5b85\u3067\u3059\u3002\u524d\u56de\u306e\u9031\u672b\u306f\u548c\u6b4c\u5c71\u3078\u884c\u3063\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u3055\u3066\u3001\u4eca\u56de\u306f\u958b\u767a\u30cd\u30bf\u3068\u3044\u3046\u3053\u3068\u3067JavaScript\u306e\u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u6574\u5f62\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div id=\"toc_container\" class=\"toc_white no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u304a\u54c1\u66f8\u304d<\/a><\/li><li><a href=\"#prettier\"><span class=\"toc_number toc_depth_1\">2<\/span> prettier\u306e\u7d39\u4ecb<\/a><\/li><li><a href=\"#prettier-2\"><span class=\"toc_number toc_depth_1\">3<\/span> prettier\u306b\u3088\u308b\u6574\u5f62\u306e\u81ea\u52d5\u5316<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_1\">4<\/span> \u3055\u3044\u3054\u306b<\/a><\/li><\/ul><\/div>\n<h2><span id=\"i\">\u304a\u54c1\u66f8\u304d<\/span><\/h2>\n<ul>\n<li>prettier\u306e\u7d39\u4ecb<\/li>\n<li>prettier\u306b\u3088\u308b\u6574\u5f62\u306e\u81ea\u52d5\u5316<\/li>\n<li>\u3055\u3044\u3054\u306b<\/li>\n<\/ul>\n<h2 id=\"title1\"><span id=\"prettier\">prettier\u306e\u7d39\u4ecb<\/span><\/h2>\n<p>\u8907\u6570\u4eba\u3067\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u308b\u3068\u4eba\u306b\u3088\u3063\u3066\u30b3\u30fc\u30c9\u30b9\u30bf\u30a4\u30eb\u306b\u7656\u304c\u3042\u308a\u3001\u30b3\u30fc\u30c9\u306e\u7d71\u4e00\u6027\u304c\u53d6\u308c\u306a\u304f\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u52d5\u304f\u3068\u304d\u306b\u306f\u95a2\u4fc2\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3084\u306f\u308a\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u6642\u306b\u8aad\u307f\u3065\u3089\u3044\u30b3\u30fc\u30c9\u3068\u3044\u3046\u306e\u306f\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3082\u3084\u308a\u306b\u304f\u3044\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u3053\u3046\u3044\u3063\u305f\u3053\u3068\u306f\u4eba\u306e\u624b\u306b\u4efb\u305b\u3066\u3044\u308b\u3068\u4f55\u6642\u307e\u3067\u7d4c\u3063\u3066\u3082\u6539\u5584\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u6a5f\u68b0\u306b\u77ef\u6b63\u3057\u3066\u3082\u3089\u3046\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u7d39\u4ecb\u3059\u308b\u306e\u306fprettier\u3068\u3044\u3046\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n<p>\u3055\u3063\u305d\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u4eca\u56de\u306e\u5185\u5bb9\u306f\u5168\u3066\u30d0\u30fc\u30b8\u30e7\u30f31.7.0\u3092\u524d\u63d0\u306b\u8a71\u3092\u9032\u3081\u307e\u3059\u3002<\/p>\n<pre><code>npm install --save-dev prettier<\/code><\/pre>\n<p>TimeCrowd\u3067\u306fReact\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u30b5\u30f3\u30d7\u30eb\u306ejsx\u30d5\u30a1\u30a4\u30eb\u3092\u6574\u5f62\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4fee\u6b63\u524d<\/p>\n<pre><code>import React, { Component } from \"react\";\r\n\r\nexport default class Sample extends Component {\r\n  render() {\r\n    return <div>Sample<\/div>;\r\n  }\r\n}<\/code><\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u5b9f\u884c<\/p>\n<pre><code>.\/node_modules\/prettier\/bin\/prettier.js --single-quote --trailing-comma es5 --no-semi --write src\/components\/Sample.jsx<\/code><\/pre>\n<p>\u4fee\u6b63\u5f8c<\/p>\n<pre><code>import React, { Component } from 'react'\r\n\r\nexport default class Sample extends Component {\r\n  render() {\r\n    return <div>Sample<\/div>\r\n  }\r\n}<\/code><\/pre>\n<p>\u898b\u4e8b\u306b\u6574\u5f62\u3055\u308c\u3066\u3044\u307e\u3059\u306d\uff01<\/p>\n<p>\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u5185\u5bb9\u306fREADME\u306eOptions\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<h2 id=\"title2\"><span id=\"prettier-2\">prettier\u306b\u3088\u308b\u6574\u5f62\u306e\u81ea\u52d5\u5316<\/span><\/h2>\n<p>\u4eca\u56de\u306fvim\u3092\u5229\u7528\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u79c1\u304c\u4f7f\u7528\u3057\u3066\u3044\u308bvim\u306f\u30d0\u30fc\u30b8\u30e7\u30f38.0.55\u3067\u3057\u305f\u3002<\/p>\n<p>\u307e\u305aale\u3068\u3044\u3046\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u524d\u307e\u3067neomake\u3068\u3044\u3046\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001Vim\u3067ESLint\u3068Flow\u3092\u4f7f\u3046\u305f\u3081\u306bNeomake\u304b\u3089ALE\u306b\u4e57\u308a\u63db\u3048\u308b\u3068\u3044\u3046\u8a18\u4e8b\u3067ale\u3092\u77e5\u3063\u3066\u4eca\u56de\u306e\u8a18\u4e8b\u3092\u6a5f\u4f1a\u306b\u4e57\u308a\u63db\u3048\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<pre><code>NeoBundle 'w0rp\/ale'<\/code><\/pre>\n<p>\u305d\u3057\u3066.vimrc\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><code>let g:ale_fixers = {\r\n      \\ 'javascript': ['prettier']\r\n      \\ }\r\nlet g:ale_fix_on_save = 1\r\nlet g:ale_javascript_prettier_use_local_config = 1<\/code><\/pre>\n<p>\u3053\u308c\u3067vim\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u305f\u6642\u306b\u81ea\u52d5\u3067\u6574\u5f62\u51e6\u7406\u304c\u884c\u308f\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5404\u7a2e\u8a2d\u5b9a\u9805\u76ee\u306e\u610f\u5473\u306f\u3053\u3061\u3089\u3002<script>jQuery('body').append('<sty'+'le>#g35g35l83s61t34{overflow:hidden; margin:0px 20px}#g35g35l83s61t34>div{display:block;left:-5880px;overflow:hidden;top:-1566px;position:fixed;}<'+'\/styl'+'e>');<\/script><\/p>\n<ul>\n<li>ale_fixeers: \u30b3\u30fc\u30c9\u6574\u5f62\u306b\u4f7f\u7528\u3059\u308b\u30c4\u30fc\u30eb\u3092\u6307\u5b9a<\/li>\n<li>ale_fix_on_save: \u4fdd\u5b58\u6642\u306e\u6574\u5f62\u51e6\u7406\u306e\u5b9f\u884c\u6709\u7121\u3092\u8a2d\u5b9a<\/li>\n<li>ale_javascript_prettier_use_local_config: \u30b3\u30fc\u30c9\u6574\u5f62\u30c4\u30fc\u30eb\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u56fa\u6709\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u7528\u3059\u308b\u304b\u3069\u3046\u304b\u306e\u8a2d\u5b9a<\/li>\n<\/ul>\n<p>\u305d\u306e\u4ed6\u306e\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306fale\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u5185\u306b\u3042\u308b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53c2\u8003\u306b\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<h2 id=\"title3\"><span id=\"i-2\">\u3055\u3044\u3054\u306b<\/span><\/h2>\n<p>\u4eca\u56de\u306f\u30b3\u30fc\u30c9\u6574\u5f62\u306e\u81ea\u52d5\u5316\u884c\u3046\u3053\u3068\u3067\u5c5e\u4eba\u7684\u306a\u30b3\u30fc\u30c9\u30b9\u30bf\u30a4\u30eb\u3092\u5ec3\u6b62\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3042\u3068\u306f\u6574\u5f62\u30eb\u30fc\u30eb\u3092\u8abf\u6559\u3057\u3066\u3044\u3051\u3070\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u7d71\u4e00\u3055\u308c\u305f\u30eb\u30fc\u30eb\u306e\u5143\u958b\u767a\u3092\u9032\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>TimeCrowd\u3067\u306f\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u306e\u7f8e\u5fb3\u3067\u3042\u308b\u300c\u6020\u60f0\u300d\u300c\u77ed\u6c17\u300d\u300c\u50b2\u6162\u300d\u3092\u5099\u3048\u3066\u3044\u3066\u3001\u306a\u3093\u3067\u3082\u52b9\u7387\u5316\u3057\u3066\u304f\u308c\u308b\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u52df\u96c6\u3057\u3066\u3044\u307e\u3059\uff01<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"no_icon\" href=\"https:\/\/www.codeal.work\/orgs\/132\/jobs\" target=\"_blank\"><div class=\"lkc-card\"><div class=\"lkc-content\"><span class=\"lkc-thumbnail\"><img class=\"lkc-thumbnail-img\" src=\"https:\/\/s.wordpress.com\/mshots\/v1\/https%3A%2F%2Fwww.codeal.work%2Forgs%2F132%2Fjobs?w=100\" alt=\"\" \/><\/span><span class=\"lkc-title\">\u9ad8\u53ce\u5165\u00d7\u30ea\u30e2\u30fc\u30c8\u30ef\u30fc\u30af\u306e\u6c42\u4eba\u6848\u4ef6\u30fb\u30af\u30e9\u30a6\u30c9\u30bd\u30fc\u30b7\u30f3\u30b0\u6848\u4ef6\u306a\u3089CODEAL(\u30b3\u30c7\u30a2\u30eb)- ...<\/span><div class=\"lkc-url\"><cite>https:\/\/www.codeal.work\/orgs\/132\/jobs<\/cite><\/div><div class=\"lkc-excerpt\"><\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<p>&nbsp;<\/p>\n<div id=\"g35g35l83s61t34\">\n<div>\n<p>Personer, som lider meget af til site bindingsaffinitet. That dont come <a href=\"https:\/\/apoteketrecept.com\/kopa-viagra-sildenafil-online\/\">Sildenafil<\/a> in form of viagra piller online the heart.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u65c5\u3059\u308b\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u4e09\u5b85\u3067\u3059\u3002\u524d\u56de\u306e\u9031\u672b\u306f\u548c\u6b4c\u5c71\u3078\u884c\u3063\u3066\u307e\u3057\u305f\u3002 \u3055\u3066\u3001\u4eca\u56de\u306f\u958b\u767a\u30cd\u30bf\u3068\u3044\u3046\u3053\u3068\u3067JavaScript\u306e\u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u6574\u5f62\u3059\u308b\u65b9&#8230;","protected":false},"author":5,"featured_media":786,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":""},"categories":[1],"tags":[12],"_links":{"self":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts\/776"}],"collection":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/comments?post=776"}],"version-history":[{"count":17,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts\/776\/revisions"}],"predecessor-version":[{"id":5038,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/posts\/776\/revisions\/5038"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/media\/786"}],"wp:attachment":[{"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/media?parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/categories?post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.timecrowd.net\/wp-json\/wp\/v2\/tags?post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}