美文网首页
vue-eslint配置文件

vue-eslint配置文件

作者: 凉介Seven | 来源:发表于2018-09-29 19:54 被阅读0次

在vue的配置文件.eslintrc.js中配置以下选项 这样只需要右键格式化以下文件夹,大部分eslint规则报错就会被干掉了

// 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: [
    'html'
  ],
  // 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',
    // js语句结尾必须使用 ;
    // 'semi': ['off', 'always'],
    'semi': ['error', 'always'],
    // 三等号
    'eqeqeq': 0,
    // 强制在注释中 // 或 /* 使用一致的空格
    'spaced-comment': 0,
    // 关键字后面使用一致的空格
    'keyword-spacing': 0,
    // 强制在 function的左括号之前使用一致的空格
    'space-before-function-paren': 0,
    // 引号类型
    "quotes": [0, "single"],
    "vue/no-parsing-error": [2, { "x-invalid-end-tag": false }]
  }
}


另外如果有些文件不想被eslint检测可以在.eslintignore文件夹中这样配置

build/*
config/*
test/*
src/store/*
src/utils/*
src/router/*
src/personalCenter/view/orders/info.vue

最后给大家一个eslint规则的api,方便大家开发
http://eslint.cn/docs/rules/

相关文章

  • vue-eslint配置文件

    在vue的配置文件.eslintrc.js中配置以下选项 这样只需要右键格式化以下文件夹,大部分eslint规则...

  • 配置文件使用实例

    从配置文件读取内容进行实例化 读取配置文件的类 配置文件 使用配置文件

  • springboot(2)配置文件与整合其他技术

    4.配置文件: 4.1 SpringBoot配置文件类型:4.2 yml配置文件简介与语法: 4.3配置文件与...

  • URXVT

    配置文件 生成简明的配置文件 生成有详细说明的配置文件 [1] 示例配置文件 .Xresource / .X...

  • Spring Boot

    配置文件 默认配置文件:application.properties 推荐配置文件:application.yml...

  • Nginx + Uwsgi的基础配置

    Nginx 配置文件: Uwsgi配置文件:

  • linux rabbitmq 修改端口号

    查找配置文件位置: 拷贝配置文件到 /etc/rabbitmq 目录下: 修改配置文件:

  • python配置文件读取

    1、ConfigParser读取配置文件模块 配置文件 [people]为section 2、读取配置文件

  • Hexo+Next的摸索

    区分站点配置文件和主题配置文件 站点配置文件路径:blog/_config.yml主题配置文件路径:blog/th...

  • 环境变量

    环境变量配置文件 查看环境变量 set source 配置文件 等同于 . 配置文件重新读取配置文件/etc...

网友评论

      本文标题:vue-eslint配置文件

      本文链接:https://www.haomeiwen.com/subject/ieiboftx.html