【发布时间】:2025-11-24 20:10:02
【问题描述】:
我在 Prettier 1.7.2 和 Eslint 1.7.0 中使用 vscode。在我得到的每个换行符之后:
[eslint] Delete 'cr' [prettier/prettier]
这是.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,
}
我怎样才能摆脱这个错误?
【问题讨论】:
-
看看你的 .eslintrc.js 文件。从 extends 数组中删除
'plugin:prettier/recommended'应该可以解决问题。 -
为什么要扩展
"plugin:prettier/recommended"?
标签: reactjs visual-studio-code prettier eslintrc