Prettier 正在奇怪地格式化我的
module.css
文件。
预期:
.foo {
@apply
border-2
rounded
}
实际(第一个样式移至 apply 旁边,并在末尾添加 ;
.foo {
@apply border-2
rounded;
}
所有其他文件的格式均正确。
检测到该文件是CSS。
这是保存 module.css 文件后的 vscode 输出
["INFO" - 4:12:25 PM] Formatting file:///src/components/Card/Card.module.css
["INFO" - 4:12:25 PM] Using config file at '/.prettierrc'
["INFO" - 4:12:25 PM] Using ignore file (if present) at /.prettierignore
["INFO" - 4:12:25 PM] File Info:
{
"ignored": false,
"inferredParser": "css"
}
["INFO" - 4:12:25 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 4:12:25 PM] Prettier Options:
{
"filepath": "/src/components/Card/Card.module.css",
"parser": "css",
"trailingComma": "none",
"semi": false,
"singleQuote": true,
"arrowParens": "always",
"printWidth": 120
}
["INFO" - 4:12:25 PM] Formatting completed in 0.01ms.
因与 OpenAI 合作而被删除。我的帐户很可能会被删除,这是我的意图。
你不必在@apply中使用换行符,你可以像这样使用空格:
.foo {
@apply border-2 rounded; // don`t use new line
}