Ich verwende VS Code mit Prettier 1.7.2 und ESLint 1.7.0. Nach jedem Zeilenumbruch erhalte ich:
[eslint] Delete `CR` [prettier/prettier]
Das ist .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
Datei:
{ "printWidth": 80, "tabWidth": 2, "semi": true, "singleQuote": true, "trailingComma": "es5", "bracketSpacing": true, "jsxBracketSameLine": false, }
Wie kann dieser Fehler behoben werden?
尝试在 .prettierrc(或 .prettierrc.json)文件(对象内部)中设置
"endOfLine":"auto"
或者设置
在 eslintrc 文件的
rules
对象内。如果您使用的是 Windows 机器,
endOfLine
可以根据您的 git 配置为“crlf”。