.eslintrc.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // https://eslint.org/docs/user-guide/configuring
  2. module.exports = {
  3. root: true,
  4. parserOptions: {
  5. parser: 'babel-eslint'
  6. },
  7. env: {
  8. browser: true,
  9. node: true,
  10. commonjs: true,
  11. es6: true,
  12. jquery: true // 添加对jquery的支持
  13. },
  14. extends: [
  15. // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
  16. // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
  17. 'plugin:vue/essential',
  18. // https://github.com/standard/standard/blob/master/docs/RULES-en.md
  19. 'standard'
  20. ],
  21. // 指定你所要使用的全局变量,true代表允许重写、false代表不允许重写
  22. globals: {
  23. mini: true,
  24. XLSX: true,
  25. VCode: true, // 验证码
  26. QRCode: true, // 二维码
  27. Swiper: true, // Swiper
  28. Steer: true // Steer
  29. },
  30. // required to lint *.vue files
  31. plugins: [
  32. 'vue'
  33. ],
  34. // add your custom rules here
  35. // 系数0为不提示(off)、1为警告(warn)、2为错误抛出(error)
  36. rules: {
  37. 'indent': [0, 4, {
  38. 'SwitchCase': 4
  39. }],
  40. // allow paren-less arrow functions
  41. 'arrow-parens': 0,
  42. // allow async-await
  43. 'generator-star-spacing': 'off',
  44. // allow debugger during development
  45. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  46. // allow / 强制 语句结束以分号结束
  47. 'semi': 0,
  48. // allow 连续声明 let a=1,b=2,....;
  49. 'one-var': 0,
  50. // allow new Object()
  51. 'no-new': 0,
  52. // 在创建对象字面量时不允许键重复 {a:1, a:1}
  53. 'no-dupe-keys': 2,
  54. // 函数参数不能重复
  55. 'no-dupe-args': 2,
  56. // 不能有声明后未被使用的变量或参数
  57. 'no-unused-vars': 0
  58. }
  59. };