Prettier配置适用于IntelliJ设置。

huangapple go评论54阅读模式
英文:

Prettier config for intellij settings

问题

在我们的前端(React)代码库中,有代码已经写了两年,使用了默认的 IntelliJ 代码设置。我们想开始使用 Prettier,不与一个 IDE 耦合,我们看到有两个选择:

  1. 在所有旧代码上运行 Prettier 并为代码样式配置 IntelliJ。
  2. 配置 Prettier 与 IntelliJ 默认的相同设置。

我们更倾向于选择第二个选项,因为我们想保持清晰的 Git 历史记录,关于如何使用 IntelliJ 设置配置 Prettier 以及是否听起来合适,您有什么建议吗?由于 Prettier 在一些代码样式方面持有特定意见。

英文:

On one of our frontend (react) repos we have code written for the past 2 years styled with default IntelliJ code-settings
We would like to start using Prettier and not be coupled with 1 IDE, we see 2 options:

  1. Run prettier on all legacy code and configure IntelliJ with prettier for code-style
  2. Configure prettier to the same settings IntelliJ has as default

We would prefer to go with option #2 since we want to keep a clean git history, any suggestions on how to configure Prettier with IntelliJ settings, and if that sounds like the right thing to do as Prettier is opinionated about some code-styles.

答案1

得分: 1

Prettier是一个有着非常有限一组配置选项的主观格式化工具,并且其团队不会接受添加新选项的请求,详情请见https://prettier.io/docs/en/option-philosophy.html。因此,很难配置Prettier以生成与IDEA格式化工具相同的输出。

我建议将Prettier用作您的代码格式化工具,可以将其设置为IDEA的默认格式化工具

英文:

Prettier is opinionated formatter with a very limited set of configuration options, and its team is not going to accept any requests for adding new options, see https://prettier.io/docs/en/option-philosophy.html. So Prettier can hardly be configured to produce the same output as IDEA formatter.

I'd suggest using Prettier as a formatter for your code, it can be set up as a default formatter for IDEA

huangapple
  • 本文由 发表于 2023年5月7日 22:13:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76194455.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定