tjh0001 2019-12-19 16:44 采纳率: 0%
浏览 2068

vscode 自动保存无法生效?

用Vscode里eslint自动保存无法起作用,用Ctrl+s保存之后有一瞬间会变为正常的样式但是马上又会恢复成下面的样子

图片说明

下面是.eslintrc.js文件的配置

module.exports = {
  root: true,
  parserOptions: {
    parser: "babel-eslint"
  },
  env: {
    browser: true
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    "plugin:vue/essential",
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    "standard",
    "eslint:recommended",
    "plugin:vue/essential"
  ],
  // required to lint *.vue files
  plugins: ["vue"],
  // add your custom rules here
  rules: {
    // allow async-await
    "prettier.semi": false,
    "generator-star-spacing": "off",
    // allow debugger during development
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
    "indent": ["off", 2],
    "vue/require-v-for-key": 0,
    "vue/valid-v-for": 0,
    "vue/no-parsing-error": 0,
    "no-return-assign": 0,
    "no-unneeded-ternary": 0,
    "handle-callback-err": 0,
    "no-console": "off",
    "vue/script-indent": [
      "error",
      2,
      {
        baseIndent: 1,
        switchCase: 1
      }
    ]
  },
  overrides: [
    {
      'files': ['*.vue'],
      'rules': {
        'indent': 'off'
      }
    }
  ]
};

下面是settings.json配置

module.exports = {
  root: true,
  parserOptions: {
    parser: "babel-eslint"
  },
  env: {
    browser: true
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    "plugin:vue/essential",
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    "standard",
    "eslint:recommended",
    "plugin:vue/essential"
  ],
  // required to lint *.vue files
  plugins: ["vue"],
  // add your custom rules here
  rules: {
    // allow async-await
    "prettier.semi": false,
    "generator-star-spacing": "off",
    // allow debugger during development
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
    "indent": ["off", 2],
    "vue/require-v-for-key": 0,
    "vue/valid-v-for": 0,
    "vue/no-parsing-error": 0,
    "no-return-assign": 0,
    "no-unneeded-ternary": 0,
    "handle-callback-err": 0,
    "no-console": "off",
    "vue/script-indent": [
      "error",
      2,
      {
        baseIndent: 1,
        switchCase: 1
      }
    ]
  },
  overrides: [
    {
      'files': ['*.vue'],
      'rules': {
        'indent': 'off'
      }
    }
  ]
};

这个settings.json文件里面的eslint.autoFixOnSave这个自动格式化的代码不知道为什么报警告
图片说明

咨询一下各位大佬 这个该怎么改才可以正常的自动保存呢

  • 写回答

1条回答 默认 最新

  • 一只成序源 2019-12-20 10:19
    关注

    eslint的监测问题,可以关闭部分eslint监测即可。

    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)