webstorm 设置缩进和es6冲突解决

webstorm 自定义缩进和ES6检测

参考 ES官网
需要设置以下几个文件
分别设置如下

  1. .eslintrc.js ES6的校验规则

    // https://eslint.org/docs/user-guide/configuring
    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'
    ],
    // required to lint *.vue files
    plugins: [
     'vue'
    ],
    // add your custom rules here
    rules: {
     // allow async-await
     'generator-star-spacing': 'off',
     // allow debugger during development
     'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
     'VariableDeclarator ': 4 // 校验缩进空格数量
    }
    }
  2. .editorconfig webStorm IDE 的缩进规则

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4 // 缩进数量
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
  1. .eslintignore 指定需要校验的文件
/build/
/config/
/dist/
/*.js
/test/unit/coverage/
*.vue // 指定校验文件
  1. .eslintrc.js 上右键,菜单底部有一个 “Apply ESLint Code Style Rule” 点击,之后自动格式化就会按照 eslint 的规则了
本作品采用《CC 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!