为什么我总是收到 Delete 'cr' [prettier/prettier]? [英] Why do I keep getting Delete 'cr' [prettier/prettier]?

查看:167
本文介绍了为什么我总是收到 Delete 'cr' [prettier/prettier]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 Prettier 1.7.2 和 Eslint 1.7.0 的 vscode.在我得到的每个换行符之后:

I am using vscode with Prettier 1.7.2 and Eslint 1.7.0. After every newline I get:

[eslint] Delete 'cr' [prettier/prettier]

这是.eslintrc.json:

This is the .eslintrc.json:

{
  "extends": ["airbnb", "plugin:prettier/recommended"],
  "env": {
    "jest": true,
    "browser": true
  },
  "rules": {
    "import/no-extraneous-dependencies": "off",
    "import/prefer-default-export": "off",
    "no-confusing-arrow": "off",
    "linebreak-style": "off",
    "arrow-parens": ["error", "as-needed"],
    "comma-dangle": [
      "error",
      {
        "arrays": "always-multiline",
        "objects": "always-multiline",
        "imports": "always-multiline",
        "exports": "always-multiline",
        "functions": "ignore"
      }
    ],
    "no-plusplus": "off"
  },
  "parser": "babel-eslint",
  "plugins": ["react"],
  "globals": {
    "browser": true,
    "$": true,
    "before": true,
    "document": true
  }
}

.prettierrc 文件:

{
  "printWidth": 80,
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5",
  "bracketSpacing": true,
  "jsxBracketSameLine": false,
}

我怎样才能摆脱这个错误?

How can I get rid of this error?

推荐答案

尝试在您的 .prettierrc 文件(对象内部)中设置 "endOfLine":"auto"

Try setting the "endOfLine":"auto" in your .prettierrc file (inside the object)

或设置

'prettier/prettier': [
  'error',
  {
    'endOfLine': 'auto',
  }
]

在 eslintrc 文件的规则对象中.

inside the rules object of the eslintrc file.

如果你使用的是windows机器,endOfLine可以是crlf";根据您的 git 配置.

If you are using windows machine endOfLine can be "crlf" basing on your git config.

这篇关于为什么我总是收到 Delete 'cr' [prettier/prettier]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆