【问题标题】:How do I set up Prettier with Airbnb JavaScript Style Guide如何使用 Airbnb JavaScript 样式指南设置 Prettier
【发布时间】:2018-01-22 19:19:54
【问题描述】:

如何在 Prettier 中配置 Airbnb 的风格指南?我正在使用 VS 代码。 提前致谢!

【问题讨论】:

标签: javascript airbnb-js-styleguide eslint-config-airbnb prettier


【解决方案1】:

eslint-config-prettier 将禁用所有格式化规则。它在自述文件中多次提到eslint-config-airbnb,但他们不保证它 100% 遵循 airbnb 规则。

我想如果你想确保它们一起正常工作,你必须自己检查规则。

更新:

我已经检查了eslint-config-prettier 的源文件。以下是可以覆盖的规则列表:

// The following rules can be used in some cases. See the README for more
// information. (These are marked with `0` instead of `"off"` so that a
// script can distinguish them.)

curly: 0,
"max-len": 0,
"no-confusing-arrow": 0,
"no-mixed-operators": 0,
"no-tabs": 0,
quotes: 0,

根据他们的评论,其他格式规则不应该与 Prettier 一起使用。

【讨论】:

  • 非常感谢!
【解决方案2】:

您可以使用 eslint-config-prettier 来扩展 Prettier 配置。

【讨论】:

  • 谢谢!我会看看那个。
猜你喜欢
  • 2021-06-25
  • 2017-10-18
  • 2021-03-17
  • 2017-12-29
  • 1970-01-01
  • 2018-02-22
  • 2020-12-04
  • 2016-08-23
  • 2020-02-28
相关资源
最近更新 更多