在你混合重復按鈕之前,我知道有更多關于同一問題的帖子,我已經嘗試了解決方案但無濟于事(請參閱我帖子的最后一部分)。
我正在使用 React 17.0.2、ESLint 8.5.0 和 Prettier 2.5.1,幾乎在每個 js 檔案中都出現以下錯誤。
Delete `?`eslintprettier/prettier
這是它的樣子

這是我的 .eslintrc.json:
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 13,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"react/react-in-jsx-scope": "off"
}
}
我按照本指南將 ESLint 和 Prettier 添加到我的專案中
https://medium.com/how-to-react/config-eslint-and-prettier-in-visual-studio-code-for-react-js-development-97bb2236b31a
我已經嘗試了另一篇關于同一問題的幾乎所有建議都無濟于事......
為什么我總是收到 Delete 'cr' [prettier/prettier]?
我用過
git config --global core.autocrlf false
Deleted my project and cloned it again a few times, but no change. I've also tried some of the other suggestions where they edit .eslintrc.json but it either doesn't work or breaks my autoformat.
I'm out of ideas and spent way too much time on this, can anyone tell where I'm going wrong?
uj5u.com熱心網友回復:
許多編輯器允許您在 CRLF 和 LF 行結束模式之間切換。在 VSCode 上,這是底部選單欄上的切換,單擊時會切換。
更改所有檔案的默認值,settings.json在頂部編輯并添加以下內容:
對于默認 LF:
{
"files.eol": "\n",
}
對于默認 CRLF:
{
"files.eol": "\r\n",
}
uj5u.com熱心網友回復:
您可以輕松解決該問題。
在.eslintrc.json檔案中,您應該配置rules選項。
添加以下配置,它將解決問題。
"prettier/prettier": ["error", { "endOfLine": "auto" }]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/392125.html
標籤:reactjs git github eslint prettier
上一篇:Z80除法演算法運行不正常
