IDEA ESLint: Delete `␍` (prettier/prettier) 解决办法

IDEA ESLint About 472 words

警告原因

由于行尾风格配置导致。

endOfLine配置有以下四个选项:

  • lf:仅换行(\n),常见于LinuxmacOS以及git repos内部
  • crlf:回车 + 换行字符(\r\n),常见于Windows
  • cr:仅回车字符(\r),很少使用
  • auto:保持现有的行尾(一个文件中的混合值通过查看第一行之后使用的内容进行标准化)

解决办法

.prettier.jsprettier.config.js中添加endOfLine: 'auto'

module.exports = {
  tabWidth: 2, // indent width 缩进 2 个空格数
  semi: false, // ending semicolon 末尾不能使用分号
  singleQuote: true, // single quote 字符串必须使用单引号
  trailingComma: 'all', // trailing comma 末尾逗号

  // 重点是这一个要配置为 auto
  endOfLine: 'auto'
}
Views: 2,753 · Posted: 2022-06-12

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh