Pol*_*olo 2 html javascript visual-studio-code prettier
我想在一个配置文件 .prettierrc 中指定 HTML 和 JS 的字符串长度。
module.exports = {
singleQuote: true,
printWidth: 80,
[HTML]: {
printWidth: 150,
},
};
Run Code Online (Sandbox Code Playgroud)
但在日志中我得到:
ReferenceError: HTML is not defined
Run Code Online (Sandbox Code Playgroud)
您应该使用该.prettierrc格式,visual studio code当您使用此格式时还将提供智能感知。
您收到错误是因为:
overrides任何覆盖都需要在JSON 键下指定在您的情况下,该文件应如下所示:
.prettierrc
{
"singleQuote": true,
"printWidth": 80,
"overrides": [
{
"files": ["**/*.html"],
"options": {
"printWidth": 150
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2588 次 |
| 最近记录: |