本文介绍了为什么我不断收到Delete'cr'[prettier/prettier]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将vscode与Prettier 1.7.2和Eslint 1.7.0一起使用.在每条换行符之后,我得到:
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,
}
如何摆脱这个错误?
推荐答案
尝试在.prettierrc文件(在对象内部)中设置"endOfLine":"auto"
Try setting the "endOfLine":"auto"
in your .prettierrc file (inside the object)
或设置
"prettier/prettier": ["error", {
..
"endOfLine":"auto"
..
}],
在eslintrc文件的rules对象中.
inside the rules object of the eslintrc file.
如果您使用的是Windows机器,则可以根据您的git配置将"endOfLine"设置为"crlf".
If you are using windows machine endOfLine can be "crlf" basing on your git config.
这篇关于为什么我不断收到Delete'cr'[prettier/prettier]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!