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',
  },
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM