栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > JavaScript

vue中eslintrc.js配置最详细介绍

JavaScript 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

vue中eslintrc.js配置最详细介绍

本文是对vue项目中自带文件eslintrc.js的内容解析,

介绍了各个eslint配置项的作用,以及为什么这样设置。

比较详细,看完能对eslint有较为全面的了解,基本解除对该文件的疑惑。









module.exports = {

 
 root: true, // 标识当前配置文件为eslint的根配置文件,让其停止在父级目录中继续寻找。


 
 parser: 'babel-eslint',


 
 parserOptions: {},


 
 env: {
  browser: true, // 浏览器环境
 },


 
 globals: {
  // gTool: true, // 例如定义gTool这个全局变量,且这个变量可以被重写
 },


 
 plugins: [
  'vue'
 ],


 
 extends: [
  'plugin:vue/essential', // 额外添加的规则可查看 https://vuejs.github.io/eslint-plugin-vue/rules/
  
  'airbnb-base',
 ],


 
 settings: {
  
  'import/resolver': {
   
   webpack: {
    config: 'build/webpack.base.conf.js'
   }
  }
 },

 
 overrides: [
  {
   'files': ['bin
 rules: {
  
  'import/extensions': ['error', 'always', {
   js: 'never',
   vue: 'never'
  }],
  'import/no-extraneous-dependencies': ['error', {
   optionalDependencies: ['test/unit/index.js']
  }],
  'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  "no-restricted-syntax": 0, //
  "guard-for-in": 0, //
  "prefer-const": 0, //
  "no-else-return": 0, //
  "no-plusplus": 0, // 不允许使用++符号
  "object-shorthand": ["error", "always", { "avoidQuotes": false }], // 去除禁止'videoData.isPause'(newValue) 的命名
  "no-lonely-if": 0, // 不允许给函数参数重新赋值
  "no-param-reassign": 0, // 不允许给函数参数重新赋值
  "no-mixed-operators": 0, // 不允许混合使用运算符
  "no-underscore-dangle": 0, // 不允许下划线作为变量名之一
  "no-under": 0, // 不允许混合使用运算符
  'generator-star-spacing': 'off',
  'no-console': 'off', // 禁用no-console规则
  'semi': ['error', 'never'], // 行尾不使用分号
  'comma-dangle': ['error'],
  'eqeqeq': 0, // 不需要强制使用全等
  'max-len': 0,
  'radix': 0,// parseInt不需要传第二个参数
  'linebreak-style': 0, // 强制执行一致的换行样式,windows和mac不一样
  'consistent-return': 0, // 箭头函数最后不需要最后强制return值
  'no-unused-expressions': ["error", { "allowShortCircuit": true, "allowTernary": true }], // 允许您在表达式中使用三元运算符
  'no-multi-spaces': ['error', { "ignoreEOLComments": true }],
 }
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/77762.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号