ããã«ã¡ã¯ãããã³ãã¨ã³ãã¨ãã¹ãã¼ããã¼ã ã®é´æ¨(@__sosukesuzuki)ã§ãã
å¼ç¤¾ã®ãµã¼ãã¹ã§ãã kintone ã§ã¯ãã³ã¼ãã®ãã©ã¼ãããã ESLint ã®ã¿ã§è¡ã£ã¦ããããããã¸ã§ã¯ãå ã§ã³ã¼ãã£ã³ã°ã¹ã¿ã¤ã«ãçµ±ä¸ãããã¦ããªãã¨ããåé¡ãæ±ãã¦ãã¾ããã
ãã㧠opinionated ãªã³ã¼ããã©ã¼ããã¿ã¼ Prettier ãå°å ¥ããã³ã¼ããã¼ã¹å ¨ä½ã§ã³ã¼ãã£ã³ã°ã¹ã¿ã¤ã«ãçµ±ä¸ããããã®æ¯æ´ãããã³ãã¨ã³ãã¨ãã¹ãã¼ããã¼ã ã§è¡ãã¾ããã
2011 å¹´ã«ãã¼ã³ãããã kintone ã§ã¯ãããã³ãã¨ã³ãã®å¤§é¨åã Closure Tools ã使ã£ã¦éçºããã¦ãã¾ããClosure Tools ã¯åã®æå®æ¹æ³ãã¯ã©ã¹ã®å®ç¾©æ¹æ³ãªã©ã«ç¬èªã·ã¹ãã ãæ¡ç¨ãã¦ãããç¾å¨ã® JavaScript ã®ã¨ã³ã·ã¹ãã ãä»æ§ã¨ä¸é¨ä¹é¢ãã¦ãã¾ãããã®ãããPrettier æ¬ä½ã Closure Tools ã«å¯¾å¿ãã¦ããªãé¨åããããPrettier ã kintone ã®éçºã«ãã®ã¾ã¾å°å ¥ãããã¨ãã§ãã¾ããã§ããã
ãããã£ãèæ¯ãããä»åãã¼ã ã®æ´»åã¨ã㦠Prettier ã« Closure Tools 対å¿ãå ¥ããæ´»åãè¡ãã¾ããã Prettier 㯠OSS ã¨ãã¦å ¬éããã¦ãã¾ãã®ã§ã Closure Tools ç¹æã®åé¡ã解決ããããã® PR ãåºãã¦åãè¾¼ãã§ãããã¾ããããã®çµæãkintone ã« Prettier ãå°å ¥ãããã¨ãã§ããããã«ãªãã¾ããã
ä»åã¯ãClosure Tools ããã¸ã§ã¯ãã«ã³ã¼ããã©ã¼ããã¿ã¼ Prettier ãå°å ¥ããã«ããã£ã¦ç´é¢ãã課é¡ã¨ãããã«å¯¾ãã¦ã©ã®ããã«å¯¾å¦ãã¦ãã£ãã®ããããã対å¦ãå«ã Prettier 2.2 ã®ãªãªã¼ã¹ã«ã¤ãã¦ç´¹ä»ãã¾ãã
Closure Tools ç°å¢ã§ã®éçºä½é¨ã®åä¸ã®æ段ã¨ãã¦ããã㦠OSS ã¸ã®åãåãæ¹ã¨ãã¦åèã«ãªãã°å¬ããã§ãã
å°å ¥ããã«ããã£ã¦ç´é¢ãããã°
ã¾ã試ãã« Prettier ã kintone ã®ã½ã¼ã¹ã³ã¼ãã«å¯¾ãã¦å®è¡ãã¦ã¿ã¾ããããããã¤ãã®åé¡ãçºçãã¾ãããåé¡ã®ãã¹ã¦ã Closure Tools ç¹æã®ã³ã¼ãã¹ã¿ã¤ã«ã«ãããã©ã¼ãããã®ãã°ã§ããã
1. åãå£ãã
Closure Tools ã§ã¯ JavaScript ã®ã³ã¼ãã«åãä»ãããã¨ãã§ãã¾ããTypeScript ã Flow ã®ããã«åãæ示ããããã®æ§æãããããã§ã¯ãªããJSDoc ã®ã³ã¡ã³ãã§è¨è¿°ãã¾ãã
/** * @type {string} */ const foo = "FOO";
ã¾ã次ã®ããã«ãã¦ãã£ã¹ãããããã¨ãã§ãã¾ãããã®ã¨ããå¼ãå²ãæ¬å¼§ã¯å¿ é ã§ãã
const foo = /** @type {string} */ (bar);
ãããå½æã® Prettier ã§ã¯ã³ã¡ã³ãã¨ãã£ã¹ãå¼ã®éã«æ¹è¡ãããã¨ãåå®ç¾©ãå£ãã¦ãã¾ããã°ãããã¾ããã
// Input const foo = /** @type {string} */ (bar); // Output const foo /** @type {string} */ = bar;
ãã®ãã©ã¼ãããã«ã¯æ¬¡ã®åé¡ãããã¾ãã
- ã³ã¡ã³ãã
=
ã®å·¦å´ã«ç§»åãã¦ããã bar
ãå²ãæ¬å¼§ãæ¶ãã¦ããã
kintone ã®ã½ã¼ã¹ã³ã¼ãä¸ã«ãããã®ãã°ã«ãã£ã¦åãå£ãã¦ãã¾ãé¨åãåå¨ãã¾ããã
ãªã®ã§ãã®ãã©ã¼ãããã®ãã°ãä¿®æ£ãã¾ããã
https://github.com/prettier/prettier/pull/7709
ãã®ä¿®æ£ã«ãããç¾å¨ã¯æ¬¡ã®ããã«ãã©ã¼ããããããããã«ãªã£ã¦ãã¾ãã
// Input const foo = /** @type {string} */ (bar); // Output const foo = /** @type {string} */ (bar);
ãã®ãã°ã¯ Closure Tools ç¹æã¨ããããã§ã¯ãªããJSDoc ã¹ã¿ã¤ã«ã§åãè¨è¿°ã§ããå¦çç³»ã§ããã°èµ·ãã£ã¦ãã¾ãåé¡ã§ãããªã®ã§ãããããã TypeScript ã® JSDoc ã³ã¡ã³ãããã使ã£ã¦ãã人ã¯ãã®ãã°ã«åºä¼ã£ããã¨ãããããããã¾ããã
2. é·ãã¹ã¼ãã¼ã¯ã©ã¹ãæãããã¾ãã
Closure Tools ã«ã¯é常㮠JavaScript ã¨ã¯ç°ãªããã¼ã ã¹ãã¼ã¹ã®æ¦å¿µãããã¾ã(https://developers.google.com/closure/library/docs/introduction#names)ã
ãããã§åºåããããã¹ã§ãã¼ã ã¹ãã¼ã¹ãå®ç¾©ãã¾ã(JavaScript ã®æ§æä¸ã¯ãã ã®ã¡ã³ãã¼å¼+代å
¥å¼ã§ã)ããã¨ãã°ã/abc/def/ghi.js
ã¨ãããã¹ã®ãã¡ã¤ã«ã®ãã¼ã ã¹ãã¼ã¹ã¯abc.def.ghi
ã¨å®ç¾©ãã¾ãã
goog.math.clamp = function(value, min, max) { return Math.min(Math.max(value, min), max); };
ãã®ããã«é¢æ°ãå®ç¾©ããå ´åã次ã®ããã«ãã¦ä½¿ããã¨ãã§ãã¾ãã
var clampedValue = goog.math.clamp(2, 3, 4);
ãã®ãã¼ã ã¹ãã¼ã¹ã®æ©è½ã¨ã¯ã©ã¹ãçµã¿åããã¦ä½¿ãã¨ãä¾ãã°æ¬¡ã®ãããªã³ã¼ããæ¸ããã¨ãããã¾ãã
aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 { method() { console.log("foo"); } };
ããã¯æ¥µç«¯ãªä¾ã§ãããã¤ã¾ããä»£å ¥å¼ã®å·¦è¾ºãã¡ã³ãã¼å¼ã§ãå³è¾ºãã¡ã³ãã¼å¼ãã¹ã¼ãã¼ã¯ã©ã¹ã¨ãã¦æã¤ã¯ã©ã¹å¼ãã«ãªã£ã¦ããç¶æ ã§ãã
ãã®ã¨ã以åã® Prettier ã¯æ¬¡ã®ããã«ããªãä¸éå端ãªä½ç½®ã«æ¹è¡ãå ¥ããããã«ãã©ã¼ãããããã¦ãã¾ããã
aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends aaaaaaaa .bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 { method() { console.log("foo"); } };
aaaaaaa
ã®å¾ãã«æ¹è¡ãå
¥ã£ã¦ãã¾ãã
ããã§ãæå³çã«ã¯ä½ãå¤ãããªãã®ã§ãããåç´ã«è¦ãç®ãè¯ããªãã®ã«å ãã¦ãã¼ã ã¹ãã¼ã¹ã®åå㧠grep ãããã¨ãã§ããªããªã£ã¦ãã¾ãã¨ããåé¡ãããã¾ããããã¨ãã°ãaaaaaaaa.bbbbbbbb...gggggggg1
ãåç
§ããã¦ããã¨ãããæ¢ãããã« grep ãããã¨ãã«ãPrettier ã«ããæ¹è¡ããã㨠grep çµæã«å«ã¾ããªããªã£ã¦ãã¾ãã¾ãã
ããã§ãã¹ã¼ãã¼ã¯ã©ã¹ã®å§ã¾ãã§æ¹è¡ãã¦æ¬å¼§ã§å²ãããã«ä¿®æ£ããã¾ããã
https://github.com/prettier/prettier/pull/9341
Prettier 2.2 以éã§ã¯ä¸è¨ã®ã³ã¼ãã¯æ¬¡ã®ããã«ãã©ã¼ãããããã¾ãã
aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends ( aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 ) { method() { console.log("foo"); } };
è¦ãç®ãæ´ã£ã¦ãã¦ãgrep ãé»å®³ãããã¨ãããã¾ããã
ãªãªã¼ã¹ãããªãã¨ä½¿ããªã
åé¡ã解決ãã Pull Request ããã¼ã¸ããã¦ãã¦ãããããå«ããã¼ã¸ã§ã³ããªãªã¼ã¹ããã¦ããªããã°ãããã¯ãã§ã¯ä½¿ããã¨ãã§ãã¾ããã
ãªã®ã§ãªãªã¼ã¹ãè¡ãå¿ è¦ãããã¾ãã
å¶ç¶ã«ãç§ã¯ Prettier ã®ã¡ã³ããã¼ã§ãªãªã¼ã¹ãæ å½ãã¦ããã®ã§ããªãªã¼ã¹ã¨ãã®ããã®ä½æ¥ãæ¥åæéã«è¡ãè¿ éã«ãªãªã¼ã¹ããããã¨ãã§ãã¾ããã
ããããå ã¯åè¿°ãã Closure Tools ç¹æã®åé¡ãã¡ã¨ã¯å¥ã§ãPrettier 2.2 ããªãªã¼ã¹ããã¨ãã®è©±ã«ãªãã¾ãã
ä½æ¥ãæ´çãã
Prettier ã§ã¯ GitHub Milestones ã使ã£ã¦ã¿ã¹ã¯ã管çãã¦ãã¾ãããã¼ã¸ã§ã³ã®ååãã¤ãããã¤ã«ã¹ãã¼ã³ããã£ã¦ãã¡ã³ããã¼ãã¡ãåã ããããä½æ¥ãåãã¤ã«ã¹ãã¼ã³ã«å ¥ãã¦ããã¾ãã
æ®æ®µã®ãªãªã¼ã¹ã§ã¯ãããããããªãªã¼ã¹ãããããããã¨ãã話ã«ãªã£ãã¨ãã«è©²å½ãã¼ã¸ã§ã³ã®ãã¤ã«ã¹ãã¼ã³ã«å ¥ã£ã¦ããã¿ã¹ã¯ãæ´çãã¾ãã
ä»åã¯ããªãªã¼ã¹ããããªã£ãã¿ã¤ãã³ã°ã§ãã§ã«ããã¤ãéè¦ãªæ©è½ããã¼ã¸ããã¦ããã®ã§ããã¤ã«ã¹ãã¼ã³ã«å ¥ã£ã¦ããã¿ã¹ã¯ããã¹ã¦ 2.3 ã¾ã§å»¶æãããã¨ã«ãªãã¾ããã
大ä½ã®å ´åããã®ãããªã¿ã¹ã¯ã¯ãã£ã½ã©ã¯ãªãã£ã«ã«ã§ãªãéãè¨ãåºãã£ãºããããªãã¨æ°¸é ã«ããããªãã®ã§ãä»å¾ã延æãããããããªãããª...ã¨æã£ã¦ãã¾ãã
ã¡ãªã¿ã«ããã¤ã«ã¹ãã¼ã³ã¯ GitHub ã§èª°ã§ãè¦ããã¨ãã§ãã¾ãã
https://github.com/prettier/prettier/milestones
ç ´å£çå¤æ´ããªãã¼ããã
ãªãã master ã«ç ´å£çå¤æ´ãã³ãããããã¦ããã®ã§ããããªãã¼ããã¾ãã
ã³ãããããã¦ããã ãã¶æéããã£ã¦ããã®ã§ãã¬ã¤ã«ãªãã¼ãããã®ãã¨ã¦ã大å¤ã§ãã(ãããå ¨ç¶æ¥½ãããªã)ã
https://github.com/prettier/prettier/pull/9500
ãã§ãã¯ãªã¹ããä½ã
GitHub ã® wiki ã«ãã§ãã¯ãªã¹ãã®éå½¢ãããã®ã§ããããã³ãã¼ã㦠issue ãä½æãã¾ãã
https://github.com/prettier/prettier/wiki/Release-Checklist
https://github.com/prettier/prettier/issues/9549
å¾ã¯ãåºæ¬çã«ãã®ãã§ãã¯ãªã¹ãã«å¾ã£ã¦ãªãªã¼ã¹ä½æ¥ãè¡ãã¾ãã
ãªãªã¼ã¹ããã°ãç¨æãã¾ãã
https://prettier.io/blog ã«æ稿ããããã®è¨äºãç¨æãã¾ãã
https://github.com/prettier/prettier/pull/9589
Prettier ã®ãªãªã¼ã¹ããã°ã¯ããªãã®åéãããã¾ããããã®ã»ã¨ãã©ãã¹ã¯ãªããã§èªåçæãã¦ãã¾ãã
ã¨ããã®ããå PR ã«è©³ç´°ãªãã§ã³ã¸ãã°ãå«ããããã«ãã¦ããã®ã§ããããã¹ã¯ãªããã§çµåããã ãã§ããã°è¨äºãã§ãã¾ããã¨ããããããããªãªã¼ã¹ããã°ã® Markdown ãã¡ã¤ã«ãç´æ¥ããã£ã¦ã¯ããã¾ããã
ä»ã®ããã¸ã§ã¯ãã§æ°ãã Prettier ãå®è¡ãã¦ã¿ã
Prettier ã¯å¤§éã®ã¹ãããã·ã§ãããã¹ããæã£ã¦ãã¾ããããã¡ãããããã¯å®å ¨ã§ã¯ããã¾ããã
ãªã®ã§ããã§ã« Prettier ã使ã£ã¦ãã OSS ããã¸ã§ã¯ãã«å¯¾ãã¦æ°ãã Prettier ãå®è¡ãåé¡ãçºçããªããããã§ãã¯ããå¿ è¦ãããã¾ãã
2.1 ã®ãªãªã¼ã¹ã¾ã§ã¯æ¬¡ã®å·¥ç¨ããã¹ã¦æåã§è¡ã£ã¦ãã¾ããã
- 対象ã®ãªãã¸ããªããã©ã¼ã¯ãã
- Prettier ã®ãã¼ã¸ã§ã³ãææ°ã«ãã
- Prettier å®è¡ã¹ã¯ãªããã調ã¹ã¦å®è¡ãã
- ã³ããããã
- PR ãåºãã¦å·®åãå ±æãã
ãã®ä¸é£ã®ä½æ¥ãåãªãã¸ããªãã¨ã«æ¯åè¡ãå¿ è¦ãããã¾ããã
ããã¯å¤§å¤é¢åãããã®ã§ãGitHub Actions ã使ã£ã¦æ¥½ã«ç¢ºèªã§ãããã¼ã«ãä½æããä»åã®ãªãªã¼ã¹ããã¯ããã使ãããã«ãªãã¾ããã Actions ã使ã£ã¦æ¥½ã«ç¢ºèªã§ãããã¼ã«ãä½æããã®ã§ãä»åã®ãªãªã¼ã¹ããã¯ããã使ãããã«ãªãã¾ããã
https://github.com/sosukesuzuki/prettier-regression-testing
GitHub ã® Issue ä¸ã§ run
ããå§ã¾ãã³ãã³ããã³ã¡ã³ãã¨ãã¦æ稿ããã¨ãäºåã«ç»é²ãã¦ãããªãã¸ããªã«å¯¾ãã¦æ°ãã Prettier ãå®è¡ãããã®å·®åãã³ã¡ã³ãã§è¦ãã¦ãããã¨ãããã®ã§ãã
å®éã« 2.2 ã®ãªã°ã¬ãã·ã§ã³ãã§ãã¯ã®ããã«ä½¿ããã Issue 㯠https://github.com/sosukesuzuki/prettier-regression-testing/issues/8 ã§ãã
ãã®ããã«ãIssue ä¸ã§åããã¸ã§ã¯ãã«æ°ãã Prettier ãå®è¡ããå·®åãã³ã¡ã³ãã§æãã¦ããã¾ãã
ãã®ãã¼ã«ã«ãããããªãç°¡åã«åé¡ãäºåã«é²ããããã«ãªãã¾ããã
(å®ã¯ãã®ãã¼ã«ã¯æ¬éç¨ãããã©ãããããããªãç¶æ ã§é©å½ã« JavaScript ã§æ¸ãã¦ãã¾ã£ã¦ãããªãéãªã³ã¼ãã«ãªã£ã¦ãã¾ã£ã¦ããã®ã§ãTypeScript ã§æ¸ãç´ããã¨æã£ã¦ãã¾ãã)
TypeScript 4.1 対å¿ã«ã¤ãã¦èãã
ä»åãªãªã¼ã¹ãããã¨ãã¦ããææã¯ãå¶ç¶ã«ã TypeScript 4.1 ã®ãªãªã¼ã¹ã¨éãªã£ã¦ãã¾ããã
ã©ãããã¤ãã¼ãªãªã¼ã¹ãããªããããããªãªã¼ã¹ããã TypeScript 4.1 対å¿ãããã£ãããããããå¤ãã®ã¦ã¼ã¶ã¼ããããæãã§ãããã¨ã¨æãã¾ãã
ãã ãTypeScript ã®æ°ãããã¼ã¸ã§ã³ã®ãµãã¼ãã¯ãããã¤ãã®ããã¸ã§ã¯ããã¾ããä½æ¥ã«ãªãã®ã§ãåé¡ãçºçããããæéãããã£ã¦ãã¾ããã¨ãå¤ãã§ããä»åãä¾ã«ããããããã¤ãåé¡ãçºçãã¦ãã¾ãã¾ããã
Prettier ã¯(ããã©ã«ãã§ã¯) typescript-eslint ããã¸ã§ã¯ããæä¾ãã¦ãããã¼ãµã¼ typesript-estree ã使ã£ã¦ TypeScript ã®ã³ã¼ãããã¼ã¹ãã¾ãããããããªãªã¼ã¹æºåãæ´ã£ãã¿ã¤ãã³ã°ã§ã¯ typescript-estree 㯠TypeScript 4.1 ã«å¯¾å¿ãããã¼ã¸ã§ã³ããªãªã¼ã¹ãã¦ãã¾ããã§ããã
çæ³ã¨ãã¦ã¯ãããã©ã«ãã®ãã¼ãµã¼ã§ãã typescript-estree ã® TypeScript 4.1 対å¿ãå¾ ã£ã¦ãã Prettier ããªãªã¼ã¹ãããã¨ããã§ãããããã®æç¹ã§ã¯ã©ã®ãããæéãããããããããã¾ããã§ããã
ä¸æ¹ Babel ã¯ãã®ã¨ããã§ã« TypeScript 4.1 ã®ãµãã¼ãããªãªã¼ã¹ãã¦ããã®ã§ããBabel ãä»ãã TypeScript 4.1 対å¿ã®ã¿ 2.2 ã«å ¥ãã¦ãtypescript-estree ã§ã®å¯¾å¿ã¯æ¬¡ã®ãã¼ã¸ã§ã³ã«å»¶æããããã¨ãã妥åã®æ¡ãææ¡ãã¾ããã
ãã¾ãæ¡ç¨ããããªã妥åã®æ¡ã§ã¯ãã£ããã®ã®ãç¹ã«å対æè¦ããªãã£ãã®ã§ãã®ã¾ã¾ãªãªã¼ã¹ãããã¨ãã¦ãã¾ããã
ããã TypeScript 4.1 ã® RC ããªãªã¼ã¹ãããã¿ã¤ãã³ã°ã§ typescript-estree ã TypeScript 4.1 対å¿çããªãªã¼ã¹ãã¾ãããããã«ãããã®ãªã®ãªã®ã¿ã¤ãã³ã°ã§ããã©ã«ããã¼ãµã¼ã§ã® TypeScript 4.1 対å¿ããªãªã¼ã¹ã§ããæºåãæ´ã£ããã®ããã«æããã¾ããã
ããããããã§ããä¸ã¤åé¡ãçºçãã¾ããåç´ã« typescript-estree ãã¢ãããã¼ãããã ãã§ã¯ãtypescript-estree 4.x ç³»ã®ç ´å£çå¤æ´ã®å½±é¿ã§ Prettier ã®æåãå£ãã¦ãã¾ããã¨ãããã£ãã®ã§ã(å®ã¯ããã¯åããããã£ã¦ãããã¨ã§ãå®å ¨ã«å¿ãã¦ãã¾ãã)ã
typescript-estree 4.x ç³»ã«ã¯ãä¸æ£ãªä½ç½®ã«åå¨ãããã³ã¬ã¼ã¿ã®ãã¼ãã AST ããæ¶ãããã«ãªãç ´å£çå¤æ´ãããã¾ãã(Pull Request ã¸ã®ãªã³ã¯)ã
@decorator interface Foo {} class Bar {}
ãã®ã³ã¼ã㯠TypeScript ã¨ãã¦ã¤ã³ããªããã§ã(TypeScript Playground ã¸ã®ãªã³ã¯)ãããã AST ãããã³ã¬ã¼ã¿ã®æ å ±ãå®å ¨ã«æ¶ãã¦ãã¾ãã¨ã³ã¼ããã©ã¼ããã¿ã¼çã«ã¯å°ãããã§ãã
ãã®ã¨ã Prettier ããã¼ãµã¼ã«æå¾ ããæåã¨ãã¦ã¯ãããã¼ãã®æ å ±ã AST ã«å«ããã or ãã¨ã©ã¼ãã¹ãã¼ãããã®ã©ã¡ããã§ãã
ããã§ãPrettier å´ã§ã¨ã©ã¼ãã¹ãã¼ããããã« 2 ã¤ã®æ¡ãææ¡ããã¾ããã
1 ã¤ãã¯ãå
¥åã®æååã¨åºåã®æååã®ããããã«å«ã¾ãã@
ã®æ°ãæ°ãã¦ãç°ãªã£ã¦ãããã¨ã©ã¼ãã¹ãã¼ãããã¨ãããã®ã§ããããªãæç´ãªåæã§ã¯ããã¾ãããããã§åããã¨ã¯ã§ãã¾ãã
2 ã¤ãã¯ãtypescript-estree ã® AST ã®ä»ã®ã¡ã¿æ
å ±ãè¿ã API ã使ã£ã¦é å¼µã£ã¦ãã³ã¬ã¼ã¿ã®æç¡ãå¤å®ãã¦ã¨ã©ã¼ãã¹ãã¼ãããã¨ãããã®ã§ããtypescript-estree ã«ã¯ parseAndGenerateServices
ã¨ããã¡ã½ãããããã¾ãããã®ã¡ã½ããã¯å
¥åã®æååããã¼ã¹ããAST ãçæããããã¨ã¨ãã«ããã¤ãã®ã¡ã¿æ
å ±ãè¿ãã¾ãã
ãã®ã¡ã¿æ
å ±ã®ä¸é¨ã使ãã°ããã³ã¬ã¼ã¿ã®æç¡ãå¤å®ãã¨ã©ã¼ãã¹ãã¼ãããã¨ãã§ãã¾ããããã®æ¹æ³ã«ãåé¡ãããã¾ãããparseAndGenerateServices
ã¡ã½ãã㯠Prettier ã«ã¨ã£ã¦å¿
è¦ãªæ
å ±ä»¥å¤ã«ãå¤ãã®æ
å ±ãåå¾ãã¦ãã¾ãããã®å¦çãéãã®ã§ããã©ã¼ãã³ã¹ã®æªåãæ¸å¿µãããã®ã§ãã
ãã㧠typescript-eslint ã®ã¡ã³ããã¼ã«ç¸è«ãããAST + Prettier ã«ã¨ã£ã¦å¿
è¦ãªã¡ã¿æ
å ±ãã®ã¿ãè¿ãæ°ãã API parseWithNodeMaps
ãå®è£
ãã¦ãããã¾ããã
ã¡ãªã¿ã« Prettier ã«ã¨ã£ã¦å¿
è¦ãªã¡ã¿æ
å ±ã¨ããã®ã¯ TypeScript Compiler API ã® AST ãã ESTree compatible 㪠AST ã¸ã® WeakMap(tsNodeToESTreeNodeMap
)ã¨ããã®éã® WeakMap(esTreeNodeToTSNodeMap
)ã§ãããããã使ãå¦çã¯ãã®ãããã«è¨è¿°ããã¦ããã®ã§ãèå³ããã£ããèªãã§ã¿ã¦ãã ããã
ãããã®ä½æ¥ããã£ã¦ããã TypeScript 4.1 ã®ãªãªã¼ã¹ãç¿æ¥ã«è¿«ã£ã¦ããã®ã§ 4.1 ã®æ£å¼ãªãªã¼ã¹ãå¾ ã£ã¦ãã Prettier ããªãªã¼ã¹ãããã¨ã«ãã¾ããã
TypeScript 4.1 ã®æ£å¼ãªãªã¼ã¹ã®æ¥ã«ããã«å¯¾å¿ãã Prettier ããªãªã¼ã¹ã§ãã¦è¯ãã£ã
— Sosuke Suzuki (@__sosukesuzuki) 2020å¹´11æ20æ¥
ãªãªã¼ã¹ãã
TypeScript 4.1 ã®æ£å¼ãªãªã¼ã¹ãæ¥ãã®ã§ãå¾ã¯ãªãªã¼ã¹ã¹ã¯ãªãããå©ãã ãã§ãã
Prettier ã®ãªãªã¼ã¹ã¹ã¯ãªããã¯éå»ã®ã¡ã³ããã¼ãã¡ãæ¸ãããã®ã§ã表示ãããæ示ã«å¾ã㨠npm ã¸ã® publish ã GitHub ã§ã®ã¿ã°ã®ç»é²ãªã©å ¨é¨ã§ããããã«ãªã£ã¦ãã¾ãã
ãªãªã¼ã¹å¾ã«è»½ãåä½ç¢ºèªããã¦ããªãªã¼ã¹ããã°ãå ¬éãããããªãªã¼ã¹ä½æ¥å®äºã§ãï¼
ã¾ã¨ã
Closure Tools ã§æ¸ããã大è¦æ¨¡ãªã½ã¼ã¹ã³ã¼ãã« Prettier ãå°å ¥ããã¾ã§ã®éã®ãã«ã¤ãã¦ç´¹ä»ãã¾ããã
ããã§ç´¹ä»ãããã¹ã¦ã®ä½æ¥ã¯ Prettier æ¬ä½ã«ãã¼ã¸ãããªãªã¼ã¹ããã¦ããã®ã§ãéå»ã«åããããªåé¡ã«ééãããã¨ãããæ¹ã¯ä»ããä¸åº¦è©¦ãã¦ã¿ããä¸æãããããããã¾ããã
ä»åç´¹ä»ããä½æ¥ã®ãããªããããã¯ãã®æ¹åã«å¿ è¦ãªä½æ¥ã OSS å´ã§è¡ãã®ãããã³ãã¨ã³ãã¨ãã¹ãã¼ããã¼ã ã®ä»äºã®ä¸è²«ã§ããèå³ã®ããæ¹ã¯ä»¥ä¸ã®æ¡ç¨ãã¼ã¸ãããå¿åãã ããã
https://cybozu.co.jp/company/job/recruitment/list/front_end_expert.html