Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Formatting TypeScript

Formatting TypeScript

We Are Javascritpters #13


  1. Formatting TypeScript

  2. せ⵸: @brn (ꫬꅿ⨳ⵃ) 耵噟: ؿٗٝزؒٝسؒٝآص،٥ط؎ذ؍ـؒٝآص، ⠓爡: Cyberagent ،سذؙأةآؔRightSegment٥AI Messenger ـؚٗ:

    http://abcdef.gets.b6n.ch/ Twitter: https://twitter.com/brn227 GitHub: https://github.com/brn
  3. 鳞ְֿה ؝٦ر؍ؚٝ鋉秈⡲׶׋ֻזְկ ٖؽُ٦׃׋ֻזְկ

  4. tslintָ֮׷ ֽוְׇ׈ְfixתד׃ַ׃גֻ׸זְկ

  5. prettier ׅ׀ֻؿؓ٦وحز׃גֻ׸תׅיկ

  6. Conflict ֮ծֽוֿֿtslintהעאַ׏גתׅי…

  7. tslint-plugin-prettier conflictׅ׷ٕ٦ٕכ搀⸬ח׃ת׃׳ֲկ׉ֲ׃ת׃׳ֲկ

  8. tslint׃䘌׸׷ ➂꟦דַׅ׵יկ pre-commitؿحؙ剅ֹת׃׳ֲ

  9. #!/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!
  10. husky and lint-staged 荈ⴓד剅ֻ״׶嚂דׅיկ huskyדpre-commit鏣㹀׃גlint-stagedדlint׾剅ֻ

  11. TypeScriptFormatter https://github.com/vvakame/typescript-formatter @vvakameׁ׿ָ⡲׏׋װא LanguageService⢪׏גؿؓ٦وحز׃תׅ

  12. None
  13. תה׭ ؝٦سךؿؓ٦وحزכⰋג荈⹛⻉ׅ׷׿װד