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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
chiroruxx
April 25, 2018
Technology
0
140
Prettier
chiroruxx
April 25, 2018
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
95
Laravelのパッケージ全部紹介する
chiroruxx
2
77
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
21
PHPをGoで動かす
chiroruxx
0
75
Goを使ってTDDを体験しよう!
chiroruxx
1
820
今ならできる!PhpStormプラグイン開発
chiroruxx
0
73
Go Connectへの想い
chiroruxx
0
200
eBPF with PHPをさわる
chiroruxx
0
150
sl完全に理解したつもり
chiroruxx
0
140
Other Decks in Technology
See All in Technology
2026年はチャンキングを極める!
shibuiwilliam
9
1.9k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
GCASアップデート(202510-202601)
techniczna
0
250
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
2
850
ZOZOにおけるAI活用の現在 ~開発組織全体での取り組みと試行錯誤~
zozotech
PRO
4
4.8k
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
180
Databricks Free Edition講座 データサイエンス編
taka_aki
0
290
What happened to RubyGems and what can we learn?
mikemcquaid
0
240
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
42k
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
1.1k
IaaS/SaaS管理における SREの実践 - SRE Kaigi 2026
bbqallstars
4
1.6k
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
200
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
0
52
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
72
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
90
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
56
50k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
290
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Site-Speed That Sticks
csswizardry
13
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Navigating Team Friction
lara
192
16k
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®依存 – ドキュメントが少ない – 細かい設定ができない ▪ アルファ版なので、今後を見守りたいですね