我想在一个配置文件 .prettierrc 中为 HTML 和 JS 指定字符串长度。
module.exports = {
singleQuote: true,
printWidth: 80,
[HTML]: {
printWidth: 150,
},
};
但在日志中我得到了:
ReferenceError: HTML is not defined
答案 0 :(得分:1)
您应该使用 .prettierrc
格式,当您使用此格式时,visual studio code
也会提供智能感知。
您收到错误是因为:
overrides
JSON 键下指定在您的情况下,文件应如下所示:
.prettierrc
{
"singleQuote": true,
"printWidth": 80,
"overrides": [
{
"files": ["**/*.html"],
"options": {
"printWidth": 150
}
}
]
}