0

我希望 ESLint 扩展成为内联 Javascript 中唯一的格式化程序。美化只是把它搞砸了,我必须手动纠正它。

我已将这些行添加到我的 .jsbeautifyrc 文件中:

    "format.contentUnformatted": "script",
    "format.unformatted": "script", 

但它没有效果:Beautify 仍然格式化 html 文件中的每一行。我在看什么?

4

1 回答 1

1

根据文档,它应该类似于:

{
  "unformatted": ["script"]
}

如果这不起作用,那么也许通过language设置这可能会起作用。

您可以使用 beautify.language 设置控制应美化哪些文件类型、扩展名或特定文件名。

{
 "beautify.language": {
   "js": {
     "type": ["javascript", "json"],
     "filename": [".jshintrc", ".jsbeautifyrc"]
     // "ext": ["js", "json"]
     // ^^ to set extensions to be beautified using the javascript beautifier
   },
   "css": ["css", "scss"],
   "html": ["htm", "html"]
   // ^^ providing just an array sets the VS Code file type
 }
}

上面的配置应该只对指定的 .js 文件启用格式化。

祝你好运。

于 2019-05-29T04:08:47.340 回答