为什么我总是收到'删除`CR`”?
P粉850680329
P粉850680329 2023-10-11 13:35:23
0
1
437

我正在将 VS Code 与 Prettier 1.7.2 和 ESLint 1.7.0 结合使用。 在每个换行之后我得到:

[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, }

如何消除这个错误?

P粉850680329
P粉850680329

全部回复 (1)
P粉787934476

尝试在.prettierrc(或 .prettierrc.json)文件(对象内部)中设置"endOfLine":"auto"

或者设置

"prettier/prettier": [ "error", { "endOfLine": "auto" } ]

eslintrc文件的rules对象内。

如果您使用的是 Windows 机器,endOfLine可以根据您的 git 配置为“crlf”。

    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责声明 Sitemap
    PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!