Vue Eslint检查报错Expected indentation of 8 spaces but found

Vscode 开发Vue Eslint检查报错“Expected indentation of 8 spaces but found...”

 

 解决方法:修改eslint配置文件.eslintrc.js

 

 .eslintrc.js

复制代码
// https://eslint.org/docs/user-guide/configuring

module.exports = {
  root: true,
  parser: 'vue-eslint-parser',
  parserOptions: {
    parser: 'babel-eslint',
    sourceType: 'module',
  },
  env: {
    browser: true,
    node: true,
    es6: true,
  },
  extends: 'eslint:recommended',
  // required to lint *.vue files
  plugins: ['vue'],
  globals: {
    document: true,
    window: true,
  },
  // add your custom rules here
  rules: {
    //0--不启用; 1--出现问题会有警告; 2--出现问题会报错
    indent: [
      2,
      2,
      {
        SwitchCase: 1, // (默认:0)指定 switch-case 语句的缩进级别
      },
    ], // 强制使用一致的缩进
    // eqeqeq: [2, 'always'], // 要求使用 === 和 !==
    eqeqeq: ['off'], // 关闭要求使用 === he !==
    semi: [2, 'never'], // 要求或禁止使用分号代替 ASI
    quotes: [2, 'single'], // 强制使用一致的反勾号、双引号或单引号
    'no-console': 'off',
    camelcase: 2, //强制驼峰法命名
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  },
}
复制代码

 

posted @   落花看风雪  阅读(7484)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示