Rumah > Soal Jawab > teks badan
Saya menggunakan Kod VS dengan Prettier 1.7.2 dan ESLint 1.7.0. Selepas setiap baris baharu saya mendapat:
[eslint] Delete `CR` [prettier/prettier]
Ini ialah .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
Fail:
{ "printWidth": 80, "tabWidth": 2, "semi": true, "singleQuote": true, "trailingComma": "es5", "bracketSpacing": true, "jsxBracketSameLine": false, }
Bagaimana untuk menghapuskan ralat ini?
P粉7879344762023-10-12 10:04:13
Cuba tetapkan dalam fail "endOfLine":"auto"
.prettierrc
atau tetapan
"prettier/prettier": [ "error", { "endOfLine": "auto" } ]
Di dalam objek fail eslintrcrules
.
Jika anda menggunakan mesin Windows, endOfLine
boleh "crlf" berdasarkan konfigurasi git anda.