Prettier typescript act as tsx instead of ts
- 主要言語
- Java
- スター
- 5.7k
- フォーク
- 561
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 43
説明
I have this code and i saw a difference when running prettier using npm directly and when running using spotless
When using npm the code is formated like this
`export const myFunction = (`
But when using spotless the code change like this
`export const myFunction = (`
gradle configuration :
` typescript {
target 'src/**/*.ts'
prettier("${prettierVersion}")
.npmExecutable("${tasks.named('npmSetup').get().npmDir.get()}${npmExec}")
.nodeExecutable("${tasks.named('nodeSetup').get().nodeDir.get()}${nodeExec}")
.configFile('.prettierrc')
}`
npm run format command in package.json :
`"format": "prettier --config .prettierrc --ignore-path .prettierignore --write ./src/**",`
prettierrc tralingComa defined to "all"
i fixed by changing gradle configuration to this and now spotless format exactly as npm
`format 'typescript', {
target 'src/**/*.ts'
prettier("${prettierVersion}")
.npmExecutable("${tasks.named('npmSetup').get().npmDir.get()}${npmExec}")
.nodeExecutable("${tasks.named('nodeSetup').get().nodeDir.get()}${nodeExec}")
.configFile('.prettierrc')
}`
I think using predefined typescript format act as tsx format (i don't use tsx, but i saw that tsx require trailing coma in generics).
コントリビューションガイド
調査の方向性
再現にある Gradle の `typescript` 設定から始め、期待される出力を生成する明示的な `format 'typescript'` 設定と比較します。示されているジェネリック関数と `.prettierrc` 設定を使って両方のケースを再現し、その後、定義済みのフォーマットが TypeScript の入力を TSX として扱わなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- build-system, tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100