【问题标题】: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 一起使用。