reason
Due to the end of line style configuration, endoofline configuration has the following four options:
lf
– line feed only (\n), which is common in Linux, MacOS and git repos
CRLF
– carriage return + line feed character (\r \n), and windows
CR
– carriage return character only (\r), Rarely use
auto
– keep the existing end of the line (the mixed values in a file are standardized by looking at the content used after the first line)
Solution:
Configure endOfLine: ‘auto’ in prettier.config.js:
module.exports = {
semi: false, // unterminated semicolon
singleQuote: true, // single quotes
quoteProps: 'as-needed',
trailingComma: 'none', // final comma
// The point is that this one should be configured as auto
endOfLine: 'auto'
}