[英]How to correctly use Eslint rule newline-per-chained-call with Prettier in Angular
I added the rule:我添加了规则:
"newline-per-chained-call": [
"error",
{
"ignoreChainWithDepth": 2
}
]
to my .eslintrc.json
file.到我的.eslintrc.json
文件。
I Also extended "plugin:prettier/recommended"
.我还扩展"plugin:prettier/recommended"
。
Now when I write code like this:现在当我写这样的代码时:
test.random2().random2()
.random3();
I get error Delete ⏎↹↹↹ eslint (prettier/prettier).
我收到错误Delete ⏎↹↹↹ eslint (prettier/prettier).
in VSCode which I don't want to have.在我不想拥有的 VSCode 中。 How can I fix the configuration to allow this code structure?如何修复配置以允许此代码结构?
My .prettierrc.json
looks like this:我的.prettierrc.json
看起来像这样:
{
"singleQuote": true,
"useTabs": true,
"semi": true,
"bracketSameLine": true,
"endOfLine": "lf"
}
不能将 newline-per-chained-call 与 prettier 一起使用,因为 prettier 不允许这种行为......唯一可以做的就是删除 newline-per-chained-call 或删除 prettier 或在之前添加注释“// prettier-ignore”链式线
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.