2023.01.17 Solve the format conflict with eslint when vscode uses prettier to format the code

1. Click on Settings - click on the setting code in the upper right corner.


2. Check or uncheck the configuration directly in the prettier plug-in, and finally generate the following code.

    "prettier.jsxSingleQuote": true, // JSX 中使用单引号而不是双引号。
    "prettier.printWidth": 180, // 指定每行代码的最佳长度,如果超出该长度则格式化。
    "prettier.semi": false, // 在所有代码语句的末尾添加分号。
    "prettier.singleQuote": true, // 使用单引号而不是双引号。
    "prettier.useEditorConfig": false, // 使用 .editorconfig 中的配置方案。
    "prettier.trailingComma": "none", // 指定添加尾后逗号的方式。选项:none──无尾后逗号、 es5──在 ES5 中有效
                                      // 的尾后逗号(如对象与数组等)、 all──尽可能添加尾后逗号(如函数参数)。


Because the formatting format of the prettier plug-in is relatively perfect at present, and then the difference between the formatting and the eslint inspection code lies in the above code. (Most people don't like displaying all the attributes of html tags in a new line after prettier formatting. The display code page is very long. Setting the length to 180 or a custom length can solve this problem.)

Guess you like

Origin blog.csdn.net/m0_46551050/article/details/128952980