更漂亮的eslint:“=”之后的换行符

时间:2018-04-25 09:36:21

标签: eslint prettier

我对eslint + prettier有一个问题。出于某种原因,我有一些像这样的“换行符”:

var err = "jqxhr: " + jqxhr + ". Status: " + textStatus + ", " + error;

将通过工具美化:

var err =
    "jqxhr: " + jqxhr + ". Status: " + textStatus + ", " + error;

https://gyazo.com/ef44b03a25292f5e6e156c3105ef7c3b

我该如何防止这种行为?谢谢!

配置示例:

{
    "root": true,
    "extends": [
        "prettier",
        "prettier/standard"
    ],
    "env": {
        "browser": true,
        "jquery": true
    },
    "plugins": [
        "prettier"
    ],
    "rules": {
        "prettier/prettier": [
            "error"
        ],
        "indent": [
            "error",
            4
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "max-len": [
            "error",
            {"code": 120, "ignoreUrls": true}
        ]
    }
}

1 个答案:

答案 0 :(得分:1)

如果您遇到类似问题,请检查printWidth行和operator-linebreak。 我的情况与printWidth

有关