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
140
0
Share
Prettier
chiroruxx
April 25, 2018
More Decks by chiroruxx
See All by chiroruxx
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
110
Laravelのパッケージ全部紹介する
chiroruxx
2
110
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
32
PHPをGoで動かす
chiroruxx
0
84
Goを使ってTDDを体験しよう!
chiroruxx
1
940
今ならできる!PhpStormプラグイン開発
chiroruxx
0
89
Go Connectへの想い
chiroruxx
0
210
eBPF with PHPをさわる
chiroruxx
0
170
sl完全に理解したつもり
chiroruxx
0
150
Other Decks in Technology
See All in Technology
Zephyr(RTOS)でOpenPLCを実装してみた
iotengineer22
0
180
出版記念イベントin大阪「書籍紹介&私がよく使うMCPサーバー3選と社内で安全に活用する方法」
kintotechdev
0
140
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
3
2.1k
The essence of decision-making lies in primary data
kaminashi
0
240
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
270
自分をひらくと次のチャレンジの敷居が下がる
sudoakiy
5
1.8k
Cortex Codeでデータの仕事を全部Agenticにやりきろう!
gappy50
0
280
解剖"React Native"
hacusk
0
100
OpenClawでPM業務を自動化
knishioka
2
380
Embeddings : Symfony AI en pratique
lyrixx
0
460
トイルを超えたCREは何屋になるのか
bengo4com
0
120
「決め方」の渡し方 / How to hand over the "decision-making process"
pauli
6
1k
Featured
See All Featured
Building AI with AI
inesmontani
PRO
1
850
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Crafting Experiences
bethany
1
100
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
64
53k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
170
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
670
BBQ
matthewcrist
89
10k
Accessibility Awareness
sabderemane
0
92
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
240
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
860
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
700
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®依存 – ドキュメントが少ない – 細かい設定ができない ▪ アルファ版なので、今後を見守りたいですね