简体   繁体   中英

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.
I Also extended "plugin:prettier/recommended" .
Now when I write code like this:

test.random2().random2()
    .random3();

I get error Delete ⏎↹↹↹ eslint (prettier/prettier). in VSCode which I don't want to have. How can I fix the configuration to allow this code structure?

My .prettierrc.json looks like this:

{
    "singleQuote": true,
    "useTabs": true,
    "semi": true,
    "bracketSameLine": true,
    "endOfLine": "lf"
}

不能将 newline-per-chained-call 与 prettier 一起使用,因为 prettier 不允许这种行为......唯一可以做的就是删除 newline-per-chained-call 或删除 prettier 或在之前添加注释“// prettier-ignore”链式线

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM