eslint报错文档大量红色报错符号 不自动修正

确保eslint在工作

控制台大量报错信息

确保setting.json

开了保存的时候自动格式化代码 这个时候保存的时候代码可以自动被格式化 但是 文档中和控制台中仍然有大量的报错 信息 此时此刻说明 格式化文档的文件不是按照eslint 格式化的

可以网上找找现成可用的setting.json抄一下 这是我的 配的乱七八糟的(网上东拼西凑的)

javascript 复制代码
{
  // #让函数(名)和后面的括号之间加个空格
  "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
  "explorer.confirmDragAndDrop": false,
  "javascript.preferences.quoteStyle": "single",
  "typescript.preferences.quoteStyle": "single",
  // tab 大小为2个空格
  "editor.tabSize": 2,
  // 100 列后换行
  "editor.wordWrapColumn": 100,
  // 保存时格式化
  // "editor.formatOnSave": true,
  // 开启 vscode 文件路径导航
  "breadcrumbs.enabled": true,
  // prettier 设置语句末尾不加分号
  "prettier.semi": false,
  // prettier 设置强制单引号
  "prettier.singleQuote": true,
  // 注释后面加空格
  "prettier.eslintIntegration": true,
  // 选择 vue 文件中 template 的格式化工具
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  // 显示 markdown 中英文切换时产生的特殊字符
  "editor.renderControlCharacters": true,
  // vetur 的自定义设置
  "vetur.format.defaultFormatterOptions": {
    "prettier": {
      "singleQuote": true, // true 为使用单引号
      "semi": true,// 去掉分号
      "singleAttributePerLine": true,
    },
    "js-beautify-html": {
      "wrap_attributes": "force",
      "wrap_attributes_mode": "auto",
      "wrap-line-length": 100,
      "wrapped_attributes_per_line": "multiple",
      "wrapped_attributes_indent": "auto",
      "wrapped_attributes_end": "auto"
    }
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[vue]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint" // 使用 vetur 格式化规则
  },
  "workbench.iconTheme": "vscode-icons-mac",
  "editor.bracketPairColorization.enabled": true,
  "editor.guides.bracketPairs": "active",
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "eslint.enable": true,
  "eslint.autoFixOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "true"
  },
"files.autoSave": "afterDelay",
"eslint.format.enable": true,
"editor.formatOnType": true,
  // eslint 检测文件类型
  "eslint.validate": [
    "html",
    "vue",
    "javascript",
    { "language": "html", "autoFix": true }
  ],
  "bracketPairColorizer.depreciation-notice": false,
  "diffEditor.ignoreTrimWhitespace": false,
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    },
    "Git Bash": {
      "source": "Git Bash"
    },
    "Windows PowerShell": {
      "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
    }
  },
  "terminal.integrated.defaultProfile.windows": "Windows PowerShell",
  "workbench.colorCustomizations": {},
  "workbench.colorTheme": "One Dark Pro Darker",
  "Codegeex.Privacy": false,
  "fileheader.configObj": {
    "Author": "Guomy",
    "createFileTime": true, // 设置为true则为文件新建时候作为date,否则注释生成时间为date

    "autoAdd": true, // 自动生成注释,老是忘记的同学可以设置

    "annotationStr": {
      "head": "/*",

      "middle": " * @",

      "end": " */",

      "use": true // 设置自定义注释可用
    },

    "headInsertLine": {
      "php": 2
    }
  },
  "fileheader.cursorMode": {
    "Description": "", // 文件内容描述

    "Author": "Guomy", // 编辑人

    "Date": "Do not edit", //时间

    "LastEditTime": "Do not edit",

    "LastEditors": " "
  },
  "editor.formatOnSave": true,
  "prettier.documentSelectors": ["\"singleAttributePerLine\": true,"],
  "prettier.requireConfig": true,
  "json.schemas": [
  ],
  "html.format.contentUnformatted": "",
  "eslint.format.enable": true,
  "eslint.notebooks.rules.customizations": [

  ],
}

配置格式化文档为eslint

注意这里点进去有vscode vetur prettier选项(如果安装过这种插件的话)

必须确保默认值为eslint 点进去配置默认格式化程序配置为eslint 我就是没有点进去配置默认格式化文档 点了很多次eslint 发现保存还是爆红 其实是当前一次配置为 eslint 但是每次保存的时候自动格式化又返回到设置的默认值了(如果默认值没有成功配置为eslint)

点完之后就没啥了

相关推荐
2501_915909062 天前
移动端开发工具链怎么组合比较好,iOS、Android、跨端三套配置方案
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
sunoo-2292 天前
【ARM嵌入式学习笔记Day6】一文打通i.MX6ULL时钟体系:PLL/PFD/预分频+滞回比较器全解析
arm开发·笔记·vscode·单片机·imx6ull·汇编语言
明天…ling2 天前
gitee与vscode远程连接
vscode·gitee
2501_915918412 天前
iOS编程用什么软件好?主流工具Xcode、AppCode、CodeRunner与新兴快蝎对比
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
__pop_3 天前
VSCode Remote SSH 远程连接 glibc 高版本依赖问题
vscode
daxiangxm3 天前
【趣味休息】“围住小猫在线玩”-“困住小猫”,又回来了
数据结构·人工智能·vscode·github·php
星光开发者3 天前
基于Spring Boot的充电桩管理系统的设计与实现-计算机毕设【课程设计】57105
vue.js·spring boot·vscode·mysql·django·php·express
程序员允诺3 天前
内网/无网环境必备:VS Code Remote-SSH 离线包下载与手动部署教程
vscode
darin_ฅ( ̳• ◡ • ̳)ฅ14 天前
【开发工具】2026版-VScode&IDEA&Cursor插件安装及插件配置迁移
vscode·idea
别动我齐刘海4 天前
ROS2 Jazzy + C++ 实战路线——进阶学习3
c++·人工智能·vscode·python·算法·机器学习·机器人