Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Prettier
Search
chiroruxx
April 25, 2018
Technology
0
120
Prettier
chiroruxx
April 25, 2018
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
元phperから見たGoの良いところ
chiroruxx
0
8
Go Connectへの想い
chiroruxx
0
130
GraphQLに入門してみた
chiroruxx
2
190
ドキュメンテーションコメント再入門
chiroruxx
0
82
我流カンファレンス楽しみ術
chiroruxx
0
58
最初の一歩を踏み出す言葉
chiroruxx
4
1.1k
PhpStormをIDEとして使う
chiroruxx
0
58
Goを始めて感じたPHPの魅力
chiroruxx
1
63
PHPでGUIアプリを作れなかった(pecl編)
chiroruxx
0
170
Other Decks in Technology
See All in Technology
「共通基盤」を超えよ! 今、Platform Engineeringに取り組むべき理由
jacopen
25
5.8k
社内勉強会運営のコツ
senoo
6
1.1k
Microsoft Cloudで開発ライフサイクルを保護する
kkamegawa
0
140
Amplify Gen2を 拡張してみよう JAWS-UG北陸新幹線 ( 福井開催 ) 2024-04-06/Let's extend Amplify Gen2
fossamagna
0
280
プロデザ! BY リクルート vol.18_リクルートのリサーチ実践組織「リサーチブーストコミュニティ」
recruitengineers
PRO
3
240
反実仮想機械学習とは何か
usaito
PRO
6
1.7k
NLP2024 参加報告LT ~RAGの生成評価と懇親戦略~ / nlp2024_attendee_presentation_LT_masuda
taro_masuda
1
190
転移学習とドメイン適応の基礎
kmatsui
2
570
"好き"との生活/Regularly update profile with GitHub Actions
judeeeee
0
150
プロトタイピングによる不確実性の低減 / Reducing Uncertainty through Prototyping
ohbarye
3
220
少数チームで挑む: SwiftUI, TCA, KMPを用いた 新規動画配信アプリ 「ABEMA Live」の開発について
tomu28
0
530
Aurora MySQL v3(MySQL8.0互換)の オンラインDDLの罠挙動を全バージョンで検証した
yutakikai
1
150
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
6
990
What’s in a name? Adding method to the madness
productmarketing
PRO
15
2.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
356
22k
The Art of Programming - Codeland 2020
erikaheidi
41
12k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
Bash Introduction
62gerente
604
210k
Done Done
chrislema
178
15k
Automating Front-end Workflow
addyosmani
1355
200k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
15
1.4k
BBQ
matthewcrist
80
8.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
29
46k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.4k
Transcript
PRETTIER PHP勉強会@東京 前田 和人
自己紹介 ▪ 前田 和人 ▪ @chiroruxxxx ▪ 弁護士ドットコム株式会社 ▪ Android派
None
Prettierってなに
Prettierとは? ▪ JavaScript®界隈で有名なコードフォーマッター ▪ Gopherの人はgofmtを思い浮かべてくれるといいです ▪ それのPHP版が出たという話
インストール $ yarn add --dev prettier/prettier @prettier/plugin-php ▪ これだけ!
実行 ▪ $ yarn run prettier /path/to/file –write ▪ Writeオプションがない場合は結果が出力されて終わる
▪ Writeオプションがある場合はファイルが書き換わる
使用例 <?php $indent = function () { return 2; };
<?php $indent=function(){return 2;};
php-cbfやphp-cs-fixerで 良いのでは
他ツールとの違い ▪ php-cbf・php-cs-fixer – PSRなどの様々なコーディング規約に則っているかを チェックする – 多くのオプションがあり独自カスタマイズ可能 – 違反をチェックしてくれる
▪ pritter – 対応しているものはPSR-1, PSR-2, PSR-12のみ – なるべくオプションを制限 – 違反という概念がない
その他の魅力 ▪ 長い行の自動改行 <?php $result = preg_match('@.*/ab.@', 'tooLongStriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing!'); <?php $result
= preg_match( '@.*/ab.@', 'tooLongStriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing!' );
その他の魅力 ▪ 無駄なスペースの除去 <?php $a = 'b’; <?php $a =
'b';
まとめ ▪ 良い – 細かい部分までフォーマットしてくれる – 設定がほぼ要らない ▪ 悪い –
JavaScript®依存 – ドキュメントが少ない – 細かい設定ができない ▪ アルファ版なので、今後を見守りたいですね