微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Prettier/VSCode 打破了语法

如何解决Prettier/VSCode 打破了语法

我正在尝试使用 prettier 格式化一个 js 文件,但似乎更漂亮的方式破坏了代码语法。我想实现这一目标 (expectated result) 但出现红线。保存时我得到以下 result。在运行代码时,我收到以下错误 TypeError: {} is not a function (error image)。我尝试了以下操作,但在我的情况下似乎没有任何效果

  1. Why do I keep getting Delete 'cr' [prettier/prettier]?
  2. Visual Studio Code [eslint] Delete 'CR' [prettier/prettier] on windows

我正在使用以下 .prettierrc.js

module.exports = {
  tabWidth: 2,bracketSpacing: true,endOfLine: "auto",jsxBracketSameLine: true,printWidth: 100,semi: false,singleQuote: false,trailingComma: "none"
}

在我的 .eslintrc.json 文件中,我为更漂亮设置了以下规则

"prettier/prettier": [
      "error",{
        "bracketSpacing": true,"endOfLine": "auto","jsxBracketSameLine": true,"printWidth": 100,"semi": false,"singleQuote": false,"trailingComma": "none"
      }
    ],

我尝试将 LF 更改为 CRLF,反之亦然,这出现在 vscode 的底部,但没有成功。我还缺少什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。