TypeScriptのフォーマットに関して We Are Javascritpters #13
FormattingTypeScript
View Slide
せ: @brn (ꫬꅿ⨳ⵃ)耵噟: ؿٗٝزؒٝسؒٝآص،٥ط؎ذ؍ـؒٝآص،⠓爡: Cyberagent ،سذؙأةآؔRightSegment٥AI Messengerـؚٗ: http://abcdef.gets.b6n.ch/Twitter: https://twitter.com/brn227GitHub: https://github.com/brn
鳞ְֿה؝٦ر؍ؚٝ鋉秈⡲ֻזְկٖؽُ٦׃ֻזְկ
tslintָֽ֮וְְׇfixתד׃ַ׃גֻזְկ
prettierׅ׀ֻؿؓ٦وحز׃גֻתׅיկ
Conflict֮ծֽוֿֿtslintהעאַגתׅי…
tslint-plugin-prettierconflictׅٕ٦ٕכ搀⸬ח׃ת׃׳ֲկֲ׃ת׃׳ֲկ
tslint׃䘌➂דַׅיկpre-commitؿحؙ剅ֹת׃׳ֲ
#!/bin/sh!!for file in $(git diff --cached --name-only --diff-filter=ACM | grep '\.tsx\?$' | tr '\n' ' ')!do!echo "prettier $file";!# Prettify all staged .js files!./node_modules/.bin/tslint $file -c ./tslint.json --exclude 'src/**/*.css' --project tsconfig.json --fix!!# Add back the modified/prettified files to staging!git add $file!!done!
husky and lint-staged荈ⴓד剅ֻ״嚂דׅיկhuskyדpre-commit鏣㹀׃גlint-stagedדlint剅ֻ
TypeScriptFormatterhttps://github.com/vvakame/typescript-formatter@vvakameָׁ⡲װאLanguageService⢪גؿؓ٦وحز׃תׅ
תה؝٦سךؿؓ٦وحزכⰋג荈⹛⻉ׅװד