【发布时间】:2021-03-10 22:43:56
【问题描述】:
在我的项目中,有一个用于 NewRelic newrelic.yml 的 YAML 文件,其中包含用于设置 app_name 的 Ruby 代码。现有配置正在运行,我需要编辑该文件,但是当我尝试执行 yarn commit 时它失败并出现以下错误,对我来说这看起来像是一个 Prettier 错误。
我尝试在行前添加#prettier-ignore,但仍然导致提交失败。
node_modules/prettier/index.js:13588
throw error;
^
SyntaxError: Nested mappings are not allowed in compact mappings (18:13)
17 | # Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
> 18 | app_name: <%= ENV["SERVER_ENV"] == 'staging' ? 'MyApp (Staging)' : 'MyApp' %>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
我的代码编辑器是相关的 VSCode。
所以我想弄清楚为什么# prettier-ignore 不能像更漂亮的文档所指出的那样工作。或者弄清楚如何让事情格式化以通过,这显然是首选。
【问题讨论】:
标签: ruby-on-rails ruby yaml prettier prettier-vscode