【问题标题】:How can I prevent prettier behavior如何防止更漂亮的行为
【发布时间】:2020-03-23 12:37:10
【问题描述】:

我想要这样的格式

  @Matches(
    /^[a-zA-Z0-9_.-]*$/,{
      message: 'Please try again'
    })

更漂亮的重新格式化为

  @Matches(
    /^[a-zA-Z0-9_.-]*$/,
    {
      message: 'Please try again'
    }
  )

我不想禁用 prettier,我在根目录中有 .prettierrc 文件用于配置

【问题讨论】:

  • Webstom 插件。

标签: javascript typescript prettier


【解决方案1】:

您需要编辑根文件夹中的.prettierignore文件。

【讨论】:

  • 我不想禁用 prettier,我在根目录中有 .prettierrc 文件用于配置
  • 两个答案都指向同一个解决方案。他们并不是说要禁用它,而是要添加一个 .prettierignore 文件以及您已经拥有的 .prettier 文件
  • @AndrewNolan 如果我没记错的话,如果我在 prettierignore 中添加文件名,它将禁用文件更漂亮的格式,我不想这样
【解决方案2】:

要从格式中排除文件,请在项目根目录中的 .prettierignore 文件中添加条目或设置 --ignore-path CLI 选项。 .prettierignore 使用 gitignore 语法。

https://prettier.io/docs/en/ignore.html

希望这会有所帮助。

【讨论】:

  • 我不想禁用 prettier,我在根目录中有 .prettierrc 文件用于配置
猜你喜欢
  • 2021-10-09
  • 2021-12-24
  • 1970-01-01
  • 2015-04-05
  • 2021-05-10
  • 2020-11-21
  • 2020-02-13
  • 1970-01-01
  • 2021-06-02
相关资源
最近更新 更多